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 }; 31 32 struct Options { 33 Language lang = Language::JS; 34 std::string bundleName; 35 std::string moduleName; 36 bool loadAce = true; 37 bool preload = false; 38 bool isBundle = true; 39 bool isDebugVersion = false; 40 bool isJsFramework = false; 41 bool isStageModel = true; 42 bool isTestFramework = false; 43 int32_t uid = -1; 44 // ArkTsCard start 45 bool isUnique = false; 46 }; 47 Create(const Options & options)48 static std::unique_ptr<Runtime> Create(const Options &options) 49 { 50 return std::make_unique<Runtime>(); 51 } SavePreloaded(std::unique_ptr<Runtime> && instance)52 static void SavePreloaded(std::unique_ptr<Runtime> &&instance) {} 53 Runtime()54 Runtime() {}; ~Runtime()55 ~Runtime() {}; 56 PreloadSystemModule(const std::string & moduleName)57 void PreloadSystemModule(const std::string &moduleName) 58 { 59 return; 60 } 61 62 Runtime(const Runtime &) = delete; 63 Runtime(Runtime &&) = delete; 64 Runtime &operator=(const Runtime &) = delete; 65 Runtime &operator=(Runtime &&) = delete; 66 }; 67 } // namespace AbilityRuntime 68 namespace Ace { 69 class AceForwardCompatibility { 70 public: AceForwardCompatibility()71 AceForwardCompatibility() {} ~AceForwardCompatibility()72 ~AceForwardCompatibility() {} 73 GetAceLibName()74 static const char *GetAceLibName() 75 { 76 return ""; 77 } 78 ReclaimFileCache(int32_t pid)79 static void ReclaimFileCache(int32_t pid) 80 { 81 return; 82 } 83 }; 84 } // namespace Ace 85 86 namespace AppExecFwk { 87 class MainThread { 88 public: MainThread()89 MainThread() {} ~MainThread()90 ~MainThread() {} 91 PreloadExtensionPlugin()92 static void PreloadExtensionPlugin() {} Start()93 static void Start() {} StartChild(std::map<std::string,int> & map)94 static void StartChild(std::map<std::string, int> &map) {} 95 }; 96 } // namespace AppExecFwk 97 98 } // namespace OHOS 99 #endif // STUB_JS_RUNTIME_H