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

Unified Diff: mojo/services/public/cpp/view_manager/lib/view.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/view.cc
diff --git a/mojo/services/public/cpp/view_manager/lib/view.cc b/mojo/services/public/cpp/view_manager/lib/view.cc
index 43ac6e951575fcf1c8f9e259c2c2e8562c29ceb0..16cae6f550285b4bb36adf9c40c489378688eccd 100644
--- a/mojo/services/public/cpp/view_manager/lib/view.cc
+++ b/mojo/services/public/cpp/view_manager/lib/view.cc
@@ -13,28 +13,6 @@
namespace mojo {
namespace view_manager {
-namespace {
-class ScopedDestructionNotifier {
- public:
- explicit ScopedDestructionNotifier(View* view)
- : view_(view) {
- FOR_EACH_OBSERVER(ViewObserver,
- *ViewPrivate(view_).observers(),
- OnViewDestroying(view_));
- }
- ~ScopedDestructionNotifier() {
- FOR_EACH_OBSERVER(ViewObserver,
- *ViewPrivate(view_).observers(),
- OnViewDestroyed(view_));
- }
-
- private:
- View* view_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedDestructionNotifier);
-};
-} // namespace
-
// static
View* View::Create(ViewManager* manager) {
View* view = new View(manager);
@@ -80,11 +58,13 @@ View::View()
manager_(NULL) {}
View::~View() {
- ScopedDestructionNotifier notifier(this);
+ FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDestroying(this));
// TODO(beng): It'd be better to do this via a destruction observer in the
// ViewManagerClientImpl.
if (manager_)
static_cast<ViewManagerClientImpl*>(manager_)->RemoveView(id_);
+
+ FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDestroyed(this));
}
void View::LocalDestroy() {

Powered by Google App Engine
This is Rietveld 408576698