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

Unified Diff: services/ui/public/cpp/window_tree_client.h

Issue 2301353003: Changes ownership of WindowTreeClient (Closed)
Patch Set: fix navigation 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
Index: services/ui/public/cpp/window_tree_client.h
diff --git a/services/ui/public/cpp/window_tree_client.h b/services/ui/public/cpp/window_tree_client.h
index 9e9959d8534d025db5613f707463091e4c5800c7..ba453b87fa96a60039c81ca8373aefccb566bb82 100644
--- a/services/ui/public/cpp/window_tree_client.h
+++ b/services/ui/public/cpp/window_tree_client.h
@@ -46,25 +46,20 @@ enum class ChangeType;
// Manages the connection with mus.
//
-// WindowTreeClient is deleted by any of the following:
-// . If all the roots of the connection are destroyed and the connection is
-// configured to delete when there are no roots (true if the WindowTreeClient
-// is created with a mojom::WindowTreeClientRequest). This happens
-// if the owner of the roots Embed()s another app in all the roots, or all
-// the roots are explicitly deleted.
-// . The connection to mus is lost.
-// . Explicitly by way of calling delete.
+// WindowTreeClient is owned by the creator. Generally when the delegate gets
+// one of OnEmbedRootDestroyed() or OnLostConnection() it should delete the
+// WindowTreeClient.
//
// When WindowTreeClient is deleted all windows are deleted (and observers
-// notified). This is followed by calling
-// WindowTreeClientDelegate::OnDidDestroyClient().
+// notified).
class WindowTreeClient : public mojom::WindowTreeClient,
public mojom::WindowManager,
public WindowManagerClient {
public:
- WindowTreeClient(WindowTreeClientDelegate* delegate,
- WindowManagerDelegate* window_manager_delegate,
- mojom::WindowTreeClientRequest request);
+ explicit WindowTreeClient(
+ WindowTreeClientDelegate* delegate,
+ WindowManagerDelegate* window_manager_delegate = nullptr,
+ mojom::WindowTreeClientRequest request = nullptr);
~WindowTreeClient() override;
// Establishes the connection by way of the WindowTreeFactory.
@@ -156,10 +151,6 @@ class WindowTreeClient : public mojom::WindowTreeClient,
Window* GetWindowByServerId(Id id);
- // Sets whether this is deleted when there are no roots. The default is to
- // delete when there are no roots.
- void SetDeleteOnNoRoots(bool value);
-
// Returns the root of this connection.
const std::set<Window*>& GetRoots();
@@ -402,7 +393,8 @@ class WindowTreeClient : public mojom::WindowTreeClient,
// directly set this.
mojom::WindowTree* tree_;
- bool delete_on_no_roots_;
+ // Set to true if OnEmbed() was received.
+ bool is_from_embed_ = false;
bool in_destructor_;
« no previous file with comments | « services/ui/public/cpp/tests/window_tree_client_unittest.cc ('k') | services/ui/public/cpp/window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698