1 /* 2 * Copyright (c) 2022-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_CORE_COMPONENTS_NG_BASE_VIEW_STACK_PROCESSOR_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_BASE_VIEW_STACK_PROCESSOR_H 18 19 #include <memory> 20 #include <stack> 21 #include <unordered_map> 22 #include <vector> 23 24 #include "base/memory/referenced.h" 25 #include "core/common/container.h" 26 #include "core/common/container_scope.h" 27 #include "core/components/common/properties/animation_option.h" 28 #include "core/components/common/properties/state_attributes.h" 29 #include "core/components_ng/base/frame_node.h" 30 #include "core/components_ng/base/ui_node.h" 31 #include "core/components_ng/event/state_style_manager.h" 32 #include "core/components_ng/layout/layout_property.h" 33 #include "core/gestures/gesture_processor.h" 34 #include "core/pipeline/base/render_context.h" 35 36 #define ACE_UPDATE_LAYOUT_PROPERTY(target, name, value) \ 37 do { \ 38 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \ 39 ACE_UPDATE_NODE_LAYOUT_PROPERTY(target, name, value, frameNode); \ 40 } while (false) 41 #define ACE_UPDATE_NODE_LAYOUT_PROPERTY(target, name, value, frameNode) \ 42 do { \ 43 CHECK_NULL_VOID(frameNode); \ 44 auto cast##target = (frameNode)->GetLayoutPropertyPtr<target>(); \ 45 if (cast##target) { \ 46 cast##target->Update##name(value); \ 47 } \ 48 } while (false) 49 50 #define ACE_GET_NODE_LAYOUT_PROPERTY(target, name, value, frameNode) \ 51 do { \ 52 auto cast##target = frameNode->GetLayoutPropertyPtr<target>(); \ 53 if (cast##target) { \ 54 value = cast##target->Get##name##Value(); \ 55 } \ 56 } while (false) 57 58 #define ACE_GET_NODE_LAYOUT_PROPERTY_WITH_DEFAULT_VALUE(target, name, value, frameNode, defaultValue) \ 59 do { \ 60 auto cast##target = frameNode->GetLayoutPropertyPtr<target>(); \ 61 if (cast##target) { \ 62 value = cast##target->Get##name##Value(defaultValue); \ 63 } \ 64 } while (false) 65 66 #define ACE_UPDATE_PAINT_PROPERTY(target, name, value) \ 67 do { \ 68 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \ 69 ACE_UPDATE_NODE_PAINT_PROPERTY(target, name, value, frameNode); \ 70 } while (false) 71 #define ACE_UPDATE_NODE_PAINT_PROPERTY(target, name, value, frameNode) \ 72 do { \ 73 CHECK_NULL_VOID(frameNode); \ 74 auto cast##target = (frameNode)->GetPaintPropertyPtr<target>(); \ 75 if (cast##target) { \ 76 cast##target->Update##name(value); \ 77 } \ 78 } while (false) 79 80 #define ACE_GET_NODE_PAINT_PROPERTY(target, name, value, frameNode) \ 81 do { \ 82 auto cast##target = frameNode->GetPaintPropertyPtr<target>(); \ 83 if (cast##target) { \ 84 value = cast##target->Get##name##Value(); \ 85 } \ 86 } while (false) 87 88 #define ACE_GET_NODE_PAINT_PROPERTY_WITH_DEFAULT_VALUE(target, name, value, frameNode, defaultValue) \ 89 do { \ 90 auto cast##target = frameNode->GetPaintPropertyPtr<target>(); \ 91 if (cast##target) { \ 92 value = cast##target->Get##name##Value(defaultValue); \ 93 } \ 94 } while (false) 95 96 #define ACE_UPDATE_RENDER_CONTEXT(name, value) \ 97 do { \ 98 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \ 99 ACE_UPDATE_NODE_RENDER_CONTEXT(name, value, frameNode); \ 100 } while (false) 101 #define ACE_UPDATE_NODE_RENDER_CONTEXT(name, value, frameNode) \ 102 do { \ 103 CHECK_NULL_VOID(frameNode); \ 104 const auto& target = (frameNode)->GetRenderContext(); \ 105 if (target) { \ 106 target->Update##name(value); \ 107 } \ 108 } while (false) 109 110 #define ACE_RESET_LAYOUT_PROPERTY(target, name) \ 111 do { \ 112 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \ 113 ACE_RESET_NODE_LAYOUT_PROPERTY(target, name, frameNode); \ 114 } while (false) 115 #define ACE_RESET_NODE_LAYOUT_PROPERTY(target, name, frameNode) \ 116 do { \ 117 CHECK_NULL_VOID(frameNode); \ 118 auto cast##target = frameNode->GetLayoutPropertyPtr<target>(); \ 119 CHECK_NULL_VOID(cast##target); \ 120 cast##target->Reset##name(); \ 121 } while (false) 122 123 #define ACE_RESET_LAYOUT_PROPERTY_WITH_FLAG(target, name, changeFlag) \ 124 do { \ 125 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \ 126 ACE_RESET_NODE_LAYOUT_PROPERTY_WITH_FLAG(target, name, changeFlag, frameNode); \ 127 } while (false) 128 #define ACE_RESET_NODE_LAYOUT_PROPERTY_WITH_FLAG(target, name, changeFlag, frameNode) \ 129 do { \ 130 CHECK_NULL_VOID(frameNode); \ 131 auto cast##target = frameNode->GetLayoutPropertyPtr<target>(); \ 132 CHECK_NULL_VOID(cast##target); \ 133 if (cast##target->Has##name()) { \ 134 cast##target->Reset##name(); \ 135 cast##target->UpdatePropertyChangeFlag(changeFlag); \ 136 } \ 137 } while (false) 138 139 #define ACE_RESET_PAINT_PROPERTY(target, name) \ 140 do { \ 141 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \ 142 ACE_RESET_NODE_PAINT_PROPERTY(target, name, frameNode); \ 143 } while (false) 144 #define ACE_RESET_NODE_PAINT_PROPERTY(target, name, frameNode) \ 145 do { \ 146 CHECK_NULL_VOID(frameNode); \ 147 auto cast##target = frameNode->GetPaintPropertyPtr<target>(); \ 148 CHECK_NULL_VOID(cast##target); \ 149 cast##target->Reset##name(); \ 150 } while (false) 151 152 #define ACE_RESET_PAINT_PROPERTY_WITH_FLAG(target, name, changeFlag) \ 153 do { \ 154 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \ 155 ACE_RESET_NODE_PAINT_PROPERTY_WITH_FLAG(target, name, changeFlag, frameNode); \ 156 } while (false) 157 #define ACE_RESET_NODE_PAINT_PROPERTY_WITH_FLAG(target, name, changeFlag, frameNode) \ 158 do { \ 159 CHECK_NULL_VOID(frameNode); \ 160 auto cast##target = frameNode->GetPaintPropertyPtr<target>(); \ 161 CHECK_NULL_VOID(cast##target); \ 162 cast##target->Reset##name(); \ 163 cast##target->UpdatePropertyChangeFlag(changeFlag); \ 164 } while (false) 165 166 #define ACE_RESET_RENDER_CONTEXT(target, name) \ 167 do { \ 168 auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \ 169 ACE_RESET_NODE_RENDER_CONTEXT(target, name, frameNode); \ 170 } while (false) 171 #define ACE_RESET_NODE_RENDER_CONTEXT(target, name, frameNode) \ 172 do { \ 173 CHECK_NULL_VOID(frameNode); \ 174 const auto& cast##target = (frameNode)->GetRenderContext(); \ 175 CHECK_NULL_VOID(cast##target); \ 176 cast##target->Reset##name(); \ 177 } while (false) 178 179 namespace OHOS::Ace::NG { 180 using PrebuildFunc = std::function<void()>; 181 182 enum class PrebuildCompCmdType { 183 FRONT = 0, 184 BACK, 185 }; 186 187 struct PrebuildCompCmd { 188 PrebuildCompCmdType commandType; 189 const char* commandName = ""; 190 PrebuildFunc prebuildFunc; 191 PrebuildCompCmdPrebuildCompCmd192 PrebuildCompCmd(PrebuildCompCmdType commandType) : commandType(commandType) {} PrebuildCompCmdPrebuildCompCmd193 PrebuildCompCmd(PrebuildCompCmdType commandType, const char* commandName, 194 PrebuildFunc& prebuildFunc) : commandType(commandType), commandName(commandName), prebuildFunc(prebuildFunc) {} 195 }; 196 197 class ACE_EXPORT ViewStackProcessor final { 198 public: 199 friend class ScopedViewStackProcessor; 200 201 ACE_FORCE_EXPORT static ViewStackProcessor* GetInstance(); 202 ~ViewStackProcessor() = default; 203 204 template<typename Pattern> GetMainFrameNodePattern()205 RefPtr<Pattern> GetMainFrameNodePattern() const 206 { 207 auto frameNode = GetMainFrameNode(); 208 if (!frameNode) { 209 return nullptr; 210 } 211 return AceType::DynamicCast<Pattern>(frameNode->GetPattern()); 212 } 213 214 template<typename Pattern> GetMainFrameNodePattern(FrameNode * frameNode)215 RefPtr<Pattern> GetMainFrameNodePattern(FrameNode* frameNode) const 216 { 217 if (!frameNode) { 218 return nullptr; 219 } 220 return AceType::DynamicCast<Pattern>(frameNode->GetPattern()); 221 } 222 223 template<typename EventHubType> GetMainFrameNodeEventHub()224 RefPtr<EventHubType> GetMainFrameNodeEventHub() const 225 { 226 auto frameNode = GetMainFrameNode(); 227 if (!frameNode) { 228 return nullptr; 229 } 230 return frameNode->GetEventHub<EventHubType>(); 231 } 232 GetMainFrameNodeGestureEventHub()233 RefPtr<GestureEventHub> GetMainFrameNodeGestureEventHub() const 234 { 235 auto frameNode = GetMainFrameNode(); 236 if (!frameNode) { 237 return nullptr; 238 } 239 return frameNode->GetOrCreateGestureEventHub(); 240 } 241 GetMainFrameNodeInputEventHub()242 RefPtr<InputEventHub> GetMainFrameNodeInputEventHub() const 243 { 244 auto frameNode = GetMainFrameNode(); 245 if (!frameNode) { 246 return nullptr; 247 } 248 return frameNode->GetOrCreateInputEventHub(); 249 } 250 GetOrCreateMainFrameNodeFocusHub()251 RefPtr<FocusHub> GetOrCreateMainFrameNodeFocusHub() const 252 { 253 auto frameNode = GetMainFrameNode(); 254 if (!frameNode) { 255 return nullptr; 256 } 257 return frameNode->GetOrCreateFocusHub(); 258 } 259 GetMainFrameNodeFocusHub()260 RefPtr<FocusHub> GetMainFrameNodeFocusHub() const 261 { 262 auto frameNode = GetMainFrameNode(); 263 if (!frameNode) { 264 return nullptr; 265 } 266 return frameNode->GetFocusHub(); 267 } 268 269 ACE_FORCE_EXPORT FrameNode* GetMainFrameNode() const; 270 271 // Get main component include composed component created by js view. 272 const RefPtr<UINode>& GetMainElementNode() const; 273 void ApplyParentThemeScopeId(const RefPtr<UINode>& element); 274 // create wrappingComponentsMap and the component to map and then Push 275 // the map to the render component stack. 276 ACE_FORCE_EXPORT void Push(const RefPtr<UINode>& element, bool isCustomView = false); 277 278 // Wrap the components map for the stack top and then pop the stack. 279 // Add the wrapped component has child of the new stack top's main component. 280 void Pop(); 281 282 // pop the last container 283 ACE_FORCE_EXPORT void PopContainer(); 284 285 // End of Render function, create component tree and flush modify task. 286 ACE_FORCE_EXPORT RefPtr<UINode> Finish(); 287 288 // Set key to be used for next node on the stack 289 void PushKey(const std::string& key); 290 291 // Returns a key for the node if it has been pushed to the stack. Default is "" 292 std::string GetKey(); 293 294 // Takes care of the viewId wrt to foreach 295 std::string ProcessViewId(const std::string& viewId); 296 297 // Clear the key pushed to the stack 298 void PopKey(); 299 300 // Check whether the current node is in the corresponding polymorphic style state. 301 // When the polymorphic style is not set on the front end, it returns true regardless of the current node state; 302 // When the polymorphic style is set on the front end, true is returned only if the current node state is the same 303 // as the polymorphic style. 304 bool IsCurrentVisualStateProcess(); 305 306 void SetVisualState(VisualState state); 307 GetVisualState()308 std::optional<UIState> GetVisualState() const 309 { 310 return visualState_; 311 } 312 IsVisualStateSet()313 bool IsVisualStateSet() 314 { 315 return visualState_.has_value(); 316 } 317 ClearVisualState()318 void ClearVisualState() 319 { 320 visualState_.reset(); 321 } 322 ClearStack()323 void ClearStack() 324 { 325 auto emptyStack = std::stack<RefPtr<UINode>>(); 326 elementsStack_.swap(emptyStack); 327 } 328 GetOrCreateGestureProcessor()329 RefPtr<GestureProcessor> GetOrCreateGestureProcessor() 330 { 331 if (!gestureStack_) { 332 gestureStack_ = AceType::MakeRefPtr<GestureProcessor>(); 333 } 334 return gestureStack_; 335 } 336 ResetGestureProcessor()337 void ResetGestureProcessor() 338 { 339 return gestureStack_.Reset(); 340 } 341 342 /** 343 * when nesting observeComponentCreation functions, such as in the case of 344 * If, and the if branch creates a Text etc that requires an implicit pop 345 * this function is needed after executing the inner observeComponentCreation 346 * and before read ViewStackProcessor.GetTopMostElementId(); on the outer one 347 */ 348 void ImplicitPopBeforeContinue(); 349 350 // End of Rerender function, flush modifier task. 351 ACE_FORCE_EXPORT void FlushRerenderTask(); 352 353 /** 354 * start 'get' access recording 355 * account all get access to given node id 356 * next node creation will claim the given node id 357 * see ClaimNodeId() 358 */ StartGetAccessRecordingFor(int32_t elmtId)359 void StartGetAccessRecordingFor(int32_t elmtId) 360 { 361 accountGetAccessToNodeId_ = elmtId; 362 reservedNodeId_ = elmtId; 363 if (containerId_ != OHOS::Ace::INSTANCE_ID_UNDEFINED) { 364 restoreInstanceId_ = Container::CurrentId(); 365 ContainerScope::UpdateCurrent(containerId_); 366 } 367 } 368 ClaimNodeId()369 int32_t ClaimNodeId() 370 { 371 const auto result = reservedNodeId_; 372 reservedNodeId_ = ElementRegister::UndefinedElementId; 373 return result; 374 } 375 SetRecycleNodeId(int32_t recycleNodeId)376 void SetRecycleNodeId(int32_t recycleNodeId) 377 { 378 recycleNodeId_ = recycleNodeId; 379 } 380 GetRecycleNodeId()381 int32_t GetRecycleNodeId() 382 { 383 const auto result = recycleNodeId_; 384 recycleNodeId_ = ElementRegister::UndefinedElementId; 385 return result; 386 } 387 388 /** 389 * get the elmtId to which all get access should be accounted 390 * ElementRegister::UndefinedElementId; means no get access recording enabled 391 */ GetNodeIdToAccountFor()392 ElementIdType GetNodeIdToAccountFor() const 393 { 394 return accountGetAccessToNodeId_; 395 } SetNodeIdToAccountFor(ElementIdType elmtId)396 void SetNodeIdToAccountFor(ElementIdType elmtId) 397 { 398 accountGetAccessToNodeId_ = elmtId; 399 } 400 401 /** 402 * inverse of StartGetAccessRecordingFor 403 */ StopGetAccessRecording()404 void StopGetAccessRecording() 405 { 406 if (restoreInstanceId_ != OHOS::Ace::INSTANCE_ID_UNDEFINED) { 407 ContainerScope::UpdateCurrent(restoreInstanceId_); 408 restoreInstanceId_ = OHOS::Ace::INSTANCE_ID_UNDEFINED; 409 } 410 accountGetAccessToNodeId_ = ElementRegister::UndefinedElementId; 411 reservedNodeId_ = ElementRegister::UndefinedElementId; 412 } 413 414 void FlushImplicitAnimation(); 415 416 // used for knowing which page node to execute the pageTransitionFunc SetPageNode(const RefPtr<FrameNode> & pageNode)417 void SetPageNode(const RefPtr<FrameNode>& pageNode) 418 { 419 currentPage_ = pageNode; 420 } 421 GetPageNode()422 const RefPtr<FrameNode>& GetPageNode() const 423 { 424 return currentPage_; 425 } 426 427 // Sets the implicit animation option. This is needed for 3D Model View. 428 void SetImplicitAnimationOption(const AnimationOption& option); 429 430 // Returns implicit animation option. 431 const AnimationOption& GetImplicitAnimationOption() const; 432 433 RefPtr<UINode> GetNewUINode(); 434 GetAndPushFrameNode(const std::string & tag,int32_t elmtId)435 void GetAndPushFrameNode(const std::string& tag, int32_t elmtId) 436 { 437 auto frameNode = FrameNode::GetFrameNode(tag, elmtId); 438 if (!frameNode) { 439 return; 440 } 441 Push(frameNode); 442 } 443 CheckTopNodeFirstBuilding()444 bool CheckTopNodeFirstBuilding() const 445 { 446 auto node = GetMainFrameNode(); 447 CHECK_NULL_RETURN(node, false); 448 return node->IsFirstBuilding(); 449 } 450 SetCustomTitleNode(const RefPtr<UINode> & customTitleNode)451 void SetCustomTitleNode(const RefPtr<UINode>& customTitleNode) 452 { 453 customTitleNode_ = customTitleNode; 454 } 455 GetCustomTitleNode()456 const RefPtr<UINode> GetCustomTitleNode() const 457 { 458 return customTitleNode_; 459 } 460 SetCustomWindowMaskNode(const RefPtr<UINode> & customWindowMaskNode)461 void SetCustomWindowMaskNode(const RefPtr<UINode>& customWindowMaskNode) 462 { 463 customWindowMaskNode_ = customWindowMaskNode; 464 } 465 GetCustomWindowMaskNode()466 const RefPtr<UINode> GetCustomWindowMaskNode() const 467 { 468 return customWindowMaskNode_; 469 } 470 SetCustomButtonNode(const RefPtr<UINode> & customButtonNode)471 void SetCustomButtonNode(const RefPtr<UINode>& customButtonNode) 472 { 473 customButtonNode_ = customButtonNode; 474 } 475 GetCustomButtonNode()476 const RefPtr<UINode> GetCustomButtonNode() const 477 { 478 return customButtonNode_; 479 } 480 SetCustomAppBarNode(const RefPtr<UINode> & customNode)481 void SetCustomAppBarNode(const RefPtr<UINode>& customNode) 482 { 483 customAppBarNode_ = customNode; 484 } 485 GetCustomAppBarNode()486 const RefPtr<UINode> GetCustomAppBarNode() const 487 { 488 return customAppBarNode_; 489 } 490 SetIsBuilderNode(bool isBuilderNode)491 void SetIsBuilderNode(bool isBuilderNode) 492 { 493 isBuilderNode_ = isBuilderNode; 494 } 495 IsBuilderNode()496 bool IsBuilderNode() const 497 { 498 return isBuilderNode_; 499 } 500 SetIsExportTexture(bool isExportTexture)501 void SetIsExportTexture(bool isExportTexture) 502 { 503 isExportTexture_ = isExportTexture; 504 } 505 IsExportTexture()506 bool IsExportTexture() const 507 { 508 return isExportTexture_; 509 } 510 SetRebuildContainerId(int32_t containerId)511 void SetRebuildContainerId(int32_t containerId) 512 { 513 containerId_ = containerId; 514 } 515 IsEmpty()516 bool IsEmpty() const 517 { 518 return elementsStack_.empty(); 519 } 520 SetIsPrebuilding(bool isPrebuilding)521 void SetIsPrebuilding(bool isPrebuilding) 522 { 523 isPrebuilding_ = isPrebuilding; 524 } 525 CheckIsPrebuildTimeout()526 bool CheckIsPrebuildTimeout() 527 { 528 if (!isPrebuildTimeout_) { 529 isPrebuildTimeout_ = prebuildDeadline_ > 0 && GetSysTimestamp() > prebuildDeadline_; 530 } 531 return isPrebuildTimeout_; 532 } 533 IsPrebuilding()534 bool IsPrebuilding() const 535 { 536 return isPrebuilding_; 537 } 538 GetPrebuildComponentCmds()539 std::queue<PrebuildCompCmd>& GetPrebuildComponentCmds() 540 { 541 return PrebuildCompCmds_; 542 } 543 PushPrebuildCompCmd()544 void PushPrebuildCompCmd() 545 { 546 PrebuildCompCmds_.emplace(PrebuildCompCmdType::FRONT); 547 } 548 PushPrebuildCompCmd(const char * commandName,PrebuildFunc prebuildFunc)549 void PushPrebuildCompCmd(const char* commandName, PrebuildFunc prebuildFunc) 550 { 551 PrebuildCompCmds_.emplace(PrebuildCompCmdType::BACK, commandName, prebuildFunc); 552 } 553 private: 554 ViewStackProcessor(); 555 556 bool ShouldPopImmediately(); 557 558 // Singleton instance 559 static thread_local std::unique_ptr<ViewStackProcessor> instance; 560 561 // render component stack 562 std::stack<RefPtr<UINode>> elementsStack_; 563 564 RefPtr<FrameNode> currentPage_; 565 566 RefPtr<UINode> customTitleNode_; 567 RefPtr<UINode> customButtonNode_; 568 RefPtr<UINode> customAppBarNode_; 569 RefPtr<UINode> customWindowMaskNode_; 570 571 RefPtr<GestureProcessor> gestureStack_; 572 573 std::string viewKey_; 574 std::stack<size_t> keyStack_; 575 576 std::stack<int32_t> parentIdStack_; 577 578 std::optional<UIState> visualState_ = std::nullopt; 579 bool isBuilderNode_ = false; 580 bool isExportTexture_ = false; 581 bool isPrebuilding_ = false; 582 bool isPrebuildTimeout_ = false; 583 int64_t prebuildDeadline_ = 0; 584 std::queue<PrebuildCompCmd> PrebuildCompCmds_; 585 int32_t containerId_ = OHOS::Ace::INSTANCE_ID_UNDEFINED; 586 int32_t restoreInstanceId_ = OHOS::Ace::INSTANCE_ID_UNDEFINED; 587 588 ElementIdType recycleNodeId_ = ElementRegister::UndefinedElementId; 589 // elmtId reserved for next component creation 590 ElementIdType reservedNodeId_ = ElementRegister::UndefinedElementId; 591 592 // elmtId to account get access to 593 ElementIdType accountGetAccessToNodeId_ = ElementRegister::UndefinedElementId; 594 595 AnimationOption implicitAnimationOption_; 596 597 ACE_DISALLOW_COPY_AND_MOVE(ViewStackProcessor); 598 }; 599 600 class ACE_FORCE_EXPORT ScopedViewStackProcessor final { 601 public: 602 ScopedViewStackProcessor(int32_t containerId = OHOS::Ace::INSTANCE_ID_UNDEFINED); 603 ScopedViewStackProcessor(std::unique_ptr<ViewStackProcessor>& instance, 604 int32_t containerId = OHOS::Ace::INSTANCE_ID_UNDEFINED); 605 ~ScopedViewStackProcessor(); 606 void SwapViewStackProcessor(std::unique_ptr<ViewStackProcessor>& instance); 607 608 private: 609 void Init(int32_t containerId); 610 std::unique_ptr<ViewStackProcessor> instance_; 611 612 ACE_DISALLOW_COPY_AND_MOVE(ScopedViewStackProcessor); 613 }; 614 } // namespace OHOS::Ace::NG 615 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_BASE_VIEW_STACK_PROCESSOR_H 616