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

Side by Side Diff: mojo/services/view_manager/root_node_manager.cc

Issue 272833002: View synchronization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/services/view_manager/root_node_manager.h ('k') | mojo/services/view_manager/view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/view_manager/root_node_manager.h" 5 #include "mojo/services/view_manager/root_node_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/services/view_manager/view_manager_connection.h" 8 #include "mojo/services/view_manager/view_manager_connection.h"
9 #include "ui/aura/env.h" 9 #include "ui/aura/env.h"
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return i == connection_map_.end() ? NULL : i->second; 73 return i == connection_map_.end() ? NULL : i->second;
74 } 74 }
75 75
76 Node* RootNodeManager::GetNode(const NodeId& id) { 76 Node* RootNodeManager::GetNode(const NodeId& id) {
77 if (id == root_.id()) 77 if (id == root_.id())
78 return &root_; 78 return &root_;
79 ConnectionMap::iterator i = connection_map_.find(id.connection_id); 79 ConnectionMap::iterator i = connection_map_.find(id.connection_id);
80 return i == connection_map_.end() ? NULL : i->second->GetNode(id); 80 return i == connection_map_.end() ? NULL : i->second->GetNode(id);
81 } 81 }
82 82
83 View* RootNodeManager::GetView(const ViewId& id) { 83 service::View* RootNodeManager::GetView(const ViewId& id) {
84 ConnectionMap::iterator i = connection_map_.find(id.connection_id); 84 ConnectionMap::iterator i = connection_map_.find(id.connection_id);
85 return i == connection_map_.end() ? NULL : i->second->GetView(id); 85 return i == connection_map_.end() ? NULL : i->second->GetView(id);
86 } 86 }
87 87
88 void RootNodeManager::NotifyNodeHierarchyChanged(const NodeId& node, 88 void RootNodeManager::NotifyNodeHierarchyChanged(const NodeId& node,
89 const NodeId& new_parent, 89 const NodeId& new_parent,
90 const NodeId& old_parent) { 90 const NodeId& old_parent) {
91 for (ConnectionMap::iterator i = connection_map_.begin(); 91 for (ConnectionMap::iterator i = connection_map_.begin();
92 i != connection_map_.end(); ++i) { 92 i != connection_map_.end(); ++i) {
93 i->second->NotifyNodeHierarchyChanged( 93 i->second->NotifyNodeHierarchyChanged(
(...skipping 15 matching lines...) Expand all
109 109
110 void RootNodeManager::NotifyNodeDeleted(const NodeId& node) { 110 void RootNodeManager::NotifyNodeDeleted(const NodeId& node) {
111 // TODO(sky): make a macro for this. 111 // TODO(sky): make a macro for this.
112 for (ConnectionMap::iterator i = connection_map_.begin(); 112 for (ConnectionMap::iterator i = connection_map_.begin();
113 i != connection_map_.end(); ++i) { 113 i != connection_map_.end(); ++i) {
114 i->second->NotifyNodeDeleted(node, next_server_change_id_, 114 i->second->NotifyNodeDeleted(node, next_server_change_id_,
115 GetClientChangeId(i->first)); 115 GetClientChangeId(i->first));
116 } 116 }
117 } 117 }
118 118
119 void RootNodeManager::NotifyViewDeleted(const ViewId& view) {
120 // TODO(sky): make a macro for this.
121 for (ConnectionMap::iterator i = connection_map_.begin();
122 i != connection_map_.end(); ++i) {
123 i->second->NotifyViewDeleted(view, next_server_change_id_,
124 GetClientChangeId(i->first));
125 }
126 }
127
119 void RootNodeManager::PrepareForChange(ViewManagerConnection* connection, 128 void RootNodeManager::PrepareForChange(ViewManagerConnection* connection,
120 TransportChangeId change_id) { 129 TransportChangeId change_id) {
121 DCHECK(!change_.get()); // Should only ever have one change in flight. 130 DCHECK(!change_.get()); // Should only ever have one change in flight.
122 change_.reset(new Change(connection->id(), change_id)); 131 change_.reset(new Change(connection->id(), change_id));
123 } 132 }
124 133
125 void RootNodeManager::FinishChange(ChangeType change_type) { 134 void RootNodeManager::FinishChange(ChangeType change_type) {
126 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced. 135 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced.
127 change_.reset(); 136 change_.reset();
128 if (change_type == CHANGE_TYPE_ADVANCE_SERVER_CHANGE_ID) 137 if (change_type == CHANGE_TYPE_ADVANCE_SERVER_CHANGE_ID)
(...skipping 15 matching lines...) Expand all
144 153
145 void RootNodeManager::OnNodeViewReplaced(const NodeId& node, 154 void RootNodeManager::OnNodeViewReplaced(const NodeId& node,
146 const ViewId& new_view_id, 155 const ViewId& new_view_id,
147 const ViewId& old_view_id) { 156 const ViewId& old_view_id) {
148 NotifyNodeViewReplaced(node, new_view_id, old_view_id); 157 NotifyNodeViewReplaced(node, new_view_id, old_view_id);
149 } 158 }
150 159
151 } // namespace view_manager 160 } // namespace view_manager
152 } // namespace services 161 } // namespace services
153 } // namespace mojo 162 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/root_node_manager.h ('k') | mojo/services/view_manager/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698