diff --git a/previewer/BUILD.gn b/previewer/BUILD.gn index 336f4f6caf673414c8b86f49eba7d0085b79fcae..6e7f8d41fbe0a6fdd68473cd4d7a6329178cf6e7 100644 --- a/previewer/BUILD.gn +++ b/previewer/BUILD.gn @@ -118,7 +118,6 @@ if (!ispreview) { "../interfaces/kits/napi/window_runtime/window_napi/js_window.cpp", "../interfaces/kits/napi/window_runtime/window_napi/js_window_utils.cpp", "../interfaces/kits/napi/window_runtime/window_stage_napi/js_window_stage.cpp", - "../utils/src/window_manager_hilog.cpp", # mock "mock/js_transition_controller.cpp", @@ -128,6 +127,9 @@ if (!ispreview) { "mock/pixel_map_napi.cpp", "mock/window_manager_napi/js_window_manager.cpp", "mock/window_manager_napi/window_manager_module.cpp", + + # utils + "../utils/src/window_manager_hilog.cpp", ] include_dirs = [ @@ -188,7 +190,7 @@ if (!ispreview) { "/window/window_manager/libpreviewer_window" + suffix ] deps = [ ":previewer_window" ] - if (current_os == "mingw" || current_os == "mac") { + if (current_os == "mingw" || current_os == "mac" || current_os == "linux") { deps += [ ":window_stage_copy_modules" ] shared_library_path = get_label_info(":previewer_window_napi", "root_out_dir") diff --git a/previewer/include/vsync_station.h b/previewer/include/vsync_station.h index 7daa42872187029d45cc44ec67e5d47b6d88f0ce..0a5e8c58b5be801c9ce923bb89860b8e6274fff9 100644 --- a/previewer/include/vsync_station.h +++ b/previewer/include/vsync_station.h @@ -36,8 +36,11 @@ public: explicit VsyncStation(NodeId nodeId); ~VsyncStation() { - std::lock_guard lock(mtx_); - destroyed_ = true; + { + std::lock_guard lock(mtx_); + destroyed_ = true; + } + receiver_.reset(); } void RequestVsync(const std::shared_ptr& vsyncCallback); @@ -65,4 +68,4 @@ private: }; } // namespace Rosen } // namespace OHOS -#endif // OHOS_VSYNC_STATION_H \ No newline at end of file +#endif // OHOS_VSYNC_STATION_H diff --git a/previewer/include/window.h b/previewer/include/window.h index acc37486b1cc78323716758dded787eaf119a133..dbbabab02f4211baa85805e2ead2028d2b5cb427 100644 --- a/previewer/include/window.h +++ b/previewer/include/window.h @@ -427,7 +427,7 @@ public: virtual WMError IsMainWindowFullScreenAcrossDisplays( bool& isAcrossDisplays) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } virtual float GetVirtualPixelRatio() { return 1.0f; } - virtual void UpdateAvoidArea(const sptr& avoidArea, AvoidAreaType type); + virtual void UpdateAvoidArea(const sptr& avoidArea, AvoidAreaType type) = 0; virtual void CreateSurfaceNode(const std::string name, const SendRenderDataCallback& callback) = 0; virtual void SetContentInfoCallback(const ContentInfoCallback& callback) = 0; virtual WMError SetResizeByDragEnabled(bool dragEnabled) = 0; diff --git a/previewer/src/window_impl.cpp b/previewer/src/window_impl.cpp index c4ff86be053108efcdc9b6ef06b67716daf9aa96..595cdc2ac6b466fece6aae03660e693b9d52fb44 100644 --- a/previewer/src/window_impl.cpp +++ b/previewer/src/window_impl.cpp @@ -54,7 +54,6 @@ WindowImpl::~WindowImpl() { WLOGFI("windowName: %{public}s, windowId: %{public}d, deConstructorCnt: %{public}d", GetWindowName().c_str(), GetWindowId(), ++deConstructorCnt); - Destroy(); } void WindowImpl::CreateSurfaceNode(const std::string name, const SendRenderDataCallback& callback) diff --git a/previewer/src/window_scene.cpp b/previewer/src/window_scene.cpp index f1f4a796723bd91f152e7086e54ac4265cd6ef27..f06a63692a9ebc32d107bea378ef89bbdc6076a1 100644 --- a/previewer/src/window_scene.cpp +++ b/previewer/src/window_scene.cpp @@ -29,6 +29,9 @@ constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowS } WindowScene::~WindowScene() { + if (mainWindow_ != nullptr) { + mainWindow_->Destroy(); + } } WMError WindowScene::Init(DisplayId displayId, const std::shared_ptr& context, diff --git a/previewer/window_stage_modules/BUILD.gn b/previewer/window_stage_modules/BUILD.gn index 7adc8f747e822059a4d354e6f415d2d5655b5a83..dc5c57446d71559ea8fb8e0b8e91a0137431e189 100644 --- a/previewer/window_stage_modules/BUILD.gn +++ b/previewer/window_stage_modules/BUILD.gn @@ -29,7 +29,7 @@ template("gen_js_src_binary") { gen_obj(target_name + "_js") { input = invoker.js_source - if (is_mac || is_mingw) { + if (is_mac || is_mingw || is_linux) { output = target_out_dir + "/" + invoker.target_name + "_js.c" } else { output = target_out_dir + "/" + invoker.target_name + "_js.o" @@ -43,7 +43,7 @@ template("gen_js_src_binary") { get_label_info(":gen_abc_" + invoker.target_name, "target_out_dir") + "/" + get_path_info(invoker.js_source, "name") + ".abc" - if (is_mac || is_mingw) { + if (is_mac || is_mingw || is_linux) { output = target_out_dir + "/" + invoker.target_name + "_abc.c" } else { output = target_out_dir + "/" + invoker.target_name + "_abc.o"