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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" | 9 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" |
10 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" | 10 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 const std::vector<Id>& node_ids) { | 382 const std::vector<Id>& node_ids) { |
383 std::vector<const Node*> to_send; | 383 std::vector<const Node*> to_send; |
384 bool did_add_root = false; | 384 bool did_add_root = false; |
385 for (size_t i = 0; i < node_ids.size(); ++i) { | 385 for (size_t i = 0; i < node_ids.size(); ++i) { |
386 CHECK_EQ(creator_id_, NodeIdFromTransportId(node_ids[i]).connection_id); | 386 CHECK_EQ(creator_id_, NodeIdFromTransportId(node_ids[i]).connection_id); |
387 if (roots_.count(node_ids[i]) > 0) | 387 if (roots_.count(node_ids[i]) > 0) |
388 continue; | 388 continue; |
389 | 389 |
390 did_add_root = true; | 390 did_add_root = true; |
391 roots_.insert(node_ids[i]); | 391 roots_.insert(node_ids[i]); |
| 392 Node* node = GetNode(NodeIdFromTransportId(node_ids[i])); |
| 393 DCHECK(node); |
392 if (known_nodes_.count(node_ids[i]) == 0) { | 394 if (known_nodes_.count(node_ids[i]) == 0) { |
393 Node* node = GetNode(NodeIdFromTransportId(node_ids[i])); | |
394 DCHECK(node); | |
395 GetUnknownNodesFrom(node, &to_send); | 395 GetUnknownNodesFrom(node, &to_send); |
| 396 } else { |
| 397 // Even though the connection knows about the new root we need to tell it |
| 398 // |node| is now a root. |
| 399 to_send.push_back(node); |
396 } | 400 } |
397 } | 401 } |
398 | 402 |
399 if (!did_add_root) | 403 if (!did_add_root) |
400 return false; | 404 return false; |
401 | 405 |
402 client()->OnRootsAdded(NodesToINodes(to_send)); | 406 client()->OnRootsAdded(NodesToINodes(to_send)); |
403 return true; | 407 return true; |
404 } | 408 } |
405 | 409 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 client()->OnViewManagerConnectionEstablished( | 702 client()->OnViewManagerConnectionEstablished( |
699 id_, | 703 id_, |
700 creator_url_, | 704 creator_url_, |
701 root_node_manager_->next_server_change_id(), | 705 root_node_manager_->next_server_change_id(), |
702 NodesToINodes(to_send)); | 706 NodesToINodes(to_send)); |
703 } | 707 } |
704 | 708 |
705 } // namespace service | 709 } // namespace service |
706 } // namespace view_manager | 710 } // namespace view_manager |
707 } // namespace mojo | 711 } // namespace mojo |
OLD | NEW |