diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 21:05:04 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 21:05:04 +0000 |
commit | be8857a9da76bd9428f78f62feffa92bc2918023 (patch) | |
tree | f48642693658270ff1214761f3ecd5f6b55c24e0 /ash | |
parent | ee847afb8a3c6cb9efba2c625a8a56083df81afb (diff) | |
download | chromium_src-be8857a9da76bd9428f78f62feffa92bc2918023.zip chromium_src-be8857a9da76bd9428f78f62feffa92bc2918023.tar.gz chromium_src-be8857a9da76bd9428f78f62feffa92bc2918023.tar.bz2 |
Revert 124461 - Remove the singleton instance get/delete methods from RootWindow (yay)
http://crbug.com/112131
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9535025
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9564023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124479 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/shell.cc | 21 | ||||
-rw-r--r-- | ash/shell.h | 2 | ||||
-rw-r--r-- | ash/shell/shell_main.cc | 1 | ||||
-rw-r--r-- | ash/test/ash_test_base.cc | 13 |
4 files changed, 17 insertions, 20 deletions
diff --git a/ash/shell.cc b/ash/shell.cc index 651068f..52e25d1 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -270,7 +270,11 @@ internal::WorkspaceController* Shell::TestApi::workspace_controller() { // Shell, public: Shell::Shell(ShellDelegate* delegate) - : root_window_(new aura::RootWindow), + : root_filter_(new internal::RootWindowEventFilter), +#if !defined(OS_MACOSX) + nested_dispatcher_controller_(new NestedDispatcherController), + accelerator_controller_(new AcceleratorController), +#endif delegate_(delegate), audio_controller_(NULL), brightness_controller_(NULL), @@ -279,6 +283,8 @@ Shell::Shell(ShellDelegate* delegate) desktop_background_mode_(BACKGROUND_IMAGE), root_window_layout_(NULL), status_widget_(NULL) { + // Pass ownership of the filter to the root window. + GetRootWindow()->SetEventFilter(root_filter_); } Shell::~Shell() { @@ -314,10 +320,7 @@ Shell::~Shell() { // These need a valid Shell instance to clean up properly, so explicitly // delete them before invalidating the instance. - // Alphabetical. - activation_controller_.reset(); drag_drop_controller_.reset(); - shadow_controller_.reset(); window_cycle_controller_.reset(); // Launcher widget has a InputMethodBridge that references to @@ -353,18 +356,10 @@ void Shell::DeleteInstance() { // static aura::RootWindow* Shell::GetRootWindow() { - return GetInstance()->root_window_.get(); + return aura::RootWindow::GetInstance(); } void Shell::Init() { - root_filter_ = new internal::RootWindowEventFilter; -#if !defined(OS_MACOSX) - nested_dispatcher_controller_.reset(new NestedDispatcherController); - accelerator_controller_.reset(new AcceleratorController); -#endif - // Pass ownership of the filter to the root window. - GetRootWindow()->SetEventFilter(root_filter_); - DCHECK(!GetRootWindowEventFilterCount()); // PartialScreenshotEventFilter must be the first one to capture key diff --git a/ash/shell.h b/ash/shell.h index 40d5e20..2413c4b 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -252,8 +252,6 @@ class ASH_EXPORT Shell { // when the screen is initially created. static bool initially_hide_cursor_; - scoped_ptr<aura::RootWindow> root_window_; - internal::RootWindowEventFilter* root_filter_; // not owned std::vector<WindowAndBoundsPair> to_restore_; diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc index a5dbccf..34611d3 100644 --- a/ash/shell/shell_main.cc +++ b/ash/shell/shell_main.cc @@ -268,6 +268,7 @@ int main(int argc, char** argv) { ash::Shell::DeleteInstance(); + aura::RootWindow::DeleteInstance(); aura::Env::DeleteInstance(); ui::CompositorTestSupport::Terminate(); diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index be7fd5e..8b0f23e 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -13,12 +13,18 @@ namespace ash { namespace test { AshTestBase::AshTestBase() { + helper_.InitRootWindow(Shell::GetRootWindow()); } AshTestBase::~AshTestBase() { + // Ensure that we don't use the previously-allocated static RootWindow object + // later -- on Linux, it holds a reference to our message loop's X connection. + aura::RootWindow::DeleteInstance(); } void AshTestBase::SetUp() { + helper_.SetUp(); + // Creates Shell and hook with Desktop. TestShellDelegate* delegate = new TestShellDelegate; Shell::WindowMode window_mode = Shell::MODE_OVERLAPPING; @@ -26,9 +32,6 @@ void AshTestBase::SetUp() { delegate->SetOverrideWindowMode(window_mode); ash::Shell::CreateInstance(delegate); - helper_.SetUp(); - helper_.InitRootWindow(Shell::GetRootWindow()); - // Disable animations during tests. ui::LayerAnimator::set_disable_animations_for_test(true); } @@ -37,10 +40,10 @@ void AshTestBase::TearDown() { // Flush the message loop to finish pending release tasks. RunAllPendingInMessageLoop(); - helper_.TearDown(); - // Tear down the shell. Shell::DeleteInstance(); + + helper_.TearDown(); } bool AshTestBase::GetOverrideWindowMode(Shell::WindowMode* window_mode) { |