• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #include "core/components_ng/pattern/refresh/refresh_model_ng.h"
17 
18 #include <string>
19 
20 #include "base/memory/referenced.h"
21 #include "base/utils/multi_thread.h"
22 #include "frameworks/base/geometry/dimension.h"
23 #include "frameworks/base/geometry/ng/offset_t.h"
24 #include "frameworks/base/i18n/localization.h"
25 #include "frameworks/base/utils/time_util.h"
26 #include "frameworks/core/components/refresh/refresh_theme.h"
27 #include "frameworks/core/components_ng/base/frame_node.h"
28 #include "frameworks/core/components_ng/base/view_stack_processor.h"
29 #include "frameworks/core/components_ng/event/event_hub.h"
30 
31 namespace OHOS::Ace::NG {
SetCustomBuilderMultiThread(FrameNode * frameNode,FrameNode * customBuilder)32 void RefreshModelNG::SetCustomBuilderMultiThread(FrameNode* frameNode, FrameNode* customBuilder)
33 {
34     CHECK_NULL_VOID(frameNode);
35     auto pattern = frameNode->GetPattern<RefreshPattern>();
36     CHECK_NULL_VOID(pattern);
37     frameNode->PostAfterAttachMainTreeTask([weak = AceType::WeakClaim(AceType::RawPtr(pattern)), customBuilder]() {
38         auto pattern = weak.Upgrade();
39         CHECK_NULL_VOID(pattern);
40         pattern->AddCustomBuilderNode(AceType::Claim<UINode>(customBuilder));
41     });
42 }
43 } // namespace OHOS::Ace::NG
44