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/view_manager_connection.h" | 5 #include "mojo/services/view_manager/view_manager_connection.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" | 8 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" |
9 #include "mojo/services/view_manager/node.h" | 9 #include "mojo/services/view_manager/node.h" |
10 #include "mojo/services/view_manager/root_node_manager.h" | 10 #include "mojo/services/view_manager/root_node_manager.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 bool originated_change) { | 120 bool originated_change) { |
121 if (known_nodes_.count(NodeIdToTransportId(node->id())) > 0) { | 121 if (known_nodes_.count(NodeIdToTransportId(node->id())) > 0) { |
122 if (originated_change) | 122 if (originated_change) |
123 return; | 123 return; |
124 if (node->id().connection_id != id_ && !IsNodeDescendantOfRoots(node)) { | 124 if (node->id().connection_id != id_ && !IsNodeDescendantOfRoots(node)) { |
125 // Node was a descendant of roots and is no longer, treat it as though the | 125 // Node was a descendant of roots and is no longer, treat it as though the |
126 // node was deleted. | 126 // node was deleted. |
127 RemoveFromKnown(node); | 127 RemoveFromKnown(node); |
128 client()->OnNodeDeleted(NodeIdToTransportId(node->id()), | 128 client()->OnNodeDeleted(NodeIdToTransportId(node->id()), |
129 server_change_id); | 129 server_change_id); |
| 130 root_node_manager_->OnConnectionMessagedClient(id_); |
130 return; | 131 return; |
131 } | 132 } |
132 } | 133 } |
133 | 134 |
134 if (originated_change || root_node_manager_->is_processing_delete_node()) | 135 if (originated_change || root_node_manager_->is_processing_delete_node()) |
135 return; | 136 return; |
136 std::vector<const Node*> to_send; | 137 std::vector<const Node*> to_send; |
137 if (!ShouldNotifyOnHierarchyChange(node, &new_parent, &old_parent, | 138 if (!ShouldNotifyOnHierarchyChange(node, &new_parent, &old_parent, |
138 &to_send)) { | 139 &to_send)) { |
139 if (root_node_manager_->IsProcessingChange()) { | 140 if (root_node_manager_->IsProcessingChange()) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const bool in_roots = roots_.erase(NodeIdToTransportId(node)) > 0; | 179 const bool in_roots = roots_.erase(NodeIdToTransportId(node)) > 0; |
179 | 180 |
180 if (in_roots && roots_.empty()) | 181 if (in_roots && roots_.empty()) |
181 roots_.insert(NodeIdToTransportId(InvalidNodeId())); | 182 roots_.insert(NodeIdToTransportId(InvalidNodeId())); |
182 | 183 |
183 if (originated_change) | 184 if (originated_change) |
184 return; | 185 return; |
185 | 186 |
186 if (in_known) { | 187 if (in_known) { |
187 client()->OnNodeDeleted(NodeIdToTransportId(node), server_change_id); | 188 client()->OnNodeDeleted(NodeIdToTransportId(node), server_change_id); |
188 } else if (root_node_manager_->IsProcessingChange()) { | 189 root_node_manager_->OnConnectionMessagedClient(id_); |
| 190 } else if (root_node_manager_->IsProcessingChange() && |
| 191 !root_node_manager_->DidConnectionMessageClient(id_)) { |
189 client()->OnServerChangeIdAdvanced( | 192 client()->OnServerChangeIdAdvanced( |
190 root_node_manager_->next_server_change_id() + 1); | 193 root_node_manager_->next_server_change_id() + 1); |
| 194 root_node_manager_->OnConnectionMessagedClient(id_); |
191 } | 195 } |
192 } | 196 } |
193 | 197 |
194 void ViewManagerConnection::ProcessViewDeleted(const ViewId& view, | 198 void ViewManagerConnection::ProcessViewDeleted(const ViewId& view, |
195 bool originated_change) { | 199 bool originated_change) { |
196 if (originated_change) | 200 if (originated_change) |
197 return; | 201 return; |
198 client()->OnViewDeleted(ViewIdToTransportId(view)); | 202 client()->OnViewDeleted(ViewIdToTransportId(view)); |
199 } | 203 } |
200 | 204 |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 631 |
628 client()->OnViewManagerConnectionEstablished( | 632 client()->OnViewManagerConnectionEstablished( |
629 id_, | 633 id_, |
630 root_node_manager_->next_server_change_id(), | 634 root_node_manager_->next_server_change_id(), |
631 NodesToINodes(to_send)); | 635 NodesToINodes(to_send)); |
632 } | 636 } |
633 | 637 |
634 } // namespace service | 638 } // namespace service |
635 } // namespace view_manager | 639 } // namespace view_manager |
636 } // namespace mojo | 640 } // namespace mojo |
OLD | NEW |