mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-24 07:31:57 +00:00
fix page loading when dynamic import a non-named page
Signed-off-by: Far <yesiyuan2@huawei.com> Change-Id: I1147b825b849a0ea54e5f8d445f433d8b2e458b0
This commit is contained in:
parent
ae3f51700f
commit
03b5790a17
@ -97,6 +97,7 @@ foreach(item, ace_platforms) {
|
|||||||
"$ace_root/frameworks/core/components/test/mock/mock_resource_adapter.cpp",
|
"$ace_root/frameworks/core/components/test/mock/mock_resource_adapter.cpp",
|
||||||
"$ace_root/frameworks/core/components/test/unittest/mock/subwindow_mock.cpp",
|
"$ace_root/frameworks/core/components/test/unittest/mock/subwindow_mock.cpp",
|
||||||
"$ace_root/test/mock/adapter/mock_ace_container.cpp",
|
"$ace_root/test/mock/adapter/mock_ace_container.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (is_ohos_standard_system) {
|
if (is_ohos_standard_system) {
|
||||||
|
@ -256,6 +256,7 @@ void DeclarativeFrontend::InitializeFrontendDelegate(const RefPtr<TaskExecutor>&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
jsEngine->LoadJs(url, jsPage, isMainPage);
|
jsEngine->LoadJs(url, jsPage, isMainPage);
|
||||||
|
jsEngine->UpdateRootComponent();
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto& setPluginMessageTransferCallback = [weakEngine = WeakPtr<Framework::JsEngine>(jsEngine_)](
|
const auto& setPluginMessageTransferCallback = [weakEngine = WeakPtr<Framework::JsEngine>(jsEngine_)](
|
||||||
@ -530,7 +531,16 @@ void DeclarativeFrontend::InitializeFrontendDelegate(const RefPtr<TaskExecutor>&
|
|||||||
}
|
}
|
||||||
return jsEngine->LoadNamedRouterSource(namedRouter, isTriggeredByJs);
|
return jsEngine->LoadNamedRouterSource(namedRouter, isTriggeredByJs);
|
||||||
};
|
};
|
||||||
delegate_->InitializeRouterManager(std::move(loadPageCallback), std::move(loadNamedRouterCallback));
|
auto updateRootComponentCallback = [weakEngine = WeakPtr<Framework::JsEngine>(jsEngine_)]() {
|
||||||
|
auto jsEngine = weakEngine.Upgrade();
|
||||||
|
if (!jsEngine) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return jsEngine->UpdateRootComponent();
|
||||||
|
};
|
||||||
|
delegate_->InitializeRouterManager(std::move(loadPageCallback), std::move(loadNamedRouterCallback),
|
||||||
|
std::move(updateRootComponentCallback));
|
||||||
|
|
||||||
auto moduleNamecallback = [weakEngine = WeakPtr<Framework::JsEngine>(jsEngine_)](const std::string& pageName)->
|
auto moduleNamecallback = [weakEngine = WeakPtr<Framework::JsEngine>(jsEngine_)](const std::string& pageName)->
|
||||||
std::string {
|
std::string {
|
||||||
auto jsEngine = weakEngine.Upgrade();
|
auto jsEngine = weakEngine.Upgrade();
|
||||||
|
@ -888,6 +888,7 @@ napi_value JsiDeclarativeEngineInstance::GetContextValue()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_map<std::string, NamedRouterProperty> JsiDeclarativeEngine::namedRouterRegisterMap_;
|
std::unordered_map<std::string, NamedRouterProperty> JsiDeclarativeEngine::namedRouterRegisterMap_;
|
||||||
|
panda::Global<panda::ObjectRef> JsiDeclarativeEngine::obj_;
|
||||||
|
|
||||||
// -----------------------
|
// -----------------------
|
||||||
// Start JsiDeclarativeEngine
|
// Start JsiDeclarativeEngine
|
||||||
@ -1221,6 +1222,12 @@ bool JsiDeclarativeEngine::ExecuteCardAbc(const std::string& fileName, int64_t c
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool JsiDeclarativeEngine::UpdateRootComponent()
|
||||||
|
{
|
||||||
|
Framework::UpdateRootComponent(JsiDeclarativeEngine::obj_.ToLocal());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void JsiDeclarativeEngine::LoadJs(const std::string& url, const RefPtr<JsAcePage>& page, bool isMainPage)
|
void JsiDeclarativeEngine::LoadJs(const std::string& url, const RefPtr<JsAcePage>& page, bool isMainPage)
|
||||||
{
|
{
|
||||||
ACE_SCOPED_TRACE("JsiDeclarativeEngine::LoadJs url : %s", url.c_str());
|
ACE_SCOPED_TRACE("JsiDeclarativeEngine::LoadJs url : %s", url.c_str());
|
||||||
@ -1513,7 +1520,7 @@ bool JsiDeclarativeEngine::LoadNamedRouterSource(const std::string& namedRoute,
|
|||||||
shared_ptr<ArkJSRuntime> arkRuntime = std::static_pointer_cast<ArkJSRuntime>(runtime);
|
shared_ptr<ArkJSRuntime> arkRuntime = std::static_pointer_cast<ArkJSRuntime>(runtime);
|
||||||
arkRuntime->AddRootView(rootView);
|
arkRuntime->AddRootView(rootView);
|
||||||
#endif
|
#endif
|
||||||
UpdateRootComponent(ret->ToObject(vm));
|
Framework::UpdateRootComponent(ret->ToObject(vm));
|
||||||
JSViewStackProcessor::JsStopGetAccessRecording();
|
JSViewStackProcessor::JsStopGetAccessRecording();
|
||||||
LOGI("LoadNamedRouterSource name = %{public}s", namedRoute.c_str());
|
LOGI("LoadNamedRouterSource name = %{public}s", namedRoute.c_str());
|
||||||
return true;
|
return true;
|
||||||
|
@ -404,6 +404,12 @@ public:
|
|||||||
const std::string& namedRoute, panda::Local<panda::ObjectRef> params);
|
const std::string& namedRoute, panda::Local<panda::ObjectRef> params);
|
||||||
bool LoadNamedRouterSource(const std::string& namedRoute, bool isTriggeredByJs) override;
|
bool LoadNamedRouterSource(const std::string& namedRoute, bool isTriggeredByJs) override;
|
||||||
std::string SearchRouterRegisterMap(const std::string& pageName) override;
|
std::string SearchRouterRegisterMap(const std::string& pageName) override;
|
||||||
|
bool UpdateRootComponent() override;
|
||||||
|
static void SetEntryObject(const panda::Global<panda::ObjectRef>& obj)
|
||||||
|
{
|
||||||
|
obj_ = obj;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool CallAppFunc(const std::string& appFuncName);
|
bool CallAppFunc(const std::string& appFuncName);
|
||||||
|
|
||||||
@ -441,6 +447,7 @@ private:
|
|||||||
std::string pluginModuleName_;
|
std::string pluginModuleName_;
|
||||||
static std::unordered_map<std::string, NamedRouterProperty> namedRouterRegisterMap_;
|
static std::unordered_map<std::string, NamedRouterProperty> namedRouterRegisterMap_;
|
||||||
bool isFirstCallShow_ = true;
|
bool isFirstCallShow_ = true;
|
||||||
|
static panda::Global<panda::ObjectRef> obj_;
|
||||||
ACE_DISALLOW_COPY_AND_MOVE(JsiDeclarativeEngine);
|
ACE_DISALLOW_COPY_AND_MOVE(JsiDeclarativeEngine);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -221,14 +221,14 @@ panda::Local<panda::JSValueRef> JsLoadDocument(panda::JsiRuntimeCallInfo* runtim
|
|||||||
return panda::JSValueRef::Undefined(vm);
|
return panda::JSValueRef::Undefined(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
panda::Local<panda::ObjectRef> obj = firstArg->ToObject(vm);
|
panda::Global<panda::ObjectRef> obj(vm, Local<panda::ObjectRef>(firstArg));
|
||||||
|
JsiDeclarativeEngine::SetEntryObject(obj);
|
||||||
#if defined(PREVIEW)
|
#if defined(PREVIEW)
|
||||||
panda::Global<panda::ObjectRef> rootView(vm, obj->ToObject(vm));
|
panda::Global<panda::ObjectRef> rootView(vm, obj->ToObject(vm));
|
||||||
auto runtime = JsiDeclarativeEngineInstance::GetCurrentRuntime();
|
auto runtime = JsiDeclarativeEngineInstance::GetCurrentRuntime();
|
||||||
shared_ptr<ArkJSRuntime> arkRuntime = std::static_pointer_cast<ArkJSRuntime>(runtime);
|
shared_ptr<ArkJSRuntime> arkRuntime = std::static_pointer_cast<ArkJSRuntime>(runtime);
|
||||||
arkRuntime->AddRootView(rootView);
|
arkRuntime->AddRootView(rootView);
|
||||||
#endif
|
#endif
|
||||||
UpdateRootComponent(obj);
|
|
||||||
|
|
||||||
return panda::JSValueRef::Undefined(vm);
|
return panda::JSValueRef::Undefined(vm);
|
||||||
}
|
}
|
||||||
|
@ -798,11 +798,13 @@ void FrontendDelegateDeclarative::GetStageSourceMap(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FrontendDelegateDeclarative::InitializeRouterManager(
|
void FrontendDelegateDeclarative::InitializeRouterManager(
|
||||||
NG::LoadPageCallback&& loadPageCallback, NG::LoadNamedRouterCallback&& loadNamedRouterCallback)
|
NG::LoadPageCallback&& loadPageCallback, NG::LoadNamedRouterCallback&& loadNamedRouterCallback,
|
||||||
|
NG::UpdateRootComponentCallback&& updateRootComponentCallback)
|
||||||
{
|
{
|
||||||
pageRouterManager_ = AceType::MakeRefPtr<NG::PageRouterManager>();
|
pageRouterManager_ = AceType::MakeRefPtr<NG::PageRouterManager>();
|
||||||
pageRouterManager_->SetLoadJsCallback(std::move(loadPageCallback));
|
pageRouterManager_->SetLoadJsCallback(std::move(loadPageCallback));
|
||||||
pageRouterManager_->SetLoadNamedRouterCallback(std::move(loadNamedRouterCallback));
|
pageRouterManager_->SetLoadNamedRouterCallback(std::move(loadNamedRouterCallback));
|
||||||
|
pageRouterManager_->SetUpdateRootComponentCallback(std::move(updateRootComponentCallback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start FrontendDelegate overrides.
|
// Start FrontendDelegate overrides.
|
||||||
|
@ -308,7 +308,8 @@ public:
|
|||||||
std::unordered_map<std::string, RefPtr<Framework::RevSourceMap>>& sourceMap);
|
std::unordered_map<std::string, RefPtr<Framework::RevSourceMap>>& sourceMap);
|
||||||
|
|
||||||
void InitializeRouterManager(
|
void InitializeRouterManager(
|
||||||
NG::LoadPageCallback&& loadPageCallback, NG::LoadNamedRouterCallback&& loadNamedRouterCallback);
|
NG::LoadPageCallback&& loadPageCallback, NG::LoadNamedRouterCallback&& loadNamedRouterCallback,
|
||||||
|
NG::UpdateRootComponentCallback&& updateRootComponentCallback);
|
||||||
|
|
||||||
const RefPtr<NG::PageRouterManager>& GetPageRouterManager() const
|
const RefPtr<NG::PageRouterManager>& GetPageRouterManager() const
|
||||||
{
|
{
|
||||||
|
@ -226,8 +226,17 @@ void DeclarativeFrontendNG::InitializeDelegate(const RefPtr<TaskExecutor>& taskE
|
|||||||
return jsEngine->LoadNamedRouterSource(namedRouter, isTriggeredByJs);
|
return jsEngine->LoadNamedRouterSource(namedRouter, isTriggeredByJs);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto updateRootComponentCallback = [weakEngine = WeakPtr<Framework::JsEngine>(jsEngine_)]() {
|
||||||
|
auto jsEngine = weakEngine.Upgrade();
|
||||||
|
if (!jsEngine) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return jsEngine->UpdateRootComponent();
|
||||||
|
};
|
||||||
|
|
||||||
pageRouterManager->SetLoadJsCallback(std::move(loadPageCallback));
|
pageRouterManager->SetLoadJsCallback(std::move(loadPageCallback));
|
||||||
pageRouterManager->SetLoadNamedRouterCallback(std::move(loadNamedRouterCallback));
|
pageRouterManager->SetLoadNamedRouterCallback(std::move(loadNamedRouterCallback));
|
||||||
|
pageRouterManager->SetUpdateRootComponentCallback(std::move(updateRootComponentCallback));
|
||||||
|
|
||||||
delegate_ = AceType::MakeRefPtr<Framework::FrontendDelegateDeclarativeNG>(taskExecutor);
|
delegate_ = AceType::MakeRefPtr<Framework::FrontendDelegateDeclarativeNG>(taskExecutor);
|
||||||
delegate_->SetMediaQueryCallback(std::move(mediaQueryCallback));
|
delegate_->SetMediaQueryCallback(std::move(mediaQueryCallback));
|
||||||
|
@ -916,22 +916,27 @@ void PageRouterManager::LoadPage(int32_t pageId, const RouterPageInfo& target, b
|
|||||||
FrameNode::CreateFrameNode(V2::PAGE_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(), pagePattern);
|
FrameNode::CreateFrameNode(V2::PAGE_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(), pagePattern);
|
||||||
pageNode->SetHostPageId(pageId);
|
pageNode->SetHostPageId(pageId);
|
||||||
pageRouterStack_.emplace_back(pageNode);
|
pageRouterStack_.emplace_back(pageNode);
|
||||||
auto result = loadJs_(target.path, target.errorCallback);
|
|
||||||
if (pageNode->GetChildren().empty()) {
|
loadJs_(target.path, target.errorCallback);
|
||||||
// try to load named route
|
auto result = loadNamedRouter_(target.url, target.isNamedRouterMode);
|
||||||
result = loadNamedRouter_(target.url, target.isNamedRouterMode);
|
if (!result) {
|
||||||
if (!result && target.isNamedRouterMode && target.errorCallback) {
|
if (!target.isNamedRouterMode) {
|
||||||
|
result = updateRootComponent_();
|
||||||
|
} else if (target.errorCallback) {
|
||||||
target.errorCallback("The named route is not exist.", Framework::ERROR_CODE_NAMED_ROUTE_ERROR);
|
target.errorCallback("The named route is not exist.", Framework::ERROR_CODE_NAMED_ROUTE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (target.errorCallback != nullptr) {
|
|
||||||
target.errorCallback("", Framework::ERROR_CODE_NO_ERROR);
|
|
||||||
}
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
LOGE("fail to load page file");
|
LOGE("fail to load page file");
|
||||||
pageRouterStack_.pop_back();
|
pageRouterStack_.pop_back();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (target.errorCallback != nullptr) {
|
||||||
|
target.errorCallback("", Framework::ERROR_CODE_NO_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
if (!OnPageReady(pageNode, needHideLast, needTransition)) {
|
if (!OnPageReady(pageNode, needHideLast, needTransition)) {
|
||||||
LOGE("fail to mount page");
|
LOGE("fail to mount page");
|
||||||
pageRouterStack_.pop_back();
|
pageRouterStack_.pop_back();
|
||||||
|
@ -35,6 +35,7 @@ using LoadPageCallback = std::function<bool(const std::string&,
|
|||||||
const std::function<void(const std::string&, int32_t)>&)>;
|
const std::function<void(const std::string&, int32_t)>&)>;
|
||||||
using LoadCardCallback = std::function<bool(const std::string&, int64_t cardId)>;
|
using LoadCardCallback = std::function<bool(const std::string&, int64_t cardId)>;
|
||||||
using LoadNamedRouterCallback = std::function<bool(const std::string&, bool isTriggeredByJs)>;
|
using LoadNamedRouterCallback = std::function<bool(const std::string&, bool isTriggeredByJs)>;
|
||||||
|
using UpdateRootComponentCallback = std::function<bool()>;
|
||||||
|
|
||||||
enum class RouterMode {
|
enum class RouterMode {
|
||||||
STANDARD = 0,
|
STANDARD = 0,
|
||||||
@ -80,6 +81,11 @@ public:
|
|||||||
loadNamedRouter_ = callback;
|
loadNamedRouter_ = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetUpdateRootComponentCallback(UpdateRootComponentCallback&& callback)
|
||||||
|
{
|
||||||
|
updateRootComponent_ = callback;
|
||||||
|
}
|
||||||
|
|
||||||
void EnableAlertBeforeBackPage(const std::string& message, std::function<void(int32_t)>&& callback);
|
void EnableAlertBeforeBackPage(const std::string& message, std::function<void(int32_t)>&& callback);
|
||||||
|
|
||||||
void DisableAlertBeforeBackPage();
|
void DisableAlertBeforeBackPage();
|
||||||
@ -178,6 +184,7 @@ private:
|
|||||||
LoadPageCallback loadJs_;
|
LoadPageCallback loadJs_;
|
||||||
LoadCardCallback loadCard_;
|
LoadCardCallback loadCard_;
|
||||||
LoadNamedRouterCallback loadNamedRouter_;
|
LoadNamedRouterCallback loadNamedRouter_;
|
||||||
|
UpdateRootComponentCallback updateRootComponent_;
|
||||||
bool isCardRouter_ = false;
|
bool isCardRouter_ = false;
|
||||||
int32_t pageId_ = 0;
|
int32_t pageId_ = 0;
|
||||||
std::list<WeakPtr<FrameNode>> pageRouterStack_;
|
std::list<WeakPtr<FrameNode>> pageRouterStack_;
|
||||||
|
@ -130,6 +130,11 @@ public:
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool UpdateRootComponent()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Update running page
|
// Update running page
|
||||||
virtual void UpdateRunningPage(const RefPtr<JsAcePage>& page) = 0;
|
virtual void UpdateRunningPage(const RefPtr<JsAcePage>& page) = 0;
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "core/components_ng/base/distributed_ui.h"
|
#include "core/components_ng/base/distributed_ui.h"
|
||||||
#include "core/components_ng/pattern/navigator/navigator_event_hub.h"
|
#include "core/components_ng/pattern/navigator/navigator_event_hub.h"
|
||||||
#include "core/pipeline/pipeline_base.h"
|
#include "core/pipeline/pipeline_base.h"
|
||||||
|
#include "interfaces/inner_api/ace/ace_forward_compatibility.h"
|
||||||
|
|
||||||
namespace OHOS::Ace {
|
namespace OHOS::Ace {
|
||||||
|
|
||||||
@ -247,7 +248,7 @@ public:
|
|||||||
static bool IsCurrentUseNewPipeline()
|
static bool IsCurrentUseNewPipeline()
|
||||||
{
|
{
|
||||||
auto container = Current();
|
auto container = Current();
|
||||||
return container ? container->useNewPipeline_ : false;
|
return container ? container->useNewPipeline_ : AceForwardCompatibility::IsUseNG();
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetCurrentUsePartialUpdate is called when initial render on a page
|
// SetCurrentUsePartialUpdate is called when initial render on a page
|
||||||
|
@ -99,6 +99,7 @@ ohos_unittest("event_manager_test_ng") {
|
|||||||
"$ace_root/test/mock/core/common/mock_container.cpp",
|
"$ace_root/test/mock/core/common/mock_container.cpp",
|
||||||
"$ace_root/test/mock/core/common/mock_flutter_window.cpp",
|
"$ace_root/test/mock/core/common/mock_flutter_window.cpp",
|
||||||
"$ace_root/test/mock/core/common/mock_window.cpp",
|
"$ace_root/test/mock/core/common/mock_window.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
"event_manager_test_ng.cpp",
|
"event_manager_test_ng.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -236,6 +236,7 @@ ohos_unittest("navigation_test_ng") {
|
|||||||
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
|
"$ace_root/test/mock/core/common/mock_font_manager_ng.cpp",
|
||||||
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
|
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
|
||||||
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
|
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
"$ace_root/test/unittest/core/pipeline/mock_overlay_manager.cpp",
|
"$ace_root/test/unittest/core/pipeline/mock_overlay_manager.cpp",
|
||||||
"bar_item_test_ng.cpp",
|
"bar_item_test_ng.cpp",
|
||||||
"nav_bar_test_ng.cpp",
|
"nav_bar_test_ng.cpp",
|
||||||
|
@ -55,9 +55,7 @@ void AceForwardCompatibility::Init(const std::string& bundleName, const uint32_t
|
|||||||
isForceOldPipeline_ = true;
|
isForceOldPipeline_ = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
isNewPipeline_ = !isForceOldPipeline_
|
isNewPipeline_ = (apiCompatibleVersion >= ARKUI_NEW_PIPELINE_MIN_VERSION) && !deprecated;
|
||||||
&& (apiCompatibleVersion >= ARKUI_NEW_PIPELINE_MIN_VERSION)
|
|
||||||
&& !deprecated;
|
|
||||||
isInited_ = true;
|
isInited_ = true;
|
||||||
LOGI("AceForwardCompatibility [%{public}s] force:%{public}d newpipe:%{public}d",
|
LOGI("AceForwardCompatibility [%{public}s] force:%{public}d newpipe:%{public}d",
|
||||||
bundleName.c_str(), isForceOldPipeline_, isNewPipeline_);
|
bundleName.c_str(), isForceOldPipeline_, isNewPipeline_);
|
||||||
@ -78,12 +76,17 @@ bool AceForwardCompatibility::IsForceOldPipeline()
|
|||||||
bool AceForwardCompatibility::IsNewPipeline()
|
bool AceForwardCompatibility::IsNewPipeline()
|
||||||
{
|
{
|
||||||
if (isInited_) {
|
if (isInited_) {
|
||||||
return isNewPipeline_;
|
return isNewPipeline_ && !isForceOldPipeline_;
|
||||||
}
|
}
|
||||||
isNewAppspawn_ = !IsForceOldPipeline();
|
isNewAppspawn_ = !IsForceOldPipeline();
|
||||||
return !IsForceOldPipeline();
|
return !IsForceOldPipeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AceForwardCompatibility::IsUseNG()
|
||||||
|
{
|
||||||
|
return isNewPipeline_;
|
||||||
|
}
|
||||||
|
|
||||||
const char* AceForwardCompatibility::GetAceLibName()
|
const char* AceForwardCompatibility::GetAceLibName()
|
||||||
{
|
{
|
||||||
const char* libName;
|
const char* libName;
|
||||||
@ -98,7 +101,7 @@ const char* AceForwardCompatibility::GetAceLibName()
|
|||||||
|
|
||||||
bool AceForwardCompatibility::PipelineChanged()
|
bool AceForwardCompatibility::PipelineChanged()
|
||||||
{
|
{
|
||||||
return isNewPipeline_ != isNewAppspawn_;
|
return (isNewPipeline_ && !isForceOldPipeline_) != isNewAppspawn_;
|
||||||
}
|
}
|
||||||
} // namespace Ace
|
} // namespace Ace
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -29,7 +29,8 @@ public:
|
|||||||
static void Init(const std::string& bundleName, const uint32_t apiCompatibleVersion, bool deprecated);
|
static void Init(const std::string& bundleName, const uint32_t apiCompatibleVersion, bool deprecated);
|
||||||
static bool Inited();
|
static bool Inited();
|
||||||
static bool IsForceOldPipeline();
|
static bool IsForceOldPipeline();
|
||||||
static bool IsNewPipeline();
|
static bool IsNewPipeline(); // true for using libace, false for using libace_compatible
|
||||||
|
static bool IsUseNG(); // true for using newpipeline in ace engine
|
||||||
static bool PipelineChanged();
|
static bool PipelineChanged();
|
||||||
static const char* GetAceLibName();
|
static const char* GetAceLibName();
|
||||||
private:
|
private:
|
||||||
|
@ -77,13 +77,14 @@ ohos_fuzztest("AceResKeyParserFuzzTest") {
|
|||||||
|
|
||||||
# mock
|
# mock
|
||||||
#"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
|
#"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
|
|
||||||
#fuzz
|
#fuzz
|
||||||
"$ace_root/test/fuzztest/acereskeyparser_fuzzer/acereskeyparser_fuzzer.cpp",
|
|
||||||
"$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
|
"$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
|
||||||
"$ace_root/adapter/ohos/osal/system_properties.cpp",
|
"$ace_root/adapter/ohos/osal/system_properties.cpp",
|
||||||
"$ace_root/frameworks/base/resource/ace_res_key_parser.cpp",
|
"$ace_root/frameworks/base/resource/ace_res_key_parser.cpp",
|
||||||
"$ace_root/frameworks/core/common/flutter/flutter_asset_manager.cpp",
|
"$ace_root/frameworks/core/common/flutter/flutter_asset_manager.cpp",
|
||||||
|
"$ace_root/test/fuzztest/acereskeyparser_fuzzer/acereskeyparser_fuzzer.cpp",
|
||||||
|
|
||||||
#"$ace_root/frameworks/base/log/ace_trace.cpp",
|
#"$ace_root/frameworks/base/log/ace_trace.cpp",
|
||||||
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
|
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
|
||||||
|
@ -75,6 +75,7 @@ ohos_fuzztest("ImageApiFuzzTest") {
|
|||||||
"$ace_root/frameworks/core/common/frontend.cpp",
|
"$ace_root/frameworks/core/common/frontend.cpp",
|
||||||
"$ace_root/frameworks/core/common/thread_checker.cpp",
|
"$ace_root/frameworks/core/common/thread_checker.cpp",
|
||||||
"$ace_root/frameworks/core/common/window.cpp",
|
"$ace_root/frameworks/core/common/window.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
|
|
||||||
# event
|
# event
|
||||||
"$ace_root/frameworks/core/common/test/mock/mock_watch_dog.cpp",
|
"$ace_root/frameworks/core/common/test/mock/mock_watch_dog.cpp",
|
||||||
|
@ -83,6 +83,7 @@ ohos_fuzztest("ImageLoaderFuzzTest") {
|
|||||||
"$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_skia_image_data.cpp",
|
"$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_skia_image_data.cpp",
|
||||||
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_skia_image.cpp",
|
"$ace_root/frameworks/core/components_ng/test/mock/render/mock_skia_image.cpp",
|
||||||
"$ace_root/test/mock/adapter/mock_file_uri_helper_ohos.cpp",
|
"$ace_root/test/mock/adapter/mock_file_uri_helper_ohos.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
|
|
||||||
#fuzz
|
#fuzz
|
||||||
"$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
|
"$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
|
||||||
|
@ -67,6 +67,7 @@ ohos_fuzztest("ManifestFuzzTest") {
|
|||||||
"$ace_root/frameworks/core/common/frontend.cpp",
|
"$ace_root/frameworks/core/common/frontend.cpp",
|
||||||
"$ace_root/frameworks/core/common/thread_checker.cpp",
|
"$ace_root/frameworks/core/common/thread_checker.cpp",
|
||||||
"$ace_root/frameworks/core/common/window.cpp",
|
"$ace_root/frameworks/core/common/window.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
|
|
||||||
# event
|
# event
|
||||||
"$ace_root/frameworks/core/common/test/mock/mock_watch_dog.cpp",
|
"$ace_root/frameworks/core/common/test/mock/mock_watch_dog.cpp",
|
||||||
|
@ -77,14 +77,15 @@ ohos_fuzztest("Res2FuzzTest") {
|
|||||||
|
|
||||||
# mock
|
# mock
|
||||||
#"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
|
#"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
|
|
||||||
#fuzz
|
#fuzz
|
||||||
"$ace_root/test/fuzztest/res2_fuzzer/res2_fuzzer.cpp",
|
|
||||||
"$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
|
"$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
|
||||||
"$ace_root/adapter/ohos/osal/system_properties.cpp",
|
"$ace_root/adapter/ohos/osal/system_properties.cpp",
|
||||||
"$ace_root/frameworks/base/resource/ace_res_config.cpp",
|
"$ace_root/frameworks/base/resource/ace_res_config.cpp",
|
||||||
"$ace_root/frameworks/base/resource/ace_res_key_parser.cpp",
|
"$ace_root/frameworks/base/resource/ace_res_key_parser.cpp",
|
||||||
"$ace_root/frameworks/core/common/flutter/flutter_asset_manager.cpp",
|
"$ace_root/frameworks/core/common/flutter/flutter_asset_manager.cpp",
|
||||||
|
"$ace_root/test/fuzztest/res2_fuzzer/res2_fuzzer.cpp",
|
||||||
|
|
||||||
#"$ace_root/frameworks/base/log/ace_trace.cpp",
|
#"$ace_root/frameworks/base/log/ace_trace.cpp",
|
||||||
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
|
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
|
||||||
|
@ -76,13 +76,14 @@ ohos_fuzztest("SharedImageManagerFuzzTest") {
|
|||||||
|
|
||||||
# mock
|
# mock
|
||||||
#"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
|
#"$ace_root/frameworks/base/test/mock/mock_system_properties.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
|
|
||||||
#fuzz
|
#fuzz
|
||||||
"$ace_root/test/fuzztest/sharedimagemanager_fuzzer/sharedimagemanager_fuzzer.cpp",
|
|
||||||
"$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
|
"$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
|
||||||
"$ace_root/adapter/ohos/osal/system_properties.cpp",
|
"$ace_root/adapter/ohos/osal/system_properties.cpp",
|
||||||
"$ace_root/frameworks/base/resource/shared_image_manager.cpp",
|
"$ace_root/frameworks/base/resource/shared_image_manager.cpp",
|
||||||
"$ace_root/frameworks/core/common/flutter/flutter_asset_manager.cpp",
|
"$ace_root/frameworks/core/common/flutter/flutter_asset_manager.cpp",
|
||||||
|
"$ace_root/test/fuzztest/sharedimagemanager_fuzzer/sharedimagemanager_fuzzer.cpp",
|
||||||
|
|
||||||
#"$ace_root/frameworks/base/log/ace_trace.cpp",
|
#"$ace_root/frameworks/base/log/ace_trace.cpp",
|
||||||
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
|
"$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
|
||||||
|
@ -39,6 +39,7 @@ ohos_fuzztest("UtilEngineFuzzTest") {
|
|||||||
"$ace_root/frameworks/bridge/js_frontend/engine/common/js_engine_loader.cpp",
|
"$ace_root/frameworks/bridge/js_frontend/engine/common/js_engine_loader.cpp",
|
||||||
"$ace_root/frameworks/core/components/test/unittest/mock/subwindow_mock.cpp",
|
"$ace_root/frameworks/core/components/test/unittest/mock/subwindow_mock.cpp",
|
||||||
"$ace_root/test/mock/core/common/mock_container.cpp",
|
"$ace_root/test/mock/core/common/mock_container.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
"//third_party/cJSON/cJSON.c",
|
"//third_party/cJSON/cJSON.c",
|
||||||
"utilengine_fuzzer.cpp",
|
"utilengine_fuzzer.cpp",
|
||||||
]
|
]
|
||||||
|
23
test/mock/interfaces/mock_ace_forward_compatibility.cpp
Normal file
23
test/mock/interfaces/mock_ace_forward_compatibility.cpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "interfaces/inner_api/ace/ace_forward_compatibility.h"
|
||||||
|
|
||||||
|
namespace OHOS::Ace {
|
||||||
|
bool AceForwardCompatibility::IsUseNG()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} // namespace OHOS::Ace
|
@ -424,6 +424,7 @@ source_set("ace_components_mock") {
|
|||||||
"$ace_root/test/mock/core/common/mock_container.cpp",
|
"$ace_root/test/mock/core/common/mock_container.cpp",
|
||||||
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
|
"$ace_root/test/mock/core/render/mock_font_collection.cpp",
|
||||||
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
|
"$ace_root/test/mock/core/render/mock_paragraph.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
]
|
]
|
||||||
deps = [ "//third_party/googletest:gmock_main" ]
|
deps = [ "//third_party/googletest:gmock_main" ]
|
||||||
configs += [ ":ace_unittest_config" ]
|
configs += [ ":ace_unittest_config" ]
|
||||||
|
@ -48,6 +48,7 @@ ohos_unittest("canvas_renderer_test_ng") {
|
|||||||
"$ace_root/test/mock/adapter/mock_ace_container.cpp",
|
"$ace_root/test/mock/adapter/mock_ace_container.cpp",
|
||||||
"$ace_root/test/mock/adapter/mock_mmi_event_convertor.cpp",
|
"$ace_root/test/mock/adapter/mock_mmi_event_convertor.cpp",
|
||||||
"$ace_root/test/mock/core/common/mock_udmf.cpp",
|
"$ace_root/test/mock/core/common/mock_udmf.cpp",
|
||||||
|
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (is_ohos_standard_system) {
|
if (is_ohos_standard_system) {
|
||||||
|
Loading…
Reference in New Issue
Block a user