From b23feda51563550f18bdac792d5864534aa60621 Mon Sep 17 00:00:00 2001 From: dy_study Date: Sat, 9 Apr 2022 14:39:43 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:#I51UW4=20Description:task=5Fdispatcher?= =?UTF-8?q?=E6=89=80=E5=B1=9E=E9=83=A8=E4=BB=B6=E8=B0=83=E6=95=B4=20Sig:SI?= =?UTF-8?q?G=5FApplicationFramework=20Feature=20or=20Bugfix:=20Feature=20B?= =?UTF-8?q?inary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy_study Change-Id: I4e9c1a903d07e21596041c8189f4e4777480cce2 --- bundle.json | 12 - common/task_dispatcher/BUILD.gn | 3 +- .../include/task/barrier_handler.h | 4 +- .../include/task/task_errors.h | 33 +++ .../threading/task_execute_interceptor.h | 2 +- .../include/threading/task_executor.h | 3 +- .../include/threading/work_thread.h | 6 +- .../parallel_task_dispatcher_base.cpp | 2 +- .../src/dispatcher/serial_task_dispatcher.cpp | 2 +- .../barrier_handler_test.cpp | 2 +- .../parallel_task_dispatcher_base_test.cpp | 8 +- .../parallel_task_dispatcher_test.cpp | 6 +- .../serial_task_dispatcher_test.cpp | 4 +- frameworks/kits/ability/native/BUILD.gn | 2 +- .../native/app/include/task_dispatcher.h | 6 +- interfaces/innerkits/bundle.json | 12 + ohos.build | 250 ------------------ 17 files changed, 69 insertions(+), 288 deletions(-) create mode 100644 common/task_dispatcher/include/task/task_errors.h delete mode 100644 ohos.build diff --git a/bundle.json b/bundle.json index fc1484c5c0..984d9f0923 100644 --- a/bundle.json +++ b/bundle.json @@ -156,18 +156,6 @@ ] }, "name": "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/common/task_dispatcher/include", - "header_files": [ - "dispatcher/parallel_task_dispatcher.h", - "dispatcher/task_dispatcher_context.h", - "threading/runnable.h", - "task/task.h" - ] - }, - "name": "//foundation/aafwk/standard/common/task_dispatcher:task_dispatcher" } ], "test": [ diff --git a/common/task_dispatcher/BUILD.gn b/common/task_dispatcher/BUILD.gn index 8ac33fef0d..054bd56fad 100644 --- a/common/task_dispatcher/BUILD.gn +++ b/common/task_dispatcher/BUILD.gn @@ -54,12 +54,11 @@ ohos_shared_library("task_dispatcher") { } deps = [] external_deps = [ - "bundle_framework:appexecfwk_base", "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "utils_base:utils", ] subsystem_name = "aafwk" - part_name = "ability_runtime" + part_name = "ability_base" } diff --git a/common/task_dispatcher/include/task/barrier_handler.h b/common/task_dispatcher/include/task/barrier_handler.h index 7bf29df1d2..bc20db81c2 100644 --- a/common/task_dispatcher/include/task/barrier_handler.h +++ b/common/task_dispatcher/include/task/barrier_handler.h @@ -16,11 +16,11 @@ #define OHOS_APP_DISPATCHER_BARRIER_HANDLER_H #include -#include "appexecfwk_errors.h" #include "task.h" -#include "task_listener.h" +#include "task_errors.h" #include "task_executor.h" #include "task_execute_interceptor.h" +#include "task_listener.h" #include "task_stage.h" namespace OHOS { diff --git a/common/task_dispatcher/include/task/task_errors.h b/common/task_dispatcher/include/task/task_errors.h new file mode 100644 index 0000000000..7744d59606 --- /dev/null +++ b/common/task_dispatcher/include/task/task_errors.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_TASK_ERRORS_H +#define OHOS_TASK_ERRORS_H + +#include "errors.h" + +namespace OHOS { +enum { + ABILITY_MODULE_TASK = 0x08, +}; + +constexpr ErrCode AAFWK_TASK_ERR_OFFSET = ErrCodeOffset(SUBSYS_APPEXECFWK, ABILITY_MODULE_TASK); +enum { + ERR_APPEXECFWK_CHECK_FAILED = AAFWK_TASK_ERR_OFFSET + 1, + ERR_APPEXECFWK_INTERCEPT_TASK_EXECUTE_SUCCESS +}; +} // namespace OHOS + +#endif // OHOS_TASK_ERRORS_H diff --git a/common/task_dispatcher/include/threading/task_execute_interceptor.h b/common/task_dispatcher/include/threading/task_execute_interceptor.h index 4c3e6acd84..dc89163559 100644 --- a/common/task_dispatcher/include/threading/task_execute_interceptor.h +++ b/common/task_dispatcher/include/threading/task_execute_interceptor.h @@ -16,7 +16,7 @@ #ifndef OHOS_APP_DISPATCHER_TASK_TaskExecuteInterceptor_H #define OHOS_APP_DISPATCHER_TASK_TaskExecuteInterceptor_H #include "task.h" -#include "appexecfwk_errors.h" +#include "task_errors.h" namespace OHOS { namespace AppExecFwk { diff --git a/common/task_dispatcher/include/threading/task_executor.h b/common/task_dispatcher/include/threading/task_executor.h index 5e4509a616..a3e4c709d4 100644 --- a/common/task_dispatcher/include/threading/task_executor.h +++ b/common/task_dispatcher/include/threading/task_executor.h @@ -19,12 +19,11 @@ #include #include -#include "appexecfwk_errors.h" - #include "blocking_queue.h" #include "delay_execute_service.h" #include "delay_queue.h" #include "task.h" +#include "task_errors.h" #include "work_thread.h" #include "worker_pool.h" diff --git a/common/task_dispatcher/include/threading/work_thread.h b/common/task_dispatcher/include/threading/work_thread.h index 02b2783417..e969f7e2cc 100644 --- a/common/task_dispatcher/include/threading/work_thread.h +++ b/common/task_dispatcher/include/threading/work_thread.h @@ -18,10 +18,10 @@ #include -#include "thread_factory.h" -#include "task.h" #include "hilog_wrapper.h" -#include "appexecfwk_errors.h" +#include "task.h" +#include "task_errors.h" +#include "thread_factory.h" namespace OHOS { namespace AppExecFwk { diff --git a/common/task_dispatcher/src/dispatcher/parallel_task_dispatcher_base.cpp b/common/task_dispatcher/src/dispatcher/parallel_task_dispatcher_base.cpp index a68596f54a..059966ed9f 100644 --- a/common/task_dispatcher/src/dispatcher/parallel_task_dispatcher_base.cpp +++ b/common/task_dispatcher/src/dispatcher/parallel_task_dispatcher_base.cpp @@ -15,7 +15,7 @@ #include "parallel_task_dispatcher_base.h" #include "hilog_wrapper.h" -#include "appexecfwk_errors.h" +#include "task_errors.h" namespace OHOS { namespace AppExecFwk { diff --git a/common/task_dispatcher/src/dispatcher/serial_task_dispatcher.cpp b/common/task_dispatcher/src/dispatcher/serial_task_dispatcher.cpp index f7d96a688b..1ee6c211cc 100644 --- a/common/task_dispatcher/src/dispatcher/serial_task_dispatcher.cpp +++ b/common/task_dispatcher/src/dispatcher/serial_task_dispatcher.cpp @@ -15,7 +15,7 @@ #include "serial_task_dispatcher.h" #include "hilog_wrapper.h" -#include "appexecfwk_errors.h" +#include "task_errors.h" namespace OHOS { namespace AppExecFwk { std::string SerialTaskDispatcher::DISPATCHER_TAG = "SerialTaskDispatcher"; diff --git a/common/task_dispatcher/test/unittest/barrier_handler_test/barrier_handler_test.cpp b/common/task_dispatcher/test/unittest/barrier_handler_test/barrier_handler_test.cpp index 9c705156c4..f2628f2c93 100644 --- a/common/task_dispatcher/test/unittest/barrier_handler_test/barrier_handler_test.cpp +++ b/common/task_dispatcher/test/unittest/barrier_handler_test/barrier_handler_test.cpp @@ -17,8 +17,8 @@ #define private public #include "barrier_handler.h" #undef private -#include "appexecfwk_errors.h" #include "default_worker_pool_config.h" +#include "task_errors.h" using namespace testing; using namespace testing::ext; diff --git a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/parallel_task_dispatcher_base_test.cpp b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/parallel_task_dispatcher_base_test.cpp index 38c25387f1..a112fc11f2 100644 --- a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/parallel_task_dispatcher_base_test.cpp +++ b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/parallel_task_dispatcher_base_test.cpp @@ -17,11 +17,11 @@ #define private public #include "parallel_task_dispatcher_base.h" #undef private -#include "appexecfwk_errors.h" -#include "task_priority.h" -#include "task_executor.h" -#include "task.h" #include "default_worker_pool_config.h" +#include "task.h" +#include "task_errors.h" +#include "task_executor.h" +#include "task_priority.h" using namespace testing; using namespace testing::ext; diff --git a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/parallel_task_dispatcher_test.cpp b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/parallel_task_dispatcher_test.cpp index c861e62bbb..8f8614c6ed 100644 --- a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/parallel_task_dispatcher_test.cpp +++ b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/parallel_task_dispatcher_test.cpp @@ -17,11 +17,11 @@ #define private public #include "parallel_task_dispatcher.h" #undef private +#include "default_worker_pool_config.h" +#include "task.h" +#include "task_errors.h" #include "task_priority.h" #include "task_executor.h" -#include "task.h" -#include "default_worker_pool_config.h" -#include "appexecfwk_errors.h" using namespace testing; using namespace testing::ext; diff --git a/common/task_dispatcher/test/unittest/serial_task_dispatcher_test/serial_task_dispatcher_test.cpp b/common/task_dispatcher/test/unittest/serial_task_dispatcher_test/serial_task_dispatcher_test.cpp index 66d345b610..456b80e696 100644 --- a/common/task_dispatcher/test/unittest/serial_task_dispatcher_test/serial_task_dispatcher_test.cpp +++ b/common/task_dispatcher/test/unittest/serial_task_dispatcher_test/serial_task_dispatcher_test.cpp @@ -17,10 +17,10 @@ #define private public #include "serial_task_dispatcher.h" #undef private -#include "hilog_wrapper.h" -#include "appexecfwk_errors.h" #include "default_worker_pool_config.h" +#include "hilog_wrapper.h" #include "task.h" +#include "task_errors.h" #include "task_executor.h" #include "task_priority.h" diff --git a/frameworks/kits/ability/native/BUILD.gn b/frameworks/kits/ability/native/BUILD.gn index 85eb87fc1e..851a64ad9c 100644 --- a/frameworks/kits/ability/native/BUILD.gn +++ b/frameworks/kits/ability/native/BUILD.gn @@ -232,6 +232,7 @@ ohos_shared_library("abilitykit_native") { external_deps = [ "ability_base:base", "ability_base:configuration", + "ability_base:task_dispatcher", "ability_base:want", "ability_base:zuri", "ability_runtime:ability_context_native", @@ -239,7 +240,6 @@ ohos_shared_library("abilitykit_native") { "ability_runtime:app_manager", "ability_runtime:napi_base_context", "ability_runtime:runtime", - "ability_runtime:task_dispatcher", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "bundle_framework:appexecfwk_base", diff --git a/frameworks/kits/appkit/native/app/include/task_dispatcher.h b/frameworks/kits/appkit/native/app/include/task_dispatcher.h index 00c9147c48..9b65a867e6 100644 --- a/frameworks/kits/appkit/native/app/include/task_dispatcher.h +++ b/frameworks/kits/appkit/native/app/include/task_dispatcher.h @@ -17,11 +17,11 @@ #define OHOS_APP_DISPATCHER_TASK_DISPATCHER_H #include -#include "task_priority.h" +#include "group.h" #include "revocable.h" #include "runnable.h" -#include "group.h" -#include "appexecfwk_errors.h" +#include "task_errors.h" +#include "task_priority.h" namespace OHOS { namespace AppExecFwk { template diff --git a/interfaces/innerkits/bundle.json b/interfaces/innerkits/bundle.json index e385fd0e1a..d92043cef8 100644 --- a/interfaces/innerkits/bundle.json +++ b/interfaces/innerkits/bundle.json @@ -91,6 +91,18 @@ ] }, "name": "//foundation/aafwk/standard/interfaces/innerkits/uri:zuri" + }, + { + "header": { + "header_base": "//foundation/aafwk/standard/common/task_dispatcher/include", + "header_files": [ + "dispatcher/parallel_task_dispatcher.h", + "dispatcher/task_dispatcher_context.h", + "threading/runnable.h", + "task/task.h" + ] + }, + "name": "//foundation/aafwk/standard/common/task_dispatcher:task_dispatcher" } ], "test": [] diff --git a/ohos.build b/ohos.build deleted file mode 100644 index 31a64ce2a4..0000000000 --- a/ohos.build +++ /dev/null @@ -1,250 +0,0 @@ -{ - "parts": { - "ability_runtime": { - "module_list": [ - "//foundation/aafwk/standard/services:services_target", - "//foundation/aafwk/standard/interfaces/innerkits:innerkits_target", - "//foundation/aafwk/standard/frameworks/kits/ability/native:datashare_ext_ability_module", - "//foundation/aafwk/standard/frameworks/kits/ability/native:static_subscriber_ipc", - "//foundation/aafwk/standard/frameworks/kits/ability/native:service_extension_module", - "//foundation/aafwk/standard/sa_profile:aafwk_sa_profile", - "//foundation/aafwk/standard/interfaces/kits/napi:napi_packages", - "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime:ability_context_native", - "//foundation/aafwk/standard/common:common_target", - "//foundation/aafwk/standard/frameworks/kits/appkit:app_context", - "//foundation/aafwk/standard/frameworks/kits/appkit:appkit_native", - "//foundation/aafwk/standard/frameworks/kits/wantagent:native_wantagent", - "//foundation/aafwk/standard/frameworks/kits/appkit:appexec", - "//foundation/aafwk/standard/test/resource/amssystemtestability/abilitySrc:ams_system_test_app" - - ], - "inner_kits": [ - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/ability_manager/include", - "header_files": [ - "ability_connect_callback_interface.h", - "ability_connect_callback_stub.h", - "ability_manager_client.h", - "ability_manager_errors.h", - "ability_manager_interface.h", - "ability_scheduler_interface.h", - "stop_user_callback.h", - "stop_user_callback_stub.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime/include", - "header_files": [ - "ability_context.h" - ] - }, - "name": "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime:ability_context_native" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/runtime/include/", - "header_files": [ - "js_runtime.h", - "runtime.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/runtime:runtime" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/napi_base_context/include", - "header_files": [ - "napi_base_context.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/napi_base_context:napi_base_context" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/app_manager/include", - "header_files": [ - "appmgr/app_mgr_client.h", - "appmgr/iapp_state_callback.h", - "appmgr/app_state_callback_host.h", - "appmgr/app_mgr_constants.h", - "appmgr/app_process_data.h", - "appmgr/irender_scheduler.h", - "appmgr/render_scheduler_host.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/app_manager:app_manager" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/frameworks/kits/ability/native/include/", - "header_files": [ - "extension_base.h", - "extension_context.h", - "extension_module_loader.h", - "service_extension.h", - "service_extension_context.h" - ] - }, - "name": "//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/common/task_dispatcher/include", - "header_files": [ - "dispatcher/parallel_task_dispatcher.h", - "dispatcher/task_dispatcher_context.h", - "threading/runnable.h", - "task/task.h" - ] - }, - "name": "//foundation/aafwk/standard/common/task_dispatcher:task_dispatcher" - } - ], - "test_list": [ - "//foundation/aafwk/standard/frameworks/kits/content/cpp/test:unittest", - "//foundation/aafwk/standard/frameworks/kits/ability/native/test:unittest", - "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime/test/moduletest:moduletest", - "//foundation/aafwk/standard/frameworks/kits/ability/ability_runtime/test/unittest:unittest", - "//foundation/aafwk/standard/frameworks/kits/test:moduletest", - "//foundation/aafwk/standard/services/test:moduletest", - "//foundation/aafwk/standard/services:unittest", - "//foundation/aafwk/standard/common/task_dispatcher/test:unittest", - "//foundation/aafwk/standard/common/test:moduletest", - "//foundation/aafwk/standard/frameworks/kits/appkit/native/test:unittest", - "//foundation/aafwk/standard/frameworks/kits/appkit/test:moduletest", - "//foundation/aafwk/standard/services/appmgr/test:unittest" - ] - }, - "ability_tools": { - "module_list": [ - "//foundation/aafwk/standard/tools:tools_target" - ], - "inner_kits": [ - ], - "test_list": [ - "//foundation/aafwk/standard/tools/test:systemtest", - "//foundation/aafwk/standard/tools/test:moduletest", - "//foundation/aafwk/standard/tools/test:unittest" - ] - }, - "form_runtime": { - "module_list": [ - "//foundation/aafwk/standard/sa_profile:form_sa_profile", - "//foundation/aafwk/standard/services:fms_services_target", - "//foundation/aafwk/standard/interfaces/innerkits:fms_innerkits_target", - "//foundation/aafwk/standard/frameworks/kits/fmskit:fmskit_native", - "//foundation/aafwk/standard/interfaces/kits/napi:form_napi_packages", - "//foundation/aafwk/standard/test/resource/formsystemtestability:fms_system_test_app" - ], - "inner_kits": [ - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/form_manager/include", - "header_files": [ - "form_death_callback.h", - "form_host_interface.h", - "form_host_stub.h", - "form_js_info.h", - "form_mgr_interface.h", - "form_mgr_stub.h", - "form_provider_data.h", - "form_provider_interface.h", - "form_provider_stub.h", - "form_supply_interface.h", - "form_supply_stub.h", - "provider_connect_stub.h", - "form_constants.h", - "form_js_info.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/form_manager:form_manager" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/frameworks/kits/fmskit/native/include", - "header_files": [ - "form_callback_interface.h", - "form_host_client.h", - "form_mgr.h" - ] - }, - "name": "//foundation/aafwk/standard/frameworks/kits/fmskit:fmskit_native" - } - ], - "test_list": [ - "//foundation/aafwk/standard/services/formmgr/test:unittest", - "//foundation/aafwk/standard/test/systemtest:systemtest" - ] - }, - "ability_base": { - "module_list": [ - "//foundation/aafwk/standard/interfaces/innerkits:base_innerkits_target" - ], - "inner_kits": [ - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/base/include/", - "header_files": [ - "ohos/aafwk/base/array_wrapper.h", - "ohos/aafwk/base/base_def.h", - "ohos/aafwk/base/base_interfaces.h", - "ohos/aafwk/base/base_object.h", - "ohos/aafwk/base/base_types.h", - "ohos/aafwk/base/bool_wrapper.h", - "ohos/aafwk/base/byte_wrapper.h", - "ohos/aafwk/base/double_wrapper.h", - "ohos/aafwk/base/float_wrapper.h", - "ohos/aafwk/base/int_wrapper.h", - "ohos/aafwk/base/light_refbase.h", - "ohos/aafwk/base/long_wrapper.h", - "ohos/aafwk/base/short_wrapper.h", - "ohos/aafwk/base/string_wrapper.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/base:base" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/want/include/", - "header_files": [ - "ohos/aafwk/content/want.h", - "ohos/aafwk/content/skills.h", - "ohos/aafwk/content/want_params.h", - "ohos/aafwk/content/match_type.h", - "ohos/aafwk/content/operation.h", - "ohos/aafwk/content/patterns_matcher.h", - "ohos/aafwk/content/pac_map.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/want:want" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/app_manager/include/appmgr", - "header_files": [ - "configuration.h", - "global_configuration_key.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/app_manager:configuration" - }, - { - "header": { - "header_base": "//foundation/aafwk/standard/interfaces/innerkits/uri/include", - "header_files": [ - "uri.h" - ] - }, - "name": "//foundation/aafwk/standard/interfaces/innerkits/uri:zuri" - } - ], - "test_list": [ - ] - } - }, - "subsystem": "aafwk" -}