Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Unified Diff: ash/shell.cc

Issue 138003007: [Cleanup] Screen cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix conflict Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index be5661516138f8434135232c6519f6cf54039851..997d59e49f8d8427dcf296eaa46ad9f36160f545 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -35,7 +35,6 @@
#include "ash/media_delegate.h"
#include "ash/new_window_delegate.h"
#include "ash/root_window_controller.h"
-#include "ash/screen_ash.h"
#include "ash/session_state_delegate.h"
#include "ash/shelf/app_list_shelf_item_delegate.h"
#include "ash/shelf/shelf_delegate.h"
@@ -549,8 +548,7 @@ void Shell::DoInitialWorkspaceAnimation() {
// Shell, private:
Shell::Shell(ShellDelegate* delegate)
- : screen_(new ScreenAsh),
- target_root_window_(NULL),
+ : target_root_window_(NULL),
scoped_target_root_window_(NULL),
delegate_(delegate),
window_positioner_(new WindowPositioner),
@@ -566,10 +564,12 @@ Shell::Shell(ShellDelegate* delegate)
DCHECK(delegate_.get());
display_manager_.reset(new internal::DisplayManager);
- ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_);
- if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE))
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_);
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE,
+ display_manager_->screen());
+ if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) {
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE,
+ display_manager_->screen());
+ }
Jun Mukai 2014/01/15 19:20:15 If the screen object is owned by DisplayManager, I
oshima 2014/01/15 19:42:51 That's good point, although I can't move the shutd
display_controller_.reset(new DisplayController);
#if defined(OS_CHROMEOS) && defined(USE_X11)
bool is_panel_fitting_disabled =
@@ -691,6 +691,16 @@ Shell::~Shell() {
resolution_notification_controller_.reset();
desktop_background_controller_.reset();
+ bool native_is_alternative =
+ gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE) ==
+ gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_ALTERNATE);
+ gfx::Screen* for_shutdown =
+ display_manager_->CreateScreenForShutdown();
+ // This object should be alive until the end.
+ ANNOTATE_LEAKING_OBJECT_PTR(for_shutdown);
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, for_shutdown);
+ if (native_is_alternative)
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, for_shutdown);
// This also deletes all RootWindows. Note that we invoke Shutdown() on
// DisplayController before resetting |display_controller_|, since destruction
@@ -794,7 +804,7 @@ void Shell::Init() {
resolution_notification_controller_.reset(
new internal::ResolutionNotificationController);
- cursor_manager_.SetDisplay(DisplayController::GetPrimaryDisplay());
+ cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay());
nested_dispatcher_controller_.reset(new NestedDispatcherController);
accelerator_controller_.reset(new AcceleratorController);

Powered by Google App Engine
This is Rietveld 408576698