diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 19:16:02 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-27 19:16:02 +0000 |
commit | 7cf7f973fbab0a818324527a9f8fa3b82fca3187 (patch) | |
tree | 554a7d6d9d6b7c911ced16566d01f0e4bff3f0ac | |
parent | 740ebed036eadc0a907b52e7ea13e3bc648faacf (diff) | |
download | chromium_src-7cf7f973fbab0a818324527a9f8fa3b82fca3187.zip chromium_src-7cf7f973fbab0a818324527a9f8fa3b82fca3187.tar.gz chromium_src-7cf7f973fbab0a818324527a9f8fa3b82fca3187.tar.bz2 |
chromeos: Add a bool flag to catch crash cause of http://crbug.com/134507.
Add a boolean flag to catch the case that window is destroyed during
SetVisible(false) call.
BUG=134507
TEST=None.
Review URL: https://chromiumcodereview.appspot.com/10677010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144508 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/aura/window.cc | 8 | ||||
-rw-r--r-- | ui/aura/window.h | 7 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 437b75d..40a70ef 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "base/auto_reset.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" @@ -62,10 +63,13 @@ Window::Window(WindowDelegate* delegate) id_(-1), transparent_(false), user_data_(NULL), - ignore_events_(false) { + ignore_events_(false), + in_set_visible_call_(false) { } Window::~Window() { + CHECK(!in_set_visible_call_); + // layer_ can be NULL if Init() wasn't invoked, which can happen // only in tests. if (layer_) @@ -653,6 +657,8 @@ void Window::SetVisible(bool visible) { if (visible == layer_->GetTargetVisibility()) return; // No change. + AutoReset<bool> reseter(&in_set_visible_call_, true); + RootWindow* root_window = GetRootWindow(); if (client::GetVisibilityClient(root_window)) { client::GetVisibilityClient(root_window)->UpdateLayerVisibility( diff --git a/ui/aura/window.h b/ui/aura/window.h index a8c0d72..2c76082 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -474,6 +474,13 @@ class AURA_EXPORT Window : public ui::LayerDelegate, std::map<const void*, Value> prop_map_; + // A boolean flag to debug crash in http://crbug.com/134507. It is set when + // SetVisible is called and reset when SetVisible finishes. In Window dtor, + // the flag is CHECKed to catch the case that Window is destroyed during + // SetVisbile(false). + // TODO(xiyuan): Remove this when http://crbug.com/134507 is resolved. + bool in_set_visible_call_; + DISALLOW_COPY_AND_ASSIGN(Window); }; |