1 /*
2 * Copyright (c) 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 #include "core/common/task_runners.h"
17
18 namespace OHOS::Ace {
TaskRunners(const std::string & label,const RefPtr<TaskRunnerAdapter> & platform,const RefPtr<TaskRunnerAdapter> & gpu,const RefPtr<TaskRunnerAdapter> & ui,const RefPtr<TaskRunnerAdapter> & io)19 TaskRunners::TaskRunners(const std::string& label, const RefPtr<TaskRunnerAdapter>& platform,
20 const RefPtr<TaskRunnerAdapter>& gpu, const RefPtr<TaskRunnerAdapter>& ui, const RefPtr<TaskRunnerAdapter>& io)
21 : label_(label), platform_(platform), gpu_(gpu), ui_(ui), io_(io)
22 {}
23
GetPlatformTaskRunner() const24 RefPtr<TaskRunnerAdapter> TaskRunners::GetPlatformTaskRunner() const
25 {
26 return platform_;
27 }
28
GetUITaskRunner() const29 RefPtr<TaskRunnerAdapter> TaskRunners::GetUITaskRunner() const
30 {
31 return ui_;
32 }
33
GetIOTaskRunner() const34 RefPtr<TaskRunnerAdapter> TaskRunners::GetIOTaskRunner() const
35 {
36 return io_;
37 }
38
GetGPUTaskRunner() const39 RefPtr<TaskRunnerAdapter> TaskRunners::GetGPUTaskRunner() const
40 {
41 return gpu_;
42 }
43
GetLabel() const44 const std::string& TaskRunners::GetLabel() const
45 {
46 return label_;
47 }
48
IsValid() const49 bool TaskRunners::IsValid() const
50 {
51 return platform_ && gpu_ && ui_ && io_;
52 }
53 } // namespace OHOS::Ace
54