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

Unified Diff: mojo/services/view_manager/view_manager_connection.cc

Issue 308803002: Change type of interface created by mojo:view_manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 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
Index: mojo/services/view_manager/view_manager_connection.cc
diff --git a/mojo/services/view_manager/view_manager_connection.cc b/mojo/services/view_manager/view_manager_connection.cc
index 029d203fa895c7583ec5e8ee881a80f4d2d7c23e..d42c403d32253c86b27a36be8e9888642487ecfe 100644
--- a/mojo/services/view_manager/view_manager_connection.cc
+++ b/mojo/services/view_manager/view_manager_connection.cc
@@ -34,7 +34,8 @@ void GetDescendants(const Node* node, std::vector<const Node*>* nodes) {
ViewManagerConnection::ViewManagerConnection(RootNodeManager* root_node_manager)
: root_node_manager_(root_node_manager),
- id_(0) {
+ id_(root_node_manager_->GetAndAdvanceNextConnectionId()),
+ delete_on_connection_error_(false) {
}
ViewManagerConnection::~ViewManagerConnection() {
@@ -87,7 +88,7 @@ const View* ViewManagerConnection::GetView(const ViewId& id) const {
}
void ViewManagerConnection::SetRoots(const Array<TransportNodeId>& node_ids) {
- DCHECK_EQ(0, id_); // Only valid before connection established.
+ DCHECK(roots_.empty());
NodeIdSet roots;
for (size_t i = 0; i < node_ids.size(); ++i) {
DCHECK(GetNode(NodeIdFromTransportId(node_ids[i])));
@@ -198,8 +199,8 @@ void ViewManagerConnection::ProcessViewDeleted(const ViewId& view,
}
void ViewManagerConnection::OnConnectionError() {
- // TODO(sky): figure out if need to cleanup here if this
- // ViewManagerConnection is the result of a Connect().
+ if (delete_on_connection_error_)
+ delete this;
}
bool ViewManagerConnection::CanRemoveNodeFromParent(const Node* node) const {
@@ -614,10 +615,6 @@ void ViewManagerConnection::OnNodeViewReplaced(const Node* node,
}
void ViewManagerConnection::OnConnectionEstablished() {
- DCHECK_EQ(0, id_); // Should only get OnConnectionEstablished() once.
-
- id_ = root_node_manager_->GetAndAdvanceNextConnectionId();
-
root_node_manager_->AddConnection(this);
std::vector<const Node*> to_send;
« no previous file with comments | « mojo/services/view_manager/view_manager_connection.h ('k') | mojo/services/view_manager/view_manager_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698