| OLD | NEW |
| 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/public/cpp/view_manager/view.h" | 5 #include "mojo/services/public/cpp/view_manager/view.h" |
| 6 | 6 |
| 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" | 7 #include "mojo/services/public/cpp/view_manager/lib/view_manager_private.h" |
| 8 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" | 8 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" |
| 9 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 9 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 : id_(ViewManagerPrivate(manager).synchronizer()->CreateView()), | 72 : id_(ViewManagerPrivate(manager).synchronizer()->CreateView()), |
| 73 node_(NULL), | 73 node_(NULL), |
| 74 manager_(manager) {} | 74 manager_(manager) {} |
| 75 | 75 |
| 76 View::View() | 76 View::View() |
| 77 : id_(-1), | 77 : id_(-1), |
| 78 node_(NULL), | 78 node_(NULL), |
| 79 manager_(NULL) {} | 79 manager_(NULL) {} |
| 80 | 80 |
| 81 View::~View() { | 81 View::~View() { |
| 82 ScopedDestructionNotifier notifier(this); | 82 { |
| 83 if (manager_) | 83 // TODO(beng): I'm not sure I like these scoped destruction notifiers. |
| 84 ViewManagerPrivate(manager_).RemoveView(id_); | 84 // When they fall out of scope |this| is toast. |
| 85 ScopedDestructionNotifier notifier(this); |
| 86 if (manager_) |
| 87 ViewManagerPrivate(manager_).RemoveView(id_); |
| 88 } |
| 85 } | 89 } |
| 86 | 90 |
| 87 void View::LocalDestroy() { | 91 void View::LocalDestroy() { |
| 88 delete this; | 92 delete this; |
| 89 } | 93 } |
| 90 | 94 |
| 91 } // namespace view_manager | 95 } // namespace view_manager |
| 92 } // namespace mojo | 96 } // namespace mojo |
| OLD | NEW |