diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 21:00:46 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-06 21:00:46 +0000 |
commit | 2baa4b428c71526d2b6d58fa58f55f8b5602ca3a (patch) | |
tree | b3e9213e6c6237bd34a3e8ece459d528b8c3499e /views/window | |
parent | 949d0238e22516eb14cafdf12cd1e38d730976cc (diff) | |
download | chromium_src-2baa4b428c71526d2b6d58fa58f55f8b5602ca3a.zip chromium_src-2baa4b428c71526d2b6d58fa58f55f8b5602ca3a.tar.gz chromium_src-2baa4b428c71526d2b6d58fa58f55f8b5602ca3a.tar.bz2 |
some more fixes for ignored scoped_ptr::release() calls
BUG=42904
TEST=bots
Review URL: http://codereview.chromium.org/1982001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46622 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r-- | views/window/window_delegate.cc | 7 | ||||
-rw-r--r-- | views/window/window_delegate.h | 17 | ||||
-rw-r--r-- | views/window/window_gtk.cc | 3 | ||||
-rw-r--r-- | views/window/window_win.cc | 6 |
4 files changed, 10 insertions, 23 deletions
diff --git a/views/window/window_delegate.cc b/views/window/window_delegate.cc index c909739..012dd38 100644 --- a/views/window/window_delegate.cc +++ b/views/window/window_delegate.cc @@ -10,11 +10,10 @@ namespace views { -WindowDelegate::WindowDelegate() { +WindowDelegate::WindowDelegate() : window_(NULL) { } WindowDelegate::~WindowDelegate() { - ReleaseWindow(); } SkBitmap WindowDelegate::GetWindowAppIcon() { @@ -59,8 +58,4 @@ ClientView* WindowDelegate::CreateClientView(Window* window) { return new ClientView(window, GetContentsView()); } -void WindowDelegate::ReleaseWindow() { - window_.release(); -} - } // namespace views diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h index 91491b9..30174c8 100644 --- a/views/window/window_delegate.h +++ b/views/window/window_delegate.h @@ -122,24 +122,13 @@ class WindowDelegate { // of the window. virtual ClientView* CreateClientView(Window* window); - // An accessor to the Window this delegate is bound to. - Window* window() const { return window_.get(); } - - protected: - // Releases the Window* we maintain. This should be done by a delegate in its - // WindowClosing handler if it intends to be re-cycled to be used on a - // different Window. - void ReleaseWindow(); + Window* window() const { return window_; } private: friend class WindowGtk; friend class WindowWin; - // This is a little unusual. We use a scoped_ptr here because it's - // initialized to NULL automatically. We do this because we want to allow - // people using this helper to not have to call a ctor on this object. - // Instead we just release the owning ref this pointer has when we are - // destroyed. - scoped_ptr<Window> window_; + // The Window this delegate is bound to. Weak reference. + Window* window_; }; } // namespace views diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index d0ba7bc..1a5147f 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -377,7 +377,8 @@ WindowGtk::WindowGtk(WindowDelegate* window_delegate) window_state_(GDK_WINDOW_STATE_WITHDRAWN), window_closed_(false) { is_window_ = true; - window_delegate_->window_.reset(this); + DCHECK(!window_delegate_->window_); + window_delegate_->window_ = this; } void WindowGtk::Init(GtkWindow* parent, const gfx::Rect& bounds) { diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 554a9c7..64a2115 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -240,7 +240,8 @@ void WindowWin::Show() { void WindowWin::Activate() { if (IsMinimized()) ::ShowWindow(GetNativeView(), SW_RESTORE); - ::SetWindowPos(GetNativeView(), HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + ::SetWindowPos(GetNativeView(), HWND_TOP, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE); SetForegroundWindow(GetNativeView()); } @@ -509,7 +510,8 @@ WindowWin::WindowWin(WindowDelegate* window_delegate) is_window_ = true; InitClass(); DCHECK(window_delegate_); - window_delegate_->window_.reset(this); + DCHECK(!window_delegate_->window_); + window_delegate_->window_ = this; // Initialize these values to 0 so that subclasses can override the default // behavior before calling Init. set_window_style(0); |