From 003ae1ad32572e0b7affc27c2716cea3ce7bc032 Mon Sep 17 00:00:00 2001 From: yanshuifeng Date: Wed, 2 Jun 2021 17:20:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20framewor?= =?UTF-8?q?ks/bridge/js=5Ffrontend/engine/common/js=5Fengine=20copy.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/common/js_engine copy.h | 151 ------------------ 1 file changed, 151 deletions(-) delete mode 100644 frameworks/bridge/js_frontend/engine/common/js_engine copy.h diff --git a/frameworks/bridge/js_frontend/engine/common/js_engine copy.h b/frameworks/bridge/js_frontend/engine/common/js_engine copy.h deleted file mode 100644 index c79f10c0c45..00000000000 --- a/frameworks/bridge/js_frontend/engine/common/js_engine copy.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_COMMON_JS_ENGINE_H -#define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_COMMON_JS_ENGINE_H - -#include - -#include "core/common/js_message_dispatcher.h" -#include "frameworks/bridge/js_frontend/frontend_delegate.h" -#include "frameworks/bridge/js_frontend/js_ace_page.h" - -namespace OHOS::Ace::Framework { -struct JsModule { - const std::string moduleName; - const std::string methods; -}; - -struct JsComponent { - const std::string componentName; - const std::string methods; -}; - -class JsEngineInstance { -public: - JsEngineInstance() = default; - virtual ~JsEngineInstance() = default; - - void InitModulesAndComponents(void* context); - virtual void FlushCommandBuffer(void* context, const std::string& command); - -private: - void RegisterSingleComponent(std::string& command, const std::string& componentName, const std::string& methods); - - void RegisterModules(std::string& command); - - void RegisterCommonComponents(std::string& command); - - void RegisterComponents(std::string& command); -}; - -class JsEngine : public AceType { - DECLARE_ACE_TYPE(JsEngine, AceType); - -public: - JsEngine() = default; - virtual ~JsEngine() = default; - - void RegisterSingleComponent(std::string& command, const std::string& componentName, const std::string& methods); - - void RegisterSingleModule(std::string& command, const std::string& moduleName, const std::string& methods); - - void RegisterModules(std::string& command); - - void RegisterComponents(std::string& command); - - // Initialize the JS engine. - virtual bool Initialize(const RefPtr& delegate) = 0; - - // Load script in JS engine, and execute in corresponding context. - virtual void LoadJs(const std::string& url, const RefPtr& page, bool isMainPage) = 0; - - // Update running page - virtual void UpdateRunningPage(const RefPtr& page) = 0; - - // Update staging page - virtual void UpdateStagingPage(const RefPtr& page) = 0; - - // Reset loading page - virtual void ResetStagingPage() = 0; - - virtual void SetJsMessageDispatcher(const RefPtr& dispatcher) = 0; - - // Fire AsyncEvent on JS - virtual void FireAsyncEvent(const std::string& eventId, const std::string& param) = 0; - - // Fire SyncEvent on JS - virtual void FireSyncEvent(const std::string& eventId, const std::string& param) = 0; - - // Timer callback on JS - virtual void TimerCallback(const std::string& callbackId, const std::string& delay, bool isInterval) = 0; - - // Destroy page instance on JS - virtual void DestroyPageInstance(int32_t pageId) = 0; - - // destroy application instance according packageName - virtual void DestroyApplication(const std::string& packageName) = 0; - - virtual void MediaQueryCallback(const std::string& callbackId, const std::string& args) = 0; - - virtual void RequestAnimationCallback(const std::string& callbackId, uint64_t timeStamp) = 0; - - virtual void JsCallback(const std::string& callbackId, const std::string& args) = 0; - - virtual void RunGarbageCollection() = 0; - - virtual RefPtr GetGroupJsBridge() = 0; - - bool IsDebugVersion() const - { - return isDebugVersion_; - } - - void SetDebugVersion(bool value) - { - isDebugVersion_ = value; - } - - bool NeedDebugBreakPoint() const - { - return needDebugBreakPoint_; - } - - void SetNeedDebugBreakPoint(bool value) - { - needDebugBreakPoint_ = value; - } - - const std::string& GetInstanceName() const - { - return instanceName_; - } - - void SetInstanceName(const std::string& name) - { - instanceName_ = name; - } - -private: - // weather the app has debugger.so. - bool isDebugVersion_ = false; - - // if debug, '-D' means need debug breakpoint, by default, do not enter breakpoint. - bool needDebugBreakPoint_ = false; - - std::string instanceName_; -}; -} // namespace OHOS::Ace::Framework -#endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_JS_FRONTEND_ENGINE_COMMON_JS_ENGINE_H