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

Unified Diff: components/mus/ws/client_connection.cc

Issue 1764483003: Changes ownership of ClientConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « components/mus/ws/client_connection.h ('k') | components/mus/ws/connection_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/ws/client_connection.cc
diff --git a/components/mus/ws/client_connection.cc b/components/mus/ws/client_connection.cc
index 9f43ab9bf583479d5a687d8bb2f1c846b5fc0a24..9c5523411e4cc7612c1e7760edaaa12185e8a032 100644
--- a/components/mus/ws/client_connection.cc
+++ b/components/mus/ws/client_connection.cc
@@ -4,38 +4,40 @@
#include "components/mus/ws/client_connection.h"
+#include "base/bind.h"
#include "components/mus/ws/connection_manager.h"
#include "components/mus/ws/window_tree_impl.h"
namespace mus {
namespace ws {
-ClientConnection::ClientConnection(scoped_ptr<WindowTreeImpl> service,
- mojom::WindowTreeClient* client)
- : service_(std::move(service)), client_(client) {}
+ClientConnection::ClientConnection(mojom::WindowTreeClient* client)
+ : client_(client) {}
ClientConnection::~ClientConnection() {}
DefaultClientConnection::DefaultClientConnection(
- scoped_ptr<WindowTreeImpl> service_impl,
+ WindowTreeImpl* tree,
ConnectionManager* connection_manager,
mojom::WindowTreeRequest service_request,
mojom::WindowTreeClientPtr client)
- : ClientConnection(std::move(service_impl), client.get()),
+ : ClientConnection(client.get()),
connection_manager_(connection_manager),
- binding_(service(), std::move(service_request)),
+ binding_(tree, std::move(service_request)),
client_(std::move(client)) {
+ // Both |connection_manager| and |tree| outlive us.
binding_.set_connection_error_handler(
- [this]() { connection_manager_->OnConnectionError(this); });
+ base::Bind(&ConnectionManager::DestroyTree,
+ base::Unretained(connection_manager), base::Unretained(tree)));
}
DefaultClientConnection::DefaultClientConnection(
- scoped_ptr<WindowTreeImpl> service_impl,
+ WindowTreeImpl* tree,
ConnectionManager* connection_manager,
mojom::WindowTreeClientPtr client)
- : ClientConnection(std::move(service_impl), client.get()),
+ : ClientConnection(client.get()),
connection_manager_(connection_manager),
- binding_(service()),
+ binding_(tree),
client_(std::move(client)) {}
DefaultClientConnection::~DefaultClientConnection() {}
« no previous file with comments | « components/mus/ws/client_connection.h ('k') | components/mus/ws/connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698