| OLD | NEW |
| 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 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 for (ConnectionMap::iterator i = connection_map_.begin(); | 89 for (ConnectionMap::iterator i = connection_map_.begin(); |
| 90 i != connection_map_.end(); ++i) { | 90 i != connection_map_.end(); ++i) { |
| 91 const TransportChangeId change_id = | 91 const TransportChangeId change_id = |
| 92 (change_ && i->first == change_->connection_id) ? | 92 (change_ && i->first == change_->connection_id) ? |
| 93 change_->change_id : 0; | 93 change_->change_id : 0; |
| 94 i->second->NotifyNodeViewReplaced(node, new_view_id, old_view_id, | 94 i->second->NotifyNodeViewReplaced(node, new_view_id, old_view_id, |
| 95 change_id); | 95 change_id); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 void RootNodeManager::NotifyNodeDeleted(const NodeId& node) { |
| 100 for (ConnectionMap::iterator i = connection_map_.begin(); |
| 101 i != connection_map_.end(); ++i) { |
| 102 const TransportChangeId change_id = |
| 103 (change_ && i->first == change_->connection_id) ? |
| 104 change_->change_id : 0; |
| 105 i->second->NotifyNodeDeleted(node, change_id); |
| 106 } |
| 107 } |
| 108 |
| 99 void RootNodeManager::PrepareForChange(ViewManagerConnection* connection, | 109 void RootNodeManager::PrepareForChange(ViewManagerConnection* connection, |
| 100 TransportChangeId change_id) { | 110 TransportChangeId change_id) { |
| 101 DCHECK(!change_.get()); // Should only ever have one change in flight. | 111 DCHECK(!change_.get()); // Should only ever have one change in flight. |
| 102 change_.reset(new Change(connection->id(), change_id)); | 112 change_.reset(new Change(connection->id(), change_id)); |
| 103 } | 113 } |
| 104 | 114 |
| 105 void RootNodeManager::FinishChange() { | 115 void RootNodeManager::FinishChange() { |
| 106 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced. | 116 DCHECK(change_.get()); // PrepareForChange/FinishChange should be balanced. |
| 107 change_.reset(); | 117 change_.reset(); |
| 108 } | 118 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 129 | 139 |
| 130 void RootNodeManager::OnNodeViewReplaced(const NodeId& node, | 140 void RootNodeManager::OnNodeViewReplaced(const NodeId& node, |
| 131 const ViewId& new_view_id, | 141 const ViewId& new_view_id, |
| 132 const ViewId& old_view_id) { | 142 const ViewId& old_view_id) { |
| 133 NotifyNodeViewReplaced(node, new_view_id, old_view_id); | 143 NotifyNodeViewReplaced(node, new_view_id, old_view_id); |
| 134 } | 144 } |
| 135 | 145 |
| 136 } // namespace view_manager | 146 } // namespace view_manager |
| 137 } // namespace services | 147 } // namespace services |
| 138 } // namespace mojo | 148 } // namespace mojo |
| OLD | NEW |