Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: ui/aura/env.cc

Issue 2897663002: chromeos: makes it possible for windows to outlive WindowTreeClient (Closed)
Patch Set: cleanup Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/mus/focus_synchronizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/env.cc
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index 7a7fe5b35e462fb753d1f80c671caa113bf0a933..0f412fb66ebad12b2c97023f4a5fd08c138670d8 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -18,6 +18,7 @@
#include "ui/aura/mus/window_port_mus.h"
#include "ui/aura/mus/window_tree_client.h"
#include "ui/aura/window.h"
+#include "ui/aura/window_port_for_shutdown.h"
#include "ui/events/event_target_iterator.h"
#include "ui/events/platform/platform_event_source.h"
@@ -83,6 +84,9 @@ std::unique_ptr<WindowPort> Env::CreateWindowPort(Window* window) {
if (mode_ == Mode::LOCAL)
return base::MakeUnique<WindowPortLocal>(window);
+ if (in_mus_shutdown_)
+ return base::MakeUnique<WindowPortForShutdown>();
+
DCHECK(window_tree_client_);
WindowMusType window_mus_type;
switch (window->GetProperty(aura::client::kEmbedType)) {
@@ -122,7 +126,8 @@ const gfx::Point& Env::last_mouse_location() const {
}
// Some tests may not install a WindowTreeClient, and we allow multiple
- // WindowTreeClients for the case of multiple connections.
+ // WindowTreeClients for the case of multiple connections, and this may be
+ // called during shutdown, when there is no WindowTreeClient.
if (window_tree_client_)
last_mouse_location_ = window_tree_client_->GetCursorScreenPoint();
return last_mouse_location_;
@@ -197,6 +202,16 @@ void Env::NotifyHostActivated(WindowTreeHost* host) {
observer.OnHostActivated(host);
}
+void Env::WindowTreeClientDestroyed(aura::WindowTreeClient* client) {
+ DCHECK_EQ(Mode::MUS, mode_);
+
+ if (client != window_tree_client_)
+ return;
+
+ in_mus_shutdown_ = true;
+ window_tree_client_ = nullptr;
+}
+
////////////////////////////////////////////////////////////////////////////////
// Env, ui::EventTarget implementation:
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/mus/focus_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698