133eb0b6dSopenharmony_ci/* 233eb0b6dSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 333eb0b6dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 433eb0b6dSopenharmony_ci * you may not use this file except in compliance with the License. 533eb0b6dSopenharmony_ci * You may obtain a copy of the License at 633eb0b6dSopenharmony_ci * 733eb0b6dSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 833eb0b6dSopenharmony_ci * 933eb0b6dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1033eb0b6dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1133eb0b6dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1233eb0b6dSopenharmony_ci * See the License for the specific language governing permissions and 1333eb0b6dSopenharmony_ci * limitations under the License. 1433eb0b6dSopenharmony_ci */ 1533eb0b6dSopenharmony_ci 1633eb0b6dSopenharmony_ci#ifndef FOUNDATION_ACE_NAPI_NATIVE_ENGINE_NATIVE_SENDABLE_H 1733eb0b6dSopenharmony_ci#define FOUNDATION_ACE_NAPI_NATIVE_ENGINE_NATIVE_SENDABLE_H 1833eb0b6dSopenharmony_ci 1933eb0b6dSopenharmony_ci#include "ecmascript/napi/include/jsnapi.h" 2033eb0b6dSopenharmony_ci#include "native_engine/native_property.h" 2133eb0b6dSopenharmony_ci 2233eb0b6dSopenharmony_ciusing FunctionRef = panda::FunctionRef; 2333eb0b6dSopenharmony_ciusing panda::Local; 2433eb0b6dSopenharmony_ci 2533eb0b6dSopenharmony_ciclass NativeSendable { 2633eb0b6dSopenharmony_cipublic: 2733eb0b6dSopenharmony_ci static FunctionRef::SendablePropertiesInfos CreateSendablePropertiesInfos(napi_env env, 2833eb0b6dSopenharmony_ci const NapiPropertyDescriptor* properties, 2933eb0b6dSopenharmony_ci size_t propertiesLength); 3033eb0b6dSopenharmony_ci static void NapiDefineSendabledProperty(napi_env env, 3133eb0b6dSopenharmony_ci Local<panda::ObjectRef>& obj, 3233eb0b6dSopenharmony_ci NapiPropertyDescriptor& propertyDescriptor, 3333eb0b6dSopenharmony_ci Local<panda::JSValueRef>& propertyName, 3433eb0b6dSopenharmony_ci bool& result); 3533eb0b6dSopenharmony_ci static void InitSendablePropertiesInfo(napi_env env, 3633eb0b6dSopenharmony_ci FunctionRef::SendablePropertiesInfo& info, 3733eb0b6dSopenharmony_ci NapiPropertyDescriptor propertyDescriptor, 3833eb0b6dSopenharmony_ci FunctionRef::SendableType type = FunctionRef::SendableType::NONE); 3933eb0b6dSopenharmony_ci 4033eb0b6dSopenharmony_ciprivate: 4133eb0b6dSopenharmony_ci static Local<panda::JSValueRef> NapiNativeCreateSendableFunction(napi_env env, 4233eb0b6dSopenharmony_ci const char* name, 4333eb0b6dSopenharmony_ci NapiNativeCallback cb, 4433eb0b6dSopenharmony_ci void* value); 4533eb0b6dSopenharmony_ci}; 4633eb0b6dSopenharmony_ci 4733eb0b6dSopenharmony_ci#endif 48