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 "base/thread/background_task_executor.h" 17 18 namespace OHOS::Ace { GetInstance()19BackgroundTaskExecutor& BackgroundTaskExecutor::GetInstance() 20 { 21 static BackgroundTaskExecutor instance; 22 return instance; 23 } 24 25 BackgroundTaskExecutor::BackgroundTaskExecutor() = default; 26 ~BackgroundTaskExecutor()27BackgroundTaskExecutor::~BackgroundTaskExecutor() {} 28 PostTask(Task && task,BgTaskPriority priority)29bool BackgroundTaskExecutor::PostTask(Task&& task, BgTaskPriority priority) 30 { 31 currentThreadNum_++; 32 maxThreadNum_++; 33 running_ = true; 34 purgeFlags_++; 35 return true; 36 } 37 PostTask(const Task & task,BgTaskPriority priority)38bool BackgroundTaskExecutor::PostTask(const Task& task, BgTaskPriority priority) 39 { 40 return true; 41 } 42 StartNewThreads(size_t num)43void BackgroundTaskExecutor::StartNewThreads(size_t num) {} 44 ThreadLoop(uint32_t threadNo)45void BackgroundTaskExecutor::ThreadLoop(uint32_t threadNo) {} 46 TriggerGarbageCollection()47void BackgroundTaskExecutor::TriggerGarbageCollection() {} 48 } // namespace OHOS::Ace 49