• 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/slider/slider_pattern.h"
17 
18 #include "core/pipeline_ng/pipeline_context.h"
19 
20 namespace OHOS::Ace::NG {
UpdateValueMultiThread(const RefPtr<FrameNode> & frameNode)21 void SliderPattern::UpdateValueMultiThread(const RefPtr<FrameNode>& frameNode)
22 {
23     auto updateTask = [weak = WeakClaim(this)]() {
24         auto pattern = weak.Upgrade();
25         CHECK_NULL_VOID(pattern);
26         pattern->CalcSliderValue();
27         pattern->FireBuilder();
28     };
29     frameNode->PostAfterAttachMainTreeTask(std::move(updateTask));
30 }
31 
OnAttachToFrameNodeMultiThread()32 void SliderPattern::OnAttachToFrameNodeMultiThread()
33 {
34 }
35 
OnAttachToMainTreeMultiThread()36 void SliderPattern::OnAttachToMainTreeMultiThread()
37 {
38     // Insecure operations are performed in the main thread after the main tree is mounted.
39     RegisterVisibleAreaChange();
40 }
41 
OnDetachFromFrameNodeMultiThread()42 void SliderPattern::OnDetachFromFrameNodeMultiThread()
43 {
44 }
45 
OnDetachFromMainTreeMultiThread(const RefPtr<FrameNode> & frameNode)46 void SliderPattern::OnDetachFromMainTreeMultiThread(const RefPtr<FrameNode>& frameNode)
47 {
48     RemoveCallbackOnDetach(frameNode.GetRawPtr());
49 }
50 } // namespace OHOS::Ace::NG