diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-06 18:08:37 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-06 18:08:37 +0000 |
commit | fce1e4720e5398d09f315ca51b94ace81cf9b774 (patch) | |
tree | 3a7c773967150c8909d0932c7c3af31407eee16b /ui/aura | |
parent | af0eff5c3d7661150ccfe72c3234ccfe2a652e4a (diff) | |
download | chromium_src-fce1e4720e5398d09f315ca51b94ace81cf9b774.zip chromium_src-fce1e4720e5398d09f315ca51b94ace81cf9b774.tar.gz chromium_src-fce1e4720e5398d09f315ca51b94ace81cf9b774.tar.bz2 |
Revert 239232 "Make sure WindowObservers are removed from window..."
> Make sure WindowObservers are removed from window before destruction
>
> * Check if the window observer is empty upon destruction.
> * remove the all observers in ~WindowObserver()
> * Remove RemoveObserver that are no longer necessary
> * Fix shell shutdown order so that observers are removed correctly before deleting all windows.
>
> BUG=324018
> R=skuhne@chromium.org, sky@chromium.org
>
> Review URL: https://codereview.chromium.org/101013002
TBR=oshima@chromium.org
Review URL: https://codereview.chromium.org/103863003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura')
-rw-r--r-- | ui/aura/client/default_activation_client.cc | 1 | ||||
-rw-r--r-- | ui/aura/window.cc | 7 | ||||
-rw-r--r-- | ui/aura/window.h | 2 | ||||
-rw-r--r-- | ui/aura/window_observer.h | 10 |
4 files changed, 5 insertions, 15 deletions
diff --git a/ui/aura/client/default_activation_client.cc b/ui/aura/client/default_activation_client.cc index ccb660b..629f12a 100644 --- a/ui/aura/client/default_activation_client.cc +++ b/ui/aura/client/default_activation_client.cc @@ -102,6 +102,7 @@ void DefaultActivationClient::OnWindowDestroyed(Window* window) { last_active_ = NULL; if (window == GetActiveWindow()) { + window->RemoveObserver(this); active_windows_.pop_back(); Window* next_active = GetActiveWindow(); if (next_active && aura::client::GetActivationChangeObserver(next_active)) { diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 2655b8a..692e345 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -168,12 +168,7 @@ Window::~Window() { // Delegate and observers need to be notified after transients are deleted. if (delegate_) delegate_->OnWindowDestroyed(); - ObserverListBase<WindowObserver>::Iterator iter(observers_); - WindowObserver* observer; - while ((observer = iter.GetNext())) { - RemoveObserver(observer); - observer->OnWindowDestroyed(this); - } + FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this)); // Clear properties. for (std::map<const void*, Value>::const_iterator iter = prop_map_.begin(); diff --git a/ui/aura/window.h b/ui/aura/window.h index c6dcd09..f2a5672 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -588,7 +588,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate, gfx::Insets hit_test_bounds_override_outer_touch_; gfx::Insets hit_test_bounds_override_inner_; - ObserverList<WindowObserver, true> observers_; + ObserverList<WindowObserver> observers_; // Value struct to keep the name and deallocator for this property. // Key cannot be used for this purpose because it can be char* or diff --git a/ui/aura/window_observer.h b/ui/aura/window_observer.h index 9408ee8..5008ac5 100644 --- a/ui/aura/window_observer.h +++ b/ui/aura/window_observer.h @@ -87,14 +87,8 @@ class AURA_EXPORT WindowObserver { // destructor). This is called before the window is removed from its parent. virtual void OnWindowDestroying(Window* window) {} - // Invoked when the Window has been destroyed (i.e. at the end of - // its destructor). This is called after the window is removed from - // its parent. Window automatically removes its WindowObservers - // before calling this method, so the following code is no op. - // - // void MyWindowObserver::OnWindowDestroyed(aura::Window* window) { - // window->RemoveObserver(this); - // } + // Invoked when the Window has been destroyed (i.e. at the end of its + // destructor). This is called after the window is removed from its parent. virtual void OnWindowDestroyed(Window* window) {} // Called when a Window has been added to a RootWindow. |