• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 STUB_JS_RUNTIME_H
17 #define STUB_JS_RUNTIME_H
18 
19 #include <iostream>
20 #include <map>
21 #include <memory>
22 #include <string>
23 
24 namespace OHOS {
25 namespace AbilityRuntime {
26     class Runtime {
27     public:
28         enum class Language {
29             JS = 0,
30             CJ,
31             ETS,
32             UNKNOWN,
33         };
34 
35         struct Options {
36             Language lang = Language::JS;
37             std::string bundleName;
38             std::string moduleName;
39             bool loadAce = true;
40             bool preload = false;
41             bool isBundle = true;
42             bool isDebugVersion = false;
43             bool isJsFramework = false;
44             bool isStageModel = true;
45             bool isTestFramework = false;
46             int32_t uid = -1;
47             // ArkTsCard start
48             bool isUnique = false;
49         };
50 
Create(const Options & options)51         static std::unique_ptr<Runtime> Create(const Options &options)
52         {
53             return std::make_unique<Runtime>();
54         }
SavePreloaded(std::unique_ptr<Runtime> && instance)55         static void SavePreloaded(std::unique_ptr<Runtime> &&instance) {}
56 
Runtime()57         Runtime() {};
~Runtime()58         ~Runtime() {};
59 
PreloadSystemModule(const std::string & moduleName)60         void PreloadSystemModule(const std::string &moduleName)
61         {
62             return;
63         }
64 
PreloadSystemClass(const char * className)65         void PreloadSystemClass(const char *className)
66         {
67             return;
68         }
69 
70         Runtime(const Runtime &) = delete;
71         Runtime(Runtime &&) = delete;
72         Runtime &operator=(const Runtime &) = delete;
73         Runtime &operator=(Runtime &&) = delete;
74     };
75 }  // namespace AbilityRuntime
76 namespace Ace {
77     class AceForwardCompatibility {
78     public:
AceForwardCompatibility()79         AceForwardCompatibility() {}
~AceForwardCompatibility()80         ~AceForwardCompatibility() {}
81 
GetAceLibName()82         static const char *GetAceLibName()
83         {
84             return "";
85         }
86 
ReclaimFileCache(int32_t pid)87         static void ReclaimFileCache(int32_t pid)
88         {
89             return;
90         }
91     };
92 }  // namespace Ace
93 
94 namespace AppExecFwk {
95     class MainThread {
96     public:
MainThread()97         MainThread() {}
~MainThread()98         ~MainThread() {}
99 
PreloadExtensionPlugin()100         static void PreloadExtensionPlugin() {}
Start()101         static void Start() {}
StartChild(std::map<std::string,int> & map)102         static void StartChild(std::map<std::string, int> &map) {}
103     };
104 }  // namespace AppExecFwk
105 
106 }  // namespace OHOS
107 #endif  // STUB_JS_RUNTIME_H