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

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

Issue 372273004: Shutdown cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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/node.cc
diff --git a/mojo/services/public/cpp/view_manager/lib/node.cc b/mojo/services/public/cpp/view_manager/lib/node.cc
index 3f704d59dd1a10db53ee6b8bc80cb0344f8032c2..9a60bbb384d0363f8a90cfefbd2f3f999cd6e512 100644
--- a/mojo/services/public/cpp/view_manager/lib/node.cc
+++ b/mojo/services/public/cpp/view_manager/lib/node.cc
@@ -194,26 +194,6 @@ class ScopedSetBoundsNotifier {
DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier);
};
-class ScopedDestructionNotifier {
- public:
- explicit ScopedDestructionNotifier(Node* node)
- : node_(node) {
- FOR_EACH_OBSERVER(NodeObserver,
- *NodePrivate(node_).observers(),
- OnNodeDestroying(node_));
- }
- ~ScopedDestructionNotifier() {
- FOR_EACH_OBSERVER(NodeObserver,
- *NodePrivate(node_).observers(),
- OnNodeDestroyed(node_));
- }
-
- private:
- Node* node_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedDestructionNotifier);
-};
-
// Some operations are only permitted in the connection that created the node.
bool OwnsNode(ViewManager* manager, Node* node) {
return !manager ||
@@ -359,13 +339,14 @@ Node::Node()
active_view_(NULL) {}
Node::~Node() {
- ScopedDestructionNotifier notifier(this);
+ FOR_EACH_OBSERVER(NodeObserver, observers_, OnNodeDestroying(this));
if (parent_)
parent_->LocalRemoveChild(this);
// TODO(beng): It'd be better to do this via a destruction observer in the
// ViewManagerClientImpl.
if (manager_)
static_cast<ViewManagerClientImpl*>(manager_)->RemoveNode(id_);
+ FOR_EACH_OBSERVER(NodeObserver, observers_, OnNodeDestroyed(this));
}
////////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698