Commit 8f5209c8 authored by oshima@chromium.org's avatar oshima@chromium.org

Remove dispatcher when shutting down RootWindowController

Resurrecting PrepareForShutdown as it can be implemented onl in ash.

BUG=None

Review URL: https://codereview.chromium.org/294073006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272308 0039d316-1c4b-4281-b951-d872f2087c98
parent 78cd68e0
...@@ -210,13 +210,6 @@ void MouseCursorEventFilter::OnDisplayConfigurationChanged() { ...@@ -210,13 +210,6 @@ void MouseCursorEventFilter::OnDisplayConfigurationChanged() {
void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) { void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) {
aura::Window* target = static_cast<aura::Window*>(event->target()); aura::Window* target = static_cast<aura::Window*>(event->target());
RootWindowController* rwc = GetRootWindowController(target->GetRootWindow());
// The root window controller is removed during the shutting down
// RootWindow, so don't process events futher.
if (!rwc) {
event->StopPropagation();
return;
}
if (event->type() == ui::ET_MOUSE_PRESSED) { if (event->type() == ui::ET_MOUSE_PRESSED) {
scale_when_drag_started_ = ui::GetDeviceScaleFactor(target->layer()); scale_when_drag_started_ = ui::GetDeviceScaleFactor(target->layer());
......
...@@ -235,12 +235,11 @@ gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const { ...@@ -235,12 +235,11 @@ gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const {
if (!root_window) if (!root_window)
return GetPrimaryDisplay(); return GetPrimaryDisplay();
const RootWindowSettings* rws = GetRootWindowSettings(root_window); const RootWindowSettings* rws = GetRootWindowSettings(root_window);
if (rws->shutdown)
return GetPrimaryDisplay();
int64 id = rws->display_id; int64 id = rws->display_id;
// if id is |kInvaildDisplayID|, it's being deleted. // if id is |kInvaildDisplayID|, it's being deleted.
DCHECK(id != gfx::Display::kInvalidDisplayID); DCHECK(id != gfx::Display::kInvalidDisplayID);
if (id == gfx::Display::kInvalidDisplayID)
return GetPrimaryDisplay();
DisplayManager* display_manager = GetDisplayManager(); DisplayManager* display_manager = GetDisplayManager();
// RootWindow needs Display to determine its device scale factor // RootWindow needs Display to determine its device scale factor
......
...@@ -53,7 +53,10 @@ class ASH_EXPORT AshWindowTreeHost { ...@@ -53,7 +53,10 @@ class ASH_EXPORT AshWindowTreeHost {
// mode dual monitors case). If the root window is only associated with one // mode dual monitors case). If the root window is only associated with one
// display id, then the other id should be set to // display id, then the other id should be set to
// gfx::Display::kInvalidDisplayID. // gfx::Display::kInvalidDisplayID.
virtual void UpdateDisplayID(int64 id1, int64 id2) {}; virtual void UpdateDisplayID(int64 id1, int64 id2) {}
// Stop listening for events in preparation for shutdown.
virtual void PrepareForShutdown() {}
}; };
} // namespace ash } // namespace ash
......
...@@ -19,9 +19,11 @@ ...@@ -19,9 +19,11 @@
#include "ui/aura/client/screen_position_client.h" #include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/x/x11_util.h" #include "ui/base/x/x11_util.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/x/device_data_manager.h" #include "ui/events/x/device_data_manager.h"
#include "ui/events/x/device_list_cache_x.h" #include "ui/events/x/device_list_cache_x.h"
#include "ui/events/x/touch_factory_x11.h" #include "ui/events/x/touch_factory_x11.h"
...@@ -129,6 +131,11 @@ void AshWindowTreeHostX11::UpdateDisplayID(int64 id1, int64 id2) { ...@@ -129,6 +131,11 @@ void AshWindowTreeHostX11::UpdateDisplayID(int64 id1, int64 id2) {
display_ids_.second = id2; display_ids_.second = id2;
} }
void AshWindowTreeHostX11::PrepareForShutdown() {
if (ui::PlatformEventSource::GetInstance())
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
}
void AshWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { void AshWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) {
WindowTreeHostX11::SetBounds(bounds); WindowTreeHostX11::SetBounds(bounds);
if (pointer_barriers_) { if (pointer_barriers_) {
......
...@@ -33,6 +33,7 @@ class ASH_EXPORT AshWindowTreeHostX11 : public AshWindowTreeHost, ...@@ -33,6 +33,7 @@ class ASH_EXPORT AshWindowTreeHostX11 : public AshWindowTreeHost,
virtual gfx::Insets GetHostInsets() const OVERRIDE; virtual gfx::Insets GetHostInsets() const OVERRIDE;
virtual aura::WindowTreeHost* AsWindowTreeHost() OVERRIDE; virtual aura::WindowTreeHost* AsWindowTreeHost() OVERRIDE;
virtual void UpdateDisplayID(int64 id1, int64 id2) OVERRIDE; virtual void UpdateDisplayID(int64 id1, int64 id2) OVERRIDE;
virtual void PrepareForShutdown() OVERRIDE;
// aura::WindowTreehost: // aura::WindowTreehost:
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
......
...@@ -423,7 +423,7 @@ void RootWindowController::Shutdown() { ...@@ -423,7 +423,7 @@ void RootWindowController::Shutdown() {
// ends up with invalid display. // ends up with invalid display.
GetRootWindowSettings(root_window)->display_id = GetRootWindowSettings(root_window)->display_id =
gfx::Display::kInvalidDisplayID; gfx::Display::kInvalidDisplayID;
GetRootWindowSettings(root_window)->shutdown = true; ash_host_->PrepareForShutdown();
system_background_.reset(); system_background_.reset();
aura::client::SetScreenPositionClient(root_window, NULL); aura::client::SetScreenPositionClient(root_window, NULL);
......
...@@ -17,8 +17,7 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(RootWindowSettings, ...@@ -17,8 +17,7 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(RootWindowSettings,
RootWindowSettings::RootWindowSettings() RootWindowSettings::RootWindowSettings()
: display_id(gfx::Display::kInvalidDisplayID), : display_id(gfx::Display::kInvalidDisplayID),
controller(NULL), controller(NULL) {
shutdown(false) {
} }
RootWindowSettings* InitRootWindowSettings(aura::Window* root) { RootWindowSettings* InitRootWindowSettings(aura::Window* root) {
......
...@@ -28,9 +28,6 @@ struct RootWindowSettings { ...@@ -28,9 +28,6 @@ struct RootWindowSettings {
// RootWindowController for the root window. This may be NULL // RootWindowController for the root window. This may be NULL
// for the root window used for mirroring. // for the root window used for mirroring.
RootWindowController* controller; RootWindowController* controller;
// True if the root window has already been shutdown.
bool shutdown;
}; };
// Initializes and returns RootWindowSettings for |root|. // Initializes and returns RootWindowSettings for |root|.
......
...@@ -32,10 +32,7 @@ aura::Window* GetRootWindowMatching(const gfx::Rect& rect) { ...@@ -32,10 +32,7 @@ aura::Window* GetRootWindowMatching(const gfx::Rect& rect) {
} }
void ConvertPointToScreen(const aura::Window* window, gfx::Point* point) { void ConvertPointToScreen(const aura::Window* window, gfx::Point* point) {
// It is possible for the root window to not have a screen position client CHECK(aura::client::GetScreenPositionClient(window->GetRootWindow()));
// when switching multi-monitor mode from extended to mirror.
if (!aura::client::GetScreenPositionClient(window->GetRootWindow()))
return;
aura::client::GetScreenPositionClient(window->GetRootWindow())-> aura::client::GetScreenPositionClient(window->GetRootWindow())->
ConvertPointToScreen(window, point); ConvertPointToScreen(window, point);
} }
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "ash/desktop_background/desktop_background_widget_controller.h" #include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
#include "ash/root_window_settings.h"
#include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -28,10 +27,6 @@ RootWindowLayoutManager::~RootWindowLayoutManager() { ...@@ -28,10 +27,6 @@ RootWindowLayoutManager::~RootWindowLayoutManager() {
// RootWindowLayoutManager, aura::LayoutManager implementation: // RootWindowLayoutManager, aura::LayoutManager implementation:
void RootWindowLayoutManager::OnWindowResized() { void RootWindowLayoutManager::OnWindowResized() {
// X event may arrive during shutdown.
if (GetRootWindowSettings(owner_->GetRootWindow())->shutdown)
return;
gfx::Rect fullscreen_bounds = gfx::Rect fullscreen_bounds =
gfx::Rect(owner_->bounds().width(), owner_->bounds().height()); gfx::Rect(owner_->bounds().width(), owner_->bounds().height());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment