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

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

Issue 323413003: Makes the view manager notify the client of new roots correctly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | mojo/services/view_manager/view_manager_connection_unittest.cc » ('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/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
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
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
OLDNEW
« no previous file with comments | « no previous file | mojo/services/view_manager/view_manager_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698