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

Unified Diff: services/ui/ws/window_manager_state.h

Issue 2346253004: Makes display roots be destroyed by client (Closed)
Patch Set: cleanup Created 4 years, 3 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 | « services/ui/ws/window_manager_display_root.h ('k') | services/ui/ws/window_manager_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_manager_state.h
diff --git a/services/ui/ws/window_manager_state.h b/services/ui/ws/window_manager_state.h
index 95a608cdceb0b4496a04a82087e804309326a298..718cae8224843ba33426a585446c089564148a90 100644
--- a/services/ui/ws/window_manager_state.h
+++ b/services/ui/ws/window_manager_state.h
@@ -16,6 +16,7 @@
#include "services/ui/public/interfaces/display.mojom.h"
#include "services/ui/ws/event_dispatcher.h"
#include "services/ui/ws/event_dispatcher_delegate.h"
+#include "services/ui/ws/server_window_observer.h"
#include "services/ui/ws/user_id.h"
#include "services/ui/ws/window_server.h"
@@ -23,6 +24,7 @@ namespace ui {
namespace ws {
class DisplayManager;
+class WindowManagerDisplayRoot;
class WindowTree;
namespace test {
@@ -32,7 +34,8 @@ class WindowManagerStateTestApi;
// Manages state specific to a WindowManager that is shared across displays.
// WindowManagerState is owned by the WindowTree the window manager is
// associated with.
-class WindowManagerState : public EventDispatcherDelegate {
+class WindowManagerState : public EventDispatcherDelegate,
+ public ServerWindowObserver {
public:
explicit WindowManagerState(WindowTree* window_tree);
~WindowManagerState() override;
@@ -72,6 +75,11 @@ class WindowManagerState : public EventDispatcherDelegate {
void AddSystemModalWindow(ServerWindow* window);
+ // Returns the ServerWindow corresponding to an orphaned root with the
+ // specified id. See |orphaned_window_manager_display_roots_| for details on
+ // what on orphaned root is.
+ ServerWindow* GetOrphanedRootWithId(const WindowId& id);
+
// TODO(sky): EventDispatcher is really an implementation detail and should
// not be exposed.
EventDispatcher* event_dispatcher() { return &event_dispatcher_; }
@@ -98,6 +106,11 @@ class WindowManagerState : public EventDispatcherDelegate {
friend class Display;
friend class test::WindowManagerStateTestApi;
+ // Set of display roots. This is a vector rather than a set to support removal
+ // without deleting.
+ using WindowManagerDisplayRoots =
+ std::vector<std::unique_ptr<WindowManagerDisplayRoot>>;
+
enum class DebugAcceleratorType {
PRINT_WINDOWS,
};
@@ -143,6 +156,14 @@ class WindowManagerState : public EventDispatcherDelegate {
DisplayManager* display_manager();
const DisplayManager* display_manager() const;
+ // Adds |display_root| to the set of WindowManagerDisplayRoots owned by this
+ // WindowManagerState.
+ void AddWindowManagerDisplayRoot(
+ std::unique_ptr<WindowManagerDisplayRoot> display_root);
+
+ // Called when a Display is deleted.
+ void OnDisplayDestroying(Display* display);
+
// Sets the visibility of all window manager roots windows to |value|.
void SetAllRootWindowsVisible(bool value);
@@ -206,6 +227,9 @@ class WindowManagerState : public EventDispatcherDelegate {
ServerWindow* GetRootWindowContaining(gfx::Point* location) override;
void OnEventTargetNotFound(const ui::Event& event) override;
+ // ServerWindowObserver:
+ void OnWindowEmbeddedAppDisconnected(ServerWindow* window) override;
+
// The single WindowTree this WindowManagerState is associated with.
// |window_tree_| owns this.
WindowTree* window_tree_;
@@ -230,6 +254,16 @@ class WindowManagerState : public EventDispatcherDelegate {
// PlatformDisplay that currently has capture.
PlatformDisplay* platform_display_with_capture_ = nullptr;
+ // All the active WindowManagerDisplayRoots.
+ WindowManagerDisplayRoots window_manager_display_roots_;
+
+ // Set of WindowManagerDisplayRoots corresponding to Displays that have been
+ // destroyed. WindowManagerDisplayRoots are not destroyed immediately when
+ // the Display is destroyed to allow the client to destroy the window when it
+ // wants to. Once the client destroys the window WindowManagerDisplayRoots is
+ // destroyed.
+ WindowManagerDisplayRoots orphaned_window_manager_display_roots_;
+
base::WeakPtrFactory<WindowManagerState> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(WindowManagerState);
« no previous file with comments | « services/ui/ws/window_manager_display_root.h ('k') | services/ui/ws/window_manager_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698