1 /* 2 * Copyright (c) 2021-2023 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 FOUNDATION_ACE_FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_FRONTEND_DELEGATE_DECLARATIVE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_FRONTEND_DELEGATE_DECLARATIVE_H 18 19 #include <future> 20 #include <mutex> 21 #include <unordered_map> 22 23 #include "base/memory/ace_type.h" 24 #include "base/memory/referenced.h" 25 #include "base/thread/cancelable_callback.h" 26 #include "base/utils/measure_util.h" 27 #include "bridge/declarative_frontend/ng/page_router_manager.h" 28 #include "core/common/js_message_dispatcher.h" 29 #include "core/components_ng/pattern/overlay/overlay_manager.h" 30 #include "core/components_ng/render/snapshot_param.h" 31 #include "core/pipeline/pipeline_context.h" 32 #include "frameworks/bridge/common/accessibility/accessibility_node_manager.h" 33 #include "frameworks/bridge/common/manifest/manifest_parser.h" 34 #include "frameworks/bridge/js_frontend/engine/common/group_js_bridge.h" 35 #include "frameworks/bridge/js_frontend/engine/common/js_engine.h" 36 #include "frameworks/bridge/js_frontend/frontend_delegate.h" 37 #include "frameworks/bridge/js_frontend/frontend_delegate_impl.h" 38 #include "frameworks/bridge/js_frontend/js_ace_page.h" 39 40 namespace OHOS::Ace::Framework { 41 42 using ExternalEventCallback = std::function<void(const std::string&, const uint32_t&, const bool&)>; 43 44 enum class RouterAction { 45 PUSH = 0, 46 REPLACE, 47 BACK, 48 CLEAR, 49 }; 50 51 struct RouterTask { 52 RouterAction action = RouterAction::PUSH; 53 PageTarget target = PageTarget(""); 54 std::string params; 55 std::function<void(const std::string&, int32_t)> errorCallback; 56 }; 57 58 class FrontendDelegateDeclarative : public FrontendDelegate { 59 DECLARE_ACE_TYPE(FrontendDelegateDeclarative, FrontendDelegate); 60 61 public: 62 FrontendDelegateDeclarative(const RefPtr<TaskExecutor>& taskExecutor, const LoadJsCallback& loadCallback, 63 const JsMessageDispatcherSetterCallback& transferCallback, const EventCallback& asyncEventCallback, 64 const EventCallback& syncEventCallback, const UpdatePageCallback& updatePageCallback, 65 const ResetStagingPageCallback& resetLoadingPageCallback, const DestroyPageCallback& destroyPageCallback, 66 const DestroyApplicationCallback& destroyApplicationCallback, 67 const UpdateApplicationStateCallback& updateApplicationStateCallback, const TimerCallback& timerCallback, 68 const MediaQueryCallback& mediaQueryCallback, const LayoutInspectorCallback& layoutInpsectorCallback, 69 const DrawInspectorCallback& drawInpsectorCallback, const RequestAnimationCallback& requestAnimationCallback, 70 const JsCallback& jsCallback, const OnWindowDisplayModeChangedCallBack& onWindowDisplayModeChangedCallBack, 71 const OnConfigurationUpdatedCallBack& onConfigurationUpdatedCallBack, 72 const OnSaveAbilityStateCallBack& onSaveAbilityStateCallBack, 73 const OnRestoreAbilityStateCallBack& onRestoreAbilityStateCallBack, const OnNewWantCallBack& onNewWantCallBack, 74 const OnMemoryLevelCallBack& onMemoryLevelCallBack, 75 const OnStartContinuationCallBack& onStartContinuationCallBack, 76 const OnCompleteContinuationCallBack& onCompleteContinuationCallBack, 77 const OnRemoteTerminatedCallBack& onRemoteTerminatedCallBack, const OnSaveDataCallBack& onSaveDataCallBack, 78 const OnRestoreDataCallBack& onRestoreDataCallBack, const ExternalEventCallback& externalEventCallback); 79 ~FrontendDelegateDeclarative() override; 80 81 void AttachPipelineContext(const RefPtr<PipelineBase>& context) override; 82 void AttachSubPipelineContext(const RefPtr<PipelineBase>& context); 83 84 // JSFrontend delegate functions. 85 UIContentErrorCode RunPage( 86 const std::string& url, const std::string& params, const std::string& profile, bool isNamedRouter = false); 87 void RunPage(const std::shared_ptr<std::vector<uint8_t>>& content, 88 const std::string& params, const std::string& profile); 89 void SetJsMessageDispatcher(const RefPtr<JsMessageDispatcher>& dispatcher) const; 90 void TransferComponentResponseData(int32_t callbackId, int32_t code, std::vector<uint8_t>&& data); 91 void TransferJsResponseData(int32_t callbackId, int32_t code, std::vector<uint8_t>&& data) const; 92 #if defined(PREVIEW) 93 void TransferJsResponseDataPreview(int32_t callbackId, int32_t code, ResponseData responseData) const; 94 #endif 95 void TransferJsPluginGetError(int32_t callbackId, int32_t errorCode, std::string&& errorMessage) const; 96 void TransferJsEventData(int32_t callbackId, int32_t code, std::vector<uint8_t>&& data) const; 97 void LoadPluginJsCode(std::string&& jsCode) const; 98 void LoadPluginJsByteCode(std::vector<uint8_t>&& jsCode, std::vector<int32_t>&& jsCodeLen) const; 99 void OnJSCallback(const std::string& callbackId, const std::string& data); 100 bool OnPageBackPress(); 101 void OnBackGround(); 102 void OnForeground(); 103 void OnConfigurationUpdated(const std::string& data); 104 void OnSaveAbilityState(std::string& data); 105 void OnRestoreAbilityState(const std::string& data); 106 void OnNewWant(const std::string& data); 107 bool OnStartContinuation(); 108 void OnCompleteContinuation(int32_t code); 109 void OnMemoryLevel(int32_t level); 110 void OnSaveData(std::string& data); 111 void GetPluginsUsed(std::string& data); 112 bool OnRestoreData(const std::string& data); 113 void OnRemoteTerminated(); 114 void OnNewRequest(const std::string& data); 115 void SetColorMode(ColorMode colorMode); 116 void CallPopPage(); 117 void OnApplicationDestroy(const std::string& packageName); 118 void UpdateApplicationState(const std::string& packageName, Frontend::State state); 119 void OnWindowDisplayModeChanged(bool isShownInMultiWindow, const std::string& data); 120 void NotifyAppStorage( 121 const WeakPtr<Framework::JsEngine>& jsEngineWeak, const std::string& key, const std::string& value); 122 123 // restore 124 std::pair<RouterRecoverRecord, UIContentErrorCode> RestoreRouterStack( 125 const std::string& contentInfo, ContentInfoType type) override; 126 std::string GetContentInfo(ContentInfoType type) override; 127 128 // Accessibility delegate functions. GetJSAccessibilityManager() const129 RefPtr<Framework::AccessibilityNodeManager> GetJSAccessibilityManager() const 130 { 131 return jsAccessibilityManager_; 132 } 133 void FireAccessibilityEvent(const AccessibilityEvent& accessibilityEvent); 134 void InitializeAccessibilityCallback(); 135 136 void OnMediaQueryUpdate(bool isSynchronous = false) override; 137 void OnSurfaceChanged(); 138 void OnLayoutCompleted(const std::string& componentId); 139 void OnDrawCompleted(const std::string& componentId); 140 // JSEventHandler delegate functions. 141 void FireAsyncEvent(const std::string& eventId, const std::string& param, const std::string& jsonArgs); 142 bool FireSyncEvent(const std::string& eventId, const std::string& param, const std::string& jsonArgs); 143 void FireSyncEvent( 144 const std::string& eventId, const std::string& param, const std::string& jsonArgs, std::string& result); 145 void FireExternalEvent(const std::string& eventId, const std::string& componentId, uint32_t nodeId, bool isDestroy); 146 147 // FrontendDelegate overrides. 148 void Push(const PageTarget& target, const std::string& params, 149 const std::function<void(const std::string&, int32_t)>& errorCallback = nullptr); 150 void Replace(const PageTarget& target, const std::string& params, 151 const std::function<void(const std::string&, int32_t)>& errorCallback = nullptr); 152 void BackWithTarget(const PageTarget& target, const std::string& params); 153 154 void Push(const std::string& uri, const std::string& params) override; 155 void PushWithMode(const std::string& uri, const std::string& params, uint32_t routerMode) override; 156 void PushWithCallback(const std::string& uri, const std::string& params, bool recoverable, 157 const std::function<void(const std::string&, int32_t)>& errorCallback, uint32_t routerMode = 0) override; 158 void PushNamedRoute(const std::string& uri, const std::string& params, bool recoverable, 159 const std::function<void(const std::string&, int32_t)>& errorCallback, uint32_t routerMode = 0) override; 160 void Replace(const std::string& uri, const std::string& params) override; 161 void ReplaceWithMode(const std::string& uri, const std::string& params, uint32_t routerMode) override; 162 void ReplaceWithCallback(const std::string& uri, const std::string& params, bool recoverable, 163 const std::function<void(const std::string&, int32_t)>& errorCallback, uint32_t routerMode = 0) override; 164 void ReplaceNamedRoute(const std::string& uri, const std::string& params, bool recoverable, 165 const std::function<void(const std::string&, int32_t)>& errorCallback, uint32_t routerMode = 0) override; 166 void Back(const std::string& uri, const std::string& params) override; 167 void BackToIndex(int32_t index, const std::string& params) override; 168 void Clear() override; 169 int32_t GetStackSize() const override; 170 int32_t GetCurrentPageIndex() const override; 171 void GetState(int32_t& index, std::string& name, std::string& path) override; 172 void GetRouterStateByIndex(int32_t& index, std::string& name, std::string& path, std::string& params) override; 173 bool IsUnrestoreByIndex(int32_t index); 174 void GetRouterStateByUrl(std::string& url, std::vector<StateInfo>& stateArray) override; 175 std::string GetParams() override; 176 int32_t GetIndexByUrl(const std::string& url) override; 177 178 void PostponePageTransition() override; 179 void LaunchPageTransition() override; 180 size_t GetComponentsCount() override; 181 void TriggerPageUpdate(int32_t pageId, bool directExecute = false) override; 182 183 void PostJsTask(std::function<void()>&& task, const std::string& name) override; 184 185 const std::string& GetAppID() const override; 186 const std::string& GetAppName() const override; 187 const std::string& GetVersionName() const override; 188 int32_t GetVersionCode() const override; GetWindowConfig()189 WindowConfig& GetWindowConfig() 190 { 191 return manifestParser_->GetWindowConfig(); 192 } 193 194 double MeasureText(MeasureContext context) override; 195 Size MeasureTextSize(MeasureContext context) override; 196 197 void ShowToast(const NG::ToastInfo& toastInfo, std::function<void(int32_t)>&& callback = nullptr) override; 198 void CloseToast(const int32_t toastId, std::function<void(int32_t)>&& callback = nullptr) override; 199 void SetToastStopListenerCallback(std::function<void()>&& stopCallback) override; 200 void ShowDialog(const std::string& title, const std::string& message, const std::vector<ButtonInfo>& buttons, 201 bool autoCancel, std::function<void(int32_t, int32_t)>&& callback, 202 const std::set<std::string>& callbacks) override; 203 void ShowDialog(const std::string& title, const std::string& message, const std::vector<ButtonInfo>& buttons, 204 bool autoCancel, std::function<void(int32_t, int32_t)>&& callback, 205 const std::set<std::string>& callbacks, std::function<void(bool)>&& onStatusChanged) override; 206 void ShowDialog(const PromptDialogAttr &dialogAttr, const std::vector<ButtonInfo> &buttons, 207 std::function<void(int32_t, int32_t)> &&callback, const std::set<std::string> &callbacks) override; 208 void ShowDialog(const PromptDialogAttr &dialogAttr, const std::vector<ButtonInfo> &buttons, 209 std::function<void(int32_t, int32_t)> &&callback, const std::set<std::string> &callbacks, 210 std::function<void(bool)>&& onStatusChanged) override; 211 void ShowDialogInner(DialogProperties& dialogProperties, std::function<void(int32_t, int32_t)>&& callback, 212 const std::set<std::string>& callbacks); 213 void RemoveCustomDialog(int32_t instanceId) override; 214 void OpenCustomDialog(const PromptDialogAttr &dialogAttr, std::function<void(int32_t)> &&callback) override; 215 void CloseCustomDialog(const int32_t dialogId) override; 216 void CloseCustomDialog(const WeakPtr<NG::UINode>& node, std::function<void(int32_t)> &&callback) override; 217 void UpdateCustomDialog(const WeakPtr<NG::UINode>& node, const PromptDialogAttr &dialogAttr, 218 std::function<void(int32_t)> &&callback) override; 219 220 RefPtr<NG::ChainedTransitionEffect> GetTransitionEffect(void* value) override; 221 222 void EnableAlertBeforeBackPage(const std::string& message, std::function<void(int32_t)>&& callback) override; 223 224 void DisableAlertBeforeBackPage() override; 225 226 void ShowActionMenu(const std::string& title, const std::vector<ButtonInfo>& button, 227 std::function<void(int32_t, int32_t)>&& callback) override; 228 void ShowActionMenu(const std::string& title, const std::vector<ButtonInfo>& button, 229 std::function<void(int32_t, int32_t)>&& callback, std::function<void(bool)>&& onStatusChanged) override; 230 void ShowActionMenu(const PromptDialogAttr& dialogAttr, const std::vector<ButtonInfo>& buttons, 231 std::function<void(int32_t, int32_t)>&& callback) override; 232 void ShowActionMenuInner(DialogProperties& dialogProperties, const std::vector<ButtonInfo>& button, 233 std::function<void(int32_t, int32_t)>&& callback); 234 void ShowActionMenuInnerNG(DialogProperties& dialogProperties, const std::vector<ButtonInfo>& button, 235 std::function<void(int32_t, int32_t)>&& callback); 236 237 Rect GetBoundingRectData(NodeId nodeId) override; 238 239 std::string GetInspector(NodeId nodeId) override; 240 241 void PushJsCallbackToRenderNode(NodeId id, double ratio, std::function<void(bool, double)>&& callback) override; 242 // For async event. 243 void SetCallBackResult(const std::string& callBackId, const std::string& result) override; 244 245 void WaitTimer(const std::string& callbackId, const std::string& delay, bool isInterval, bool isFirst) override; 246 void ClearTimer(const std::string& callbackId) override; 247 248 void PostSyncTaskToPage(std::function<void()>&& task, const std::string& name) override; 249 void AddTaskObserver(std::function<void()>&& task) override; 250 void RemoveTaskObserver() override; 251 252 bool GetAssetContent(const std::string& url, std::string& content) override; 253 bool GetAssetContent(const std::string& url, std::vector<uint8_t>& content) override; 254 std::string GetAssetPath(const std::string& url) override; 255 256 // i18n 257 void GetI18nData(std::unique_ptr<JsonValue>& json) override; 258 259 void GetResourceConfiguration(std::unique_ptr<JsonValue>& json) override; 260 261 void GetConfigurationCommon(const std::string& filePath, std::unique_ptr<JsonValue>& data) override; 262 263 int32_t GetMinPlatformVersion() override; 264 265 void LoadResourceConfiguration(std::map<std::string, std::string>& mediaResourceFileMap, 266 std::unique_ptr<JsonValue>& currentResourceData) override; 267 268 void ChangeLocale(const std::string& language, const std::string& countryOrRegion) override; 269 270 void RegisterFont(const std::string& familyName, const std::string& familySrc, const std::string& bundleName = "", 271 const std::string& moduleName = "") override; 272 273 void GetSystemFontList(std::vector<std::string>& fontList) override; 274 275 bool GetSystemFont(const std::string& fontName, FontInfo& fontInfo) override; 276 277 void GetUIFontConfig(FontConfigJsonInfo& fontConfigJsonInfo) override; 278 279 void HandleImage(const std::string& src, std::function<void(bool, int32_t, int32_t)>&& callback) override; 280 281 void GetSnapshot(const std::string& componentId, 282 std::function<void(std::shared_ptr<Media::PixelMap>, int32_t, std::function<void()>)>&& callback, 283 const NG::SnapshotOptions& options) override; 284 void CreateSnapshot(std::function<void()>&& customBuilder, 285 std::function<void(std::shared_ptr<Media::PixelMap>, int32_t, std::function<void()>)>&& callback, 286 bool enableInspector, const NG::SnapshotParam& param) override; 287 288 std::pair<int32_t, std::shared_ptr<Media::PixelMap>> GetSyncSnapshot(const std::string& componentId, 289 const NG::SnapshotOptions& options) override; 290 291 void AddFrameNodeToOverlay( 292 const RefPtr<NG::FrameNode>& node, std::optional<int32_t> index = std::nullopt) override; 293 void RemoveFrameNodeOnOverlay(const RefPtr<NG::FrameNode>& node) override; 294 void ShowNodeOnOverlay(const RefPtr<NG::FrameNode>& node) override; 295 void HideNodeOnOverlay(const RefPtr<NG::FrameNode>& node) override; 296 void ShowAllNodesOnOverlay() override; 297 void HideAllNodesOnOverlay() override; 298 299 void RequestAnimationFrame(const std::string& callbackId) override; 300 301 void CancelAnimationFrame(const std::string& callbackId) override; 302 303 SingleTaskExecutor GetAnimationJsTask() override; 304 305 SingleTaskExecutor GetUiTask() override; 306 307 const RefPtr<MediaQueryInfo>& GetMediaQueryInfoInstance() override 308 { 309 return mediaQueryInfo_; 310 } 311 312 const RefPtr<GroupJsBridge>& GetGroupJsBridge() override 313 { 314 return groupJsBridge_; 315 } 316 317 #if defined(PREVIEW) SetPagePath(const std::string& pagePath)318 void SetPagePath(const std::string& pagePath) 319 { 320 if (manifestParser_) { 321 manifestParser_->SetPagePath(pagePath); 322 } 323 } 324 #endif 325 326 RefPtr<PipelineBase> GetPipelineContext() override; 327 SetGroupJsBridge(const RefPtr<GroupJsBridge>& groupJsBridge)328 void SetGroupJsBridge(const RefPtr<GroupJsBridge>& groupJsBridge) 329 { 330 groupJsBridge_ = groupJsBridge; 331 } 332 333 RefPtr<JsAcePage> GetPage(int32_t pageId) const override; 334 335 void RebuildAllPages(); 336 337 std::string GetCurrentPageUrl(); 338 339 // Get the currently running JS page information in NG structure. 340 RefPtr<RevSourceMap> GetCurrentPageSourceMap(); 341 342 // Get the currently running JS page information in NG structure. 343 RefPtr<RevSourceMap> GetFaAppSourceMap(); 344 345 void GetStageSourceMap( 346 std::unordered_map<std::string, RefPtr<Framework::RevSourceMap>>& sourceMap); 347 348 #if defined(PREVIEW) 349 void SetIsComponentPreview(NG::IsComponentPreviewCallback&& callback); 350 #endif 351 SetPageRouterManager(const RefPtr<NG::PageRouterManager>& routerMgr)352 void SetPageRouterManager(const RefPtr<NG::PageRouterManager>& routerMgr) 353 { 354 pageRouterManager_ = routerMgr; 355 } GetPageRouterManager() const356 const RefPtr<NG::PageRouterManager>& GetPageRouterManager() const 357 { 358 return pageRouterManager_; 359 } 360 GetTaskExecutor() const361 const RefPtr<TaskExecutor>& GetTaskExecutor() const 362 { 363 return taskExecutor_; 364 } 365 GetManifestParser() const366 const RefPtr<Framework::ManifestParser>& GetManifestParser() const 367 { 368 return manifestParser_; 369 } 370 371 protected: 372 bool isCardDelegate_ = false; 373 374 private: 375 int32_t GenerateNextPageId(); 376 void RecyclePageId(int32_t pageId); 377 378 UIContentErrorCode LoadPage( 379 int32_t pageId, const PageTarget& target, bool isMainPage, const std::string& params, bool isRestore = false); 380 void OnPageReady(const RefPtr<Framework::JsAcePage>& page, const std::string& url, bool isMainPage, bool isRestore); 381 void FlushPageCommand( 382 const RefPtr<Framework::JsAcePage>& page, const std::string& url, bool isMainPage, bool isRestore); 383 void AddPageLocked(const RefPtr<JsAcePage>& page); 384 void OnPrePageChange(const RefPtr<JsAcePage>& page); 385 void SetCurrentPage(int32_t pageId); 386 387 void OnPushPageSuccess(const RefPtr<JsAcePage>& page, const std::string& url); 388 void OnPopToPageSuccess(const std::string& url); 389 void PopToPage(const std::string& url); 390 int32_t OnPopPageSuccess(); 391 void PopPage(); 392 void RestorePopPage(const RefPtr<JsAcePage>& page, const std::string& url); 393 394 void PushPageTransitionListener(const TransitionEvent& event, const RefPtr<JsAcePage>& page); 395 396 void PopPageTransitionListener(const TransitionEvent& event, int32_t destroyPageId); 397 398 void PopToPageTransitionListener(const TransitionEvent& event, const std::string& url, int32_t pageId); 399 400 void RestorePageTransitionListener( 401 const TransitionEvent& event, const std::string& url, const RefPtr<JsAcePage>& page); 402 403 int32_t OnClearInvisiblePagesSuccess(); 404 void ClearInvisiblePages(); 405 406 void OnReplacePageSuccess(const RefPtr<JsAcePage>& page, const std::string& url); 407 void ReplacePage(const RefPtr<JsAcePage>& page, const std::string& url); 408 void LoadReplacePage(int32_t pageId, const PageTarget& url, const std::string& params); 409 410 void ReplacePageInSubStage(const RefPtr<JsAcePage>& page, const std::string& url); 411 std::optional<int32_t> GetEffectiveContainerId() const; 412 413 uint64_t GetSystemRealTime(); 414 415 // Page lifecycle 416 void OnPageShow(); 417 void OnPageHide(); 418 void OnPageDestroy(int32_t pageId); 419 420 int32_t GetRunningPageId() const; 421 std::string GetRunningPageUrl() const; 422 int32_t GetPageIdByUrl(const std::string& url, bool& isRestore); GetPageIdByUrl(const std::string& url)423 int32_t GetPageIdByUrl(const std::string& url) 424 { 425 bool tmp = false; 426 return GetPageIdByUrl(url, tmp); 427 } 428 429 void ResetStagingPage(); 430 void FlushAnimationTasks(); 431 432 void StartPush(const PageTarget& target, const std::string& params, 433 const std::function<void(const std::string&, int32_t)>& errorCallback); 434 void StartReplace(const PageTarget& target, const std::string& params, 435 const std::function<void(const std::string&, int32_t)>& errorCallback); 436 void StartBack(const PageTarget& target, const std::string& params); 437 void BackCheckAlert(const PageTarget& target, const std::string& params); 438 void ProcessRouterTask(); 439 void AddRouterTask(const RouterTask& task); 440 bool IsNavigationStage(const PageTarget& target); 441 void RecycleSinglePage(); 442 void ClearAlertCallback(PageInfo pageInfo); 443 bool CheckIndexValid(int32_t index) const; 444 445 DialogProperties ParsePropertiesFromAttr(const PromptDialogAttr &dialogAttr); 446 447 std::unique_ptr<JsonValue> GetNavigationJsonInfo(); 448 449 std::atomic<uint64_t> pageIdPool_ = 0; 450 int32_t callbackCnt_ = 0; 451 int32_t pageId_ = -1; 452 bool isRouteStackFull_ = false; 453 bool isStagingPageExist_ = false; 454 int32_t singlePageId_ = -1; 455 std::string mainPagePath_; 456 PageTarget backUri_ = PageTarget(""); 457 std::string backParam_; 458 std::vector<PageInfo> pageRouteStack_; 459 std::unordered_map<int32_t, RefPtr<JsAcePage>> pageMap_; 460 std::unordered_map<int32_t, std::string> pageParamMap_; 461 std::unordered_map<int32_t, std::string> jsCallBackResult_; 462 463 LoadJsCallback loadJs_; 464 ExternalEventCallback externalEvent_; 465 JsMessageDispatcherSetterCallback dispatcherCallback_; 466 EventCallback asyncEvent_; 467 EventCallback syncEvent_; 468 UpdatePageCallback updatePage_; 469 ResetStagingPageCallback resetStagingPage_; 470 DestroyPageCallback destroyPage_; 471 DestroyApplicationCallback destroyApplication_; 472 UpdateApplicationStateCallback updateApplicationState_; 473 TimerCallback timer_; 474 std::unordered_map<std::string, CancelableCallback<void()>> timeoutTaskMap_; 475 MediaQueryCallback mediaQueryCallback_; 476 LayoutInspectorCallback layoutInspectorCallback_; 477 DrawInspectorCallback drawInspectorCallback_; 478 RequestAnimationCallback requestAnimationCallback_; 479 JsCallback jsCallback_; 480 OnWindowDisplayModeChangedCallBack onWindowDisplayModeChanged_; 481 OnConfigurationUpdatedCallBack onConfigurationUpdated_; 482 OnSaveAbilityStateCallBack onSaveAbilityState_; 483 OnRestoreAbilityStateCallBack onRestoreAbilityState_; 484 OnNewWantCallBack onNewWant_; 485 OnMemoryLevelCallBack onMemoryLevel_; 486 OnStartContinuationCallBack onStartContinuationCallBack_; 487 OnCompleteContinuationCallBack onCompleteContinuationCallBack_; 488 OnRemoteTerminatedCallBack onRemoteTerminatedCallBack_; 489 OnSaveDataCallBack onSaveDataCallBack_; 490 OnRestoreDataCallBack onRestoreDataCallBack_; 491 RefPtr<Framework::ManifestParser> manifestParser_; 492 RefPtr<Framework::AccessibilityNodeManager> jsAccessibilityManager_; 493 RefPtr<MediaQueryInfo> mediaQueryInfo_; 494 RefPtr<GroupJsBridge> groupJsBridge_; 495 496 RefPtr<TaskExecutor> taskExecutor_; 497 498 PipelineContextHolder pipelineContextHolder_; 499 500 BaseId::IdType pageTransitionListenerId_ = 0L; 501 std::queue<std::string> animationFrameTaskIds_; 502 std::unordered_map<std::string, CancelableCallback<void()>> animationFrameTaskMap_; 503 504 mutable std::mutex mutex_; 505 506 std::queue<RouterTask> routerQueue_; 507 mutable std::mutex routerQueueMutex_; 508 509 RefPtr<RevSourceMap> appSourceMap_; 510 RefPtr<NG::PageRouterManager> pageRouterManager_; 511 }; 512 513 } // namespace OHOS::Ace::Framework 514 515 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_FRONTEND_DELEGATE_DECLARATIVE_H 516