diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 14:57:39 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 14:57:39 +0000 |
commit | 58482fa71a6f927029feecacb576101486dd023b (patch) | |
tree | b7bb4cea8920886cbf2d9526d8c26cdab7b669be /ash | |
parent | 2712116dfb62e2e6794aa7878b65f130b337104f (diff) | |
download | chromium_src-58482fa71a6f927029feecacb576101486dd023b.zip chromium_src-58482fa71a6f927029feecacb576101486dd023b.tar.gz chromium_src-58482fa71a6f927029feecacb576101486dd023b.tar.bz2 |
Remove the singleton instance get/delete methods from RootWindow (yay)
http://crbug.com/112131
TEST=none
Review URL: http://codereview.chromium.org/9535025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124635 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, 20 insertions, 17 deletions
diff --git a/ash/shell.cc b/ash/shell.cc index 52e25d1..651068f 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -270,11 +270,7 @@ internal::WorkspaceController* Shell::TestApi::workspace_controller() { // Shell, public: Shell::Shell(ShellDelegate* delegate) - : root_filter_(new internal::RootWindowEventFilter), -#if !defined(OS_MACOSX) - nested_dispatcher_controller_(new NestedDispatcherController), - accelerator_controller_(new AcceleratorController), -#endif + : root_window_(new aura::RootWindow), delegate_(delegate), audio_controller_(NULL), brightness_controller_(NULL), @@ -283,8 +279,6 @@ 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() { @@ -320,7 +314,10 @@ 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 @@ -356,10 +353,18 @@ void Shell::DeleteInstance() { // static aura::RootWindow* Shell::GetRootWindow() { - return aura::RootWindow::GetInstance(); + return GetInstance()->root_window_.get(); } 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 2413c4b..40d5e20 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -252,6 +252,8 @@ 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 34611d3..a5dbccf 100644 --- a/ash/shell/shell_main.cc +++ b/ash/shell/shell_main.cc @@ -268,7 +268,6 @@ 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 8b0f23e..be7fd5e 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -13,18 +13,12 @@ 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; @@ -32,6 +26,9 @@ 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); } @@ -40,10 +37,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) { |