diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-27 05:26:25 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-27 05:26:25 +0000 |
commit | daad30be601f55bcd9570a1412389969ca9d5ae9 (patch) | |
tree | 9e9ca919de5122675460f15ba9519d78733bce20 /apps | |
parent | 6bf342a6f557090a138e6d2684a321f96ebc09b7 (diff) | |
download | chromium_src-daad30be601f55bcd9570a1412389969ca9d5ae9.zip chromium_src-daad30be601f55bcd9570a1412389969ca9d5ae9.tar.gz chromium_src-daad30be601f55bcd9570a1412389969ca9d5ae9.tar.bz2 |
apps: Stop leaking TestScreen instance.
gfx::Screen::SetScreenInstance() does not take the ownership of the
pointer passed in and thus if the caller does not own the pointer it
created and is passing to Screen, we end up leaking this object.
This changes makes ShellBrowserMainParts own the TestScreen, so we don't
leak and make sure the object is destroyed when ShellBrowserMainParts
goes away.
This should fix leak that was introduced in crrev.com/241880
BUG=None
TEST=app_shell still runs normally and does not crash even more than it
is used to.
R=jamescook@chromium.org
TBR=yoz
Review URL: https://codereview.chromium.org/120583002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r-- | apps/shell/shell_browser_main_parts.cc | 4 | ||||
-rw-r--r-- | apps/shell/shell_browser_main_parts.h | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/apps/shell/shell_browser_main_parts.cc b/apps/shell/shell_browser_main_parts.cc index e03fdd2..ae442f7 100644 --- a/apps/shell/shell_browser_main_parts.cc +++ b/apps/shell/shell_browser_main_parts.cc @@ -131,9 +131,9 @@ void ShellBrowserMainParts::OnRootWindowHostCloseRequested( } void ShellBrowserMainParts::CreateRootWindow() { + test_screen_.reset(aura::TestScreen::Create()); // TODO(jamescook): Replace this with a real Screen implementation. - gfx::Screen::SetScreenInstance( - gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create()); + gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); // Set up basic pieces of views::corewm. wm_test_helper_.reset(new wm::WMTestHelper(gfx::Size(800, 600))); // Ensure the X window gets mapped. diff --git a/apps/shell/shell_browser_main_parts.h b/apps/shell/shell_browser_main_parts.h index c246c03..2d02cac 100644 --- a/apps/shell/shell_browser_main_parts.h +++ b/apps/shell/shell_browser_main_parts.h @@ -11,6 +11,10 @@ #include "content/public/browser/browser_main_parts.h" #include "ui/aura/root_window_observer.h" +namespace aura { +class TestScreen; +} + namespace base { class FilePath; } @@ -80,6 +84,8 @@ class ShellBrowserMainParts : public content::BrowserMainParts, // Enable a minimal set of views::corewm to be initialized. scoped_ptr<wm::WMTestHelper> wm_test_helper_; + scoped_ptr<aura::TestScreen> test_screen_; + // Owned by the BrowserContextKeyedService system. extensions::ShellExtensionSystem* extension_system_; |