float: Fix some tests that fail when feature is enabled p2.
RootWindowControllerTest.DontDeleteWindowsNotOwnedByParent fails if dangling raw pointer checks are enabled. It is because float containers workspace event handler is not removed at the same time as the others. After this is test is fixed, we can enable the feature flag. Bug: b/275562398 Test: existing tests Change-Id: I8dc8c172fa0d38429f330502257d152dfaa1bd7a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4024210 Commit-Queue: Sammie Quon <sammiequon@chromium.org> Reviewed-by: Ahmed Fakhry <afakhry@chromium.org> Cr-Commit-Position: refs/heads/main@{#1123298}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
742771e7a5
commit
f36b5413ba
@ -57,6 +57,7 @@
|
||||
#include "ash/wm/container_finder.h"
|
||||
#include "ash/wm/desks/desks_controller.h"
|
||||
#include "ash/wm/desks/desks_util.h"
|
||||
#include "ash/wm/float/float_controller.h"
|
||||
#include "ash/wm/fullscreen_window_finder.h"
|
||||
#include "ash/wm/lock_action_handler_layout_manager.h"
|
||||
#include "ash/wm/lock_layout_manager.h"
|
||||
@ -338,6 +339,9 @@ void ClearWorkspaceControllers(aura::Window* root) {
|
||||
for (auto* desk_container : desks_util::GetDesksContainers(root)) {
|
||||
SetWorkspaceController(desk_container, nullptr);
|
||||
}
|
||||
if (auto* float_controller = Shell::Get()->float_controller()) {
|
||||
float_controller->ClearWorkspaceEventHandler(root);
|
||||
}
|
||||
}
|
||||
|
||||
class RootWindowTargeter : public aura::WindowTargeter {
|
||||
|
@ -632,6 +632,10 @@ void FloatController::OnMovingFloatedWindowToDesk(aura::Window* floated_window,
|
||||
target_desk->NotifyContentChanged();
|
||||
}
|
||||
|
||||
void FloatController::ClearWorkspaceEventHandler(aura::Window* root) {
|
||||
workspace_event_handlers_.erase(root);
|
||||
}
|
||||
|
||||
void FloatController::OnTabletModeStarted() {
|
||||
DCHECK(!floated_window_info_map_.empty());
|
||||
// If a window can still remain floated, update its bounds, otherwise unfloat
|
||||
@ -724,14 +728,6 @@ void FloatController::OnRootWindowAdded(aura::Window* root_window) {
|
||||
->SetLayoutManager(std::make_unique<FloatLayoutManager>());
|
||||
}
|
||||
|
||||
void FloatController::OnRootWindowWillShutdown(aura::Window* root_window) {
|
||||
workspace_event_handlers_.erase(root_window);
|
||||
}
|
||||
|
||||
void FloatController::OnShellDestroying() {
|
||||
workspace_event_handlers_.clear();
|
||||
}
|
||||
|
||||
void FloatController::ToggleFloat(aura::Window* window) {
|
||||
WindowState* window_state = WindowState::Get(window);
|
||||
const WMEvent toggle_event(window_state->IsFloated() ? WM_EVENT_RESTORE
|
||||
|
@ -114,6 +114,8 @@ class ASH_EXPORT FloatController : public TabletModeObserver,
|
||||
Desk* target_desk,
|
||||
aura::Window* target_root);
|
||||
|
||||
void ClearWorkspaceEventHandler(aura::Window* root);
|
||||
|
||||
// TabletModeObserver:
|
||||
void OnTabletModeStarted() override;
|
||||
void OnTabletModeEnding() override;
|
||||
@ -129,8 +131,6 @@ class ASH_EXPORT FloatController : public TabletModeObserver,
|
||||
|
||||
// ShellObserver:
|
||||
void OnRootWindowAdded(aura::Window* root_window) override;
|
||||
void OnRootWindowWillShutdown(aura::Window* root_window) override;
|
||||
void OnShellDestroying() override;
|
||||
|
||||
// chromeos::FloatControllerBase:
|
||||
void ToggleFloat(aura::Window* window) override;
|
||||
|
Reference in New Issue
Block a user