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

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

Issue 309793007: Fixes leak in ViewManagerConnection (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 | no next file » | 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/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 bool result = SetViewImpl(i->second, ViewId()); 51 bool result = SetViewImpl(i->second, ViewId());
52 DCHECK(result); 52 DCHECK(result);
53 } 53 }
54 } 54 }
55 55
56 if (!node_map_.empty()) { 56 if (!node_map_.empty()) {
57 RootNodeManager::ScopedChange change( 57 RootNodeManager::ScopedChange change(
58 this, root_node_manager_, 58 this, root_node_manager_,
59 RootNodeManager::CHANGE_TYPE_ADVANCE_SERVER_CHANGE_ID, true); 59 RootNodeManager::CHANGE_TYPE_ADVANCE_SERVER_CHANGE_ID, true);
60 while (!node_map_.empty()) { 60 while (!node_map_.empty()) {
61 Node* node = node_map_.begin()->second; 61 scoped_ptr<Node> node(node_map_.begin()->second);
62 Node* parent = node->GetParent(); 62 Node* parent = node->GetParent();
63 const NodeId node_id(node->id()); 63 const NodeId node_id(node->id());
64 if (parent) 64 if (parent)
65 parent->Remove(node); 65 parent->Remove(node.get());
66 root_node_manager_->ProcessNodeDeleted(node_id); 66 root_node_manager_->ProcessNodeDeleted(node_id);
67 node_map_.erase(NodeIdToTransportId(node_id)); 67 node_map_.erase(NodeIdToTransportId(node_id));
68 } 68 }
69 } 69 }
70 70
71 root_node_manager_->RemoveConnection(this); 71 root_node_manager_->RemoveConnection(this);
72 } 72 }
73 73
74 const Node* ViewManagerConnection::GetNode(const NodeId& id) const { 74 const Node* ViewManagerConnection::GetNode(const NodeId& id) const {
75 if (id_ == id.connection_id) { 75 if (id_ == id.connection_id) {
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 631
632 client()->OnViewManagerConnectionEstablished( 632 client()->OnViewManagerConnectionEstablished(
633 id_, 633 id_,
634 root_node_manager_->next_server_change_id(), 634 root_node_manager_->next_server_change_id(),
635 NodesToINodes(to_send)); 635 NodesToINodes(to_send));
636 } 636 }
637 637
638 } // namespace service 638 } // namespace service
639 } // namespace view_manager 639 } // namespace view_manager
640 } // namespace mojo 640 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698