• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_ABILITY_RUNTIME_ETS_INTERFACE_H
17 #define OHOS_ABILITY_RUNTIME_ETS_INTERFACE_H
18 
19 #include <functional>
20 #include <map>
21 #include <string>
22 #include "ets_exception_callback.h"
23 #include "ets_native_reference.h"
24 #include "napi/native_api.h"
25 
26 extern "C" {
27 struct ETSEnvFuncs {
28     void (*InitETSSDKNS)(const std::string &path) = nullptr;
29     void (*InitETSSysNS)(const std::string &path) = nullptr;
30 
31     bool (*Initialize)() = nullptr;
32     void (*RegisterUncaughtExceptionHandler)(
33         const OHOS::EtsEnv::ETSUncaughtExceptionInfo &uncaughtExceptionInfo) = nullptr;
34     ani_env *(*GetAniEnv)() = nullptr;
35     void (*HandleUncaughtError)() = nullptr;
36     bool (*PreloadModule)(const std::string &modulePath) = nullptr;
37     bool (*LoadModule)(const std::string &modulePath, const std::string &srcEntrance, void *&cls,
38         void *&obj, void *&ref) = nullptr;
39     void (*SetAppLibPath)(const std::map<std::string, std::string> &abcPathsToBundleModuleNameMap,
40         std::function<bool(const std::string &bundleModuleName, std::string &namespaceName)> &cb) = nullptr;
41     void (*FinishPreload)() = nullptr;
42     void (*PostFork)(void *napiEnv, const std::string &aotPath) = nullptr;
43     void (*PreloadSystemClass)(const char *className) = nullptr;
44 };
45 }
46 #endif // OHOS_ABILITY_RUNTIME_ETS_INTERFACE_H
47