Commit 0c2830d9 authored by sky@chromium.org's avatar sky@chromium.org

Reverts debugging code added for 91396. I've tracked down the bug and

will do a patch after this so that it can be cleanly merged over.

TBR since it's just a revert.

BUG=91396
TEST=none
R=ben@chromium.org
TBR=ben@chromium.org

Review URL: http://codereview.chromium.org/7745049

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98451 0039d316-1c4b-4281-b951-d872f2087c98
parent 0996e9bc
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/string_util.h" #include "base/string_util.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
...@@ -33,16 +32,13 @@ namespace { ...@@ -33,16 +32,13 @@ namespace {
// been initialized. // been initialized.
// TODO(mirandac): This function will also separate windows by profile in a // TODO(mirandac): This function will also separate windows by profile in a
// multi-profile environment. // multi-profile environment.
PrefService* GetPrefsForWindow(const views::Widget* window, PrefService* GetPrefsForWindow(const views::Widget* window) {
bool* using_local_state) {
Profile* profile = reinterpret_cast<Profile*>( Profile* profile = reinterpret_cast<Profile*>(
window->GetNativeWindowProperty(Profile::kProfileKey)); window->GetNativeWindowProperty(Profile::kProfileKey));
if (!profile) { if (!profile) {
// Use local state for windows that have no explicit profile. // Use local state for windows that have no explicit profile.
*using_local_state = true;
return g_browser_process->local_state(); return g_browser_process->local_state();
} }
*using_local_state = false;
return profile->GetPrefs(); return profile->GetPrefs();
} }
...@@ -66,14 +62,11 @@ void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window, ...@@ -66,14 +62,11 @@ void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
const std::wstring& window_name, const std::wstring& window_name,
const gfx::Rect& bounds, const gfx::Rect& bounds,
bool maximized) { bool maximized) {
bool using_local_state = false; PrefService* prefs = GetPrefsForWindow(window);
PrefService* prefs = GetPrefsForWindow(window, &using_local_state);
if (!prefs) if (!prefs)
return; return;
CHECK(prefs->FindPreference(WideToUTF8(window_name).c_str())) << " " << DCHECK(prefs->FindPreference(WideToUTF8(window_name).c_str()));
browser_shutdown::GetShutdownType() << " " << using_local_state << " " <<
window->destroy_state();
DictionaryPrefUpdate update(prefs, WideToUTF8(window_name).c_str()); DictionaryPrefUpdate update(prefs, WideToUTF8(window_name).c_str());
DictionaryValue* window_preferences = update.Get(); DictionaryValue* window_preferences = update.Get();
window_preferences->SetInteger("left", bounds.x()); window_preferences->SetInteger("left", bounds.x());
......
...@@ -153,13 +153,10 @@ Widget::Widget() ...@@ -153,13 +153,10 @@ Widget::Widget()
saved_maximized_state_(false), saved_maximized_state_(false),
minimum_size_(100, 100), minimum_size_(100, 100),
focus_on_creation_(true), focus_on_creation_(true),
is_top_level_(false), is_top_level_(false) {
destroy_state_(DESTROY_STATE_NONE) {
} }
Widget::~Widget() { Widget::~Widget() {
destroy_state_ = DESTROY_STATE_DELETED;
while (!event_stack_.empty()) { while (!event_stack_.empty()) {
event_stack_.top()->reset(); event_stack_.top()->reset();
event_stack_.pop(); event_stack_.pop();
...@@ -865,17 +862,12 @@ void Widget::OnNativeWidgetCreated() { ...@@ -865,17 +862,12 @@ void Widget::OnNativeWidgetCreated() {
void Widget::OnNativeWidgetDestroying() { void Widget::OnNativeWidgetDestroying() {
FOR_EACH_OBSERVER(Observer, observers_, OnWidgetClosing(this)); FOR_EACH_OBSERVER(Observer, observers_, OnWidgetClosing(this));
if (destroy_state_ == DESTROY_STATE_NONE)
destroy_state_ = DESTROY_STATE_IN_DESTROYING;
if (non_client_view_) if (non_client_view_)
non_client_view_->WindowClosing(); non_client_view_->WindowClosing();
widget_delegate_->WindowClosing(); widget_delegate_->WindowClosing();
} }
void Widget::OnNativeWidgetDestroyed() { void Widget::OnNativeWidgetDestroyed() {
if (destroy_state_ == DESTROY_STATE_IN_DESTROYING ||
destroy_state_ == DESTROY_STATE_NONE)
destroy_state_ = DESTROY_STATE_DESTROYED;
widget_delegate_->DeleteDelegate(); widget_delegate_->DeleteDelegate();
widget_delegate_ = NULL; widget_delegate_ = NULL;
} }
......
...@@ -101,20 +101,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, ...@@ -101,20 +101,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
typedef std::set<Widget*> Widgets; typedef std::set<Widget*> Widgets;
enum DestroyState {
// The default, everything is good and alive.
DESTROY_STATE_NONE = 1,
// Set once OnNativeWidgetDestroying has been invoked.
DESTROY_STATE_IN_DESTROYING,
// Set once OnNativeWidgetDestroyed has been invoked.
DESTROY_STATE_DESTROYED,
// Set once the destructor is invoked.
DESTROY_STATE_DELETED,
};
enum FrameType { enum FrameType {
FRAME_TYPE_DEFAULT, // Use whatever the default would be. FRAME_TYPE_DEFAULT, // Use whatever the default would be.
FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame.
...@@ -578,8 +564,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, ...@@ -578,8 +564,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// TYPE_CONTROL and TYPE_TOOLTIP is not considered top level. // TYPE_CONTROL and TYPE_TOOLTIP is not considered top level.
bool is_top_level() const { return is_top_level_; } bool is_top_level() const { return is_top_level_; }
DestroyState destroy_state() const { return destroy_state_; }
// Overridden from NativeWidgetDelegate: // Overridden from NativeWidgetDelegate:
virtual bool IsModal() const OVERRIDE; virtual bool IsModal() const OVERRIDE;
virtual bool IsDialogBox() const OVERRIDE; virtual bool IsDialogBox() const OVERRIDE;
...@@ -743,10 +727,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, ...@@ -743,10 +727,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// Factory used to create Compositors. Settable by tests. // Factory used to create Compositors. Settable by tests.
static ui::Compositor*(*compositor_factory_)(); static ui::Compositor*(*compositor_factory_)();
// Tracks destroy state.
// TODO(sky): remove this, used in tracking 91396.
DestroyState destroy_state_;
DISALLOW_COPY_AND_ASSIGN(Widget); DISALLOW_COPY_AND_ASSIGN(Widget);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment