| Index: mojo/services/view_manager/root_node_manager.cc
|
| diff --git a/mojo/services/view_manager/root_node_manager.cc b/mojo/services/view_manager/root_node_manager.cc
|
| index 5590e49a44f833ea7482d087f436487b2a182a8b..612e3ed02554c4102bb0c7f773185e790a64fb2a 100644
|
| --- a/mojo/services/view_manager/root_node_manager.cc
|
| +++ b/mojo/services/view_manager/root_node_manager.cc
|
| @@ -48,18 +48,19 @@ RootNodeManager::RootNodeManager(ApplicationConnection* app_connection,
|
| next_connection_id_(1),
|
| next_server_change_id_(1),
|
| root_view_manager_(app_connection, this, view_manager_delegate),
|
| - root_(this, RootNodeId()),
|
| + root_(new Node(this, RootNodeId())),
|
| current_change_(NULL) {
|
| }
|
|
|
| RootNodeManager::~RootNodeManager() {
|
| aura::client::FocusClient* focus_client =
|
| - aura::client::GetFocusClient(root_.window());
|
| + aura::client::GetFocusClient(root_->window());
|
| focus_client->RemoveObserver(this);
|
| while (!connections_created_by_connect_.empty())
|
| delete *(connections_created_by_connect_.begin());
|
| // All the connections should have been destroyed.
|
| DCHECK(connection_map_.empty());
|
| + root_.reset();
|
| }
|
|
|
| ConnectionSpecificId RootNodeManager::GetAndAdvanceNextConnectionId() {
|
| @@ -104,8 +105,8 @@ ViewManagerServiceImpl* RootNodeManager::GetConnection(
|
| }
|
|
|
| Node* RootNodeManager::GetNode(const NodeId& id) {
|
| - if (id == root_.id())
|
| - return &root_;
|
| + if (id == root_->id())
|
| + return root_.get();
|
| ConnectionMap::iterator i = connection_map_.find(id.connection_id);
|
| return i == connection_map_.end() ? NULL : i->second->GetNode(id);
|
| }
|
| @@ -195,7 +196,7 @@ void RootNodeManager::ProcessNodeDeleted(const NodeId& node) {
|
| for (ConnectionMap::iterator i = connection_map_.begin();
|
| i != connection_map_.end(); ++i) {
|
| i->second->ProcessNodeDeleted(node, next_server_change_id_,
|
| - IsChangeSource(i->first));
|
| + IsChangeSource(i->first));
|
| }
|
| }
|
|
|
| @@ -250,15 +251,19 @@ ViewManagerServiceImpl* RootNodeManager::EmbedImpl(
|
|
|
| ViewManagerServiceImpl* connection =
|
| new ViewManagerServiceImpl(this,
|
| - creator_id,
|
| - creator_url,
|
| - url.To<std::string>());
|
| + creator_id,
|
| + creator_url,
|
| + url.To<std::string>());
|
| connection->SetRoots(node_ids);
|
| BindToPipe(connection, pipe.handle0.Pass());
|
| connections_created_by_connect_.insert(connection);
|
| return connection;
|
| }
|
|
|
| +void RootNodeManager::OnNodeDestroyed(const Node* node) {
|
| + ProcessNodeDeleted(node->id());
|
| +}
|
| +
|
| void RootNodeManager::OnNodeHierarchyChanged(const Node* node,
|
| const Node* new_parent,
|
| const Node* old_parent) {
|
|
|