1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ACE_FRAMEWORK_CJ_NATIVE_VIEW_FFI_H 17 #define OHOS_ACE_FRAMEWORK_CJ_NATIVE_VIEW_FFI_H 18 19 #include <cstdio> 20 #include <cstdint> 21 22 #include "bridge/cj_frontend/interfaces/cj_ffi/cj_macro.h" 23 #include "bridge/cj_frontend/interfaces/cj_ffi/utils.h" 24 25 using VectorCJInt64Handle = void*; 26 extern "C" { 27 struct VectorToCFFIArray { 28 size_t size; 29 int64_t* buffer; 30 void (*free)(int64_t*); 31 }; 32 33 CJ_EXPORT void FfiOHOSAceFrameworkThrowNativeError(const char* msg); 34 CJ_EXPORT void FfiOHOSAceFrameworkNativeLog(const char* msg); 35 CJ_EXPORT bool FfiOHOSAceFrameworkLoadNativeView(int64_t nativeViewID); 36 CJ_EXPORT void FfiOHOSAceFrameworkNativeViewCreate(int64_t nativeViewID); 37 CJ_EXPORT int64_t FfiOHOSAceFrameworkNativeViewCtor(int64_t remoteId); 38 CJ_EXPORT void FfiOHOSAceFrameworkNativeViewDestroy(int64_t id); 39 CJ_EXPORT void FfiOHOSAceFrameworkNativeViewBindRemote(int64_t nativeViewId, int64_t view); 40 CJ_EXPORT void FfiOHOSAceFrameworkNativeViewMarkNeedUpdate(int64_t nativeViewId); 41 CJ_EXPORT bool FfiOHOSAceFrameworkNativeViewNeedsUpdate(int64_t nativeViewId); 42 CJ_EXPORT void FfiOHOSAceFrameworkNativeViewMarkStatic(int64_t nativeViewId); 43 CJ_EXPORT bool FfiOHOSAceFrameworkNativeViewIsStatic(int64_t nativeViewId); 44 CJ_EXPORT ExternalString FfiOHOSAceFrameworkProcessViewId(int64_t nativeViewId); 45 CJ_EXPORT bool FfiOHOSAceFrameworkNativeViewIsFirstRender(int64_t nativeViewId); 46 47 CJ_EXPORT VectorToCFFIArray FfiOHOSAceFrameworkViewGetDeletedElemtIds(int64_t nativeViewId); 48 CJ_EXPORT VectorCJInt64Handle FFICJCreateVectorCJInt64(int64_t size); 49 CJ_EXPORT void FFICJVectorCJInt64SetElement(VectorCJInt64Handle vec, int64_t index, int64_t value); 50 CJ_EXPORT void FFICJVectorCJInt64Delete(VectorCJInt64Handle vec); 51 52 CJ_EXPORT void FfiOHOSAceFrameworkNativeViewSyncInstanceId(int64_t nativeViewId); 53 CJ_EXPORT void FfiOHOSAceFrameworkNativeViewRestoreInstanceId(int64_t nativeViewId); 54 CJ_EXPORT void FfiOHOSAceFrameworkNativeViewFinishUpdateFunc(int64_t nativeViewId, int64_t elmtId); 55 CJ_EXPORT void FfiOHOSAceFrameworkViewDeletedElmtIdsHaveBeenPurged(int64_t nativeViewId, VectorCJInt64Handle vec); 56 } 57 58 #endif // OHOS_ACE_FRAMEWORK_CJ_NATIVE_VIEW_FFI_H 59