views: Don't leak ViewsDelegate.
This commit is contained in:
parent
651ebdde65
commit
7a196933bb
3 changed files with 10 additions and 3 deletions
|
@ -50,9 +50,7 @@ void BrowserMainParts::ToolkitInitialized() {
|
|||
#endif
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
if (!views::ViewsDelegate::views_delegate)
|
||||
views::ViewsDelegate::views_delegate = new ViewsDelegate;
|
||||
|
||||
views_delegate_.reset(new ViewsDelegate);
|
||||
wm_state_.reset(new wm::WMState);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#include "content/public/browser/browser_main_parts.h"
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
namespace brightray {
|
||||
class ViewsDelegate;
|
||||
}
|
||||
|
||||
namespace wm {
|
||||
class WMState;
|
||||
}
|
||||
|
@ -53,6 +57,7 @@ class BrowserMainParts : public content::BrowserMainParts {
|
|||
scoped_ptr<WebUIControllerFactory> web_ui_controller_factory_;
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
scoped_ptr<ViewsDelegate> views_delegate_;
|
||||
scoped_ptr<wm::WMState> wm_state_;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,9 +9,13 @@
|
|||
namespace brightray {
|
||||
|
||||
ViewsDelegate::ViewsDelegate() {
|
||||
DCHECK(!views::ViewsDelegate::views_delegate);
|
||||
views::ViewsDelegate::views_delegate = this;
|
||||
}
|
||||
|
||||
ViewsDelegate::~ViewsDelegate() {
|
||||
DCHECK_EQ(views::ViewsDelegate::views_delegate, this);
|
||||
views::ViewsDelegate::views_delegate = NULL;
|
||||
}
|
||||
|
||||
void ViewsDelegate::SaveWindowPlacement(const views::Widget* window,
|
||||
|
|
Loading…
Reference in a new issue