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

Unified Diff: mojo/services/public/cpp/view_manager/lib/view_manager.cc

Issue 274733004: Deletion/ownership (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: mojo/services/public/cpp/view_manager/lib/view_manager.cc
diff --git a/mojo/services/public/cpp/view_manager/lib/view_manager.cc b/mojo/services/public/cpp/view_manager/lib/view_manager.cc
index 4603abc3db11cddec574b742dc150dd1e67b7290..9325a9950859f7ae7f99ce829f6107b33f3aa287 100644
--- a/mojo/services/public/cpp/view_manager/lib/view_manager.cc
+++ b/mojo/services/public/cpp/view_manager/lib/view_manager.cc
@@ -5,6 +5,7 @@
#include "mojo/services/public/cpp/view_manager/view_manager.h"
#include "mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h"
+#include "mojo/services/public/cpp/view_manager/lib/view_tree_node_private.h"
namespace mojo {
namespace services {
@@ -13,12 +14,25 @@ namespace view_manager {
ViewManager::ViewManager(Shell* shell)
: shell_(shell) {}
-ViewManager::~ViewManager() {}
+ViewManager::~ViewManager() {
+ while (!nodes_.empty()) {
+ IdToNodeMap::iterator it = nodes_.begin();
+ if (synchronizer_->OwnsNode(it->second->id()))
+ it->second->Destroy();
+ else
+ nodes_.erase(it);
+ }
+}
void ViewManager::Init() {
synchronizer_.reset(new ViewManagerSynchronizer(this));
}
+ViewTreeNode* ViewManager::GetNodeById(TransportNodeId id) {
+ IdToNodeMap::const_iterator it = nodes_.find(id);
+ return it != nodes_.end() ? it->second : NULL;
+}
+
} // namespace view_manager
} // namespace services
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698