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

Unified Diff: services/ui/display/screen_manager_ozone_internal.cc

Issue 2692863009: Remove usage of ws::Display in ws::UserDisplayManager. (Closed)
Patch Set: Fix mash_browser_tests. Created 3 years, 10 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: services/ui/display/screen_manager_ozone_internal.cc
diff --git a/services/ui/display/screen_manager_ozone_internal.cc b/services/ui/display/screen_manager_ozone_internal.cc
index 0468312067019cd84dd9df8ec91d3309eeabf268..d175cee4569d6ca7653470f1f146c558a5fdd354 100644
--- a/services/ui/display/screen_manager_ozone_internal.cc
+++ b/services/ui/display/screen_manager_ozone_internal.cc
@@ -60,12 +60,20 @@ std::unique_ptr<ScreenManager> ScreenManager::Create() {
return base::MakeUnique<ScreenManagerOzoneInternal>();
}
-ScreenManagerOzoneInternal::ScreenManagerOzoneInternal() {}
+ScreenManagerOzoneInternal::ScreenManagerOzoneInternal()
+ : screen_owned_(base::MakeUnique<ScreenBase>()),
+ screen_(screen_owned_.get()) {
+ Screen::SetScreenInstance(screen_owned_.get());
+}
ScreenManagerOzoneInternal::~ScreenManagerOzoneInternal() {
// We are shutting down and don't want to make anymore display changes.
fake_display_controller_ = nullptr;
+ // At this point |display_manager_| likely owns the Screen instance. It never
+ // cleans up the instance pointer though, which could cause problems in tests.
+ Screen::SetScreenInstance(nullptr);
+
touch_transform_controller_.reset();
if (display_manager_)
@@ -159,14 +167,9 @@ void ScreenManagerOzoneInternal::Init(ScreenManagerDelegate* delegate) {
native_display_delegate_->GetFakeDisplayController();
}
- // Create a new Screen instance.
- std::unique_ptr<ScreenBase> screen = base::MakeUnique<ScreenBase>();
- Screen::SetScreenInstance(screen.get());
- screen_ = screen.get();
-
// Configure display manager. ScreenManager acts as an observer to find out
// display changes and as a delegate to find out when changes start/stop.
- display_manager_ = base::MakeUnique<DisplayManager>(std::move(screen));
+ display_manager_ = base::MakeUnique<DisplayManager>(std::move(screen_owned_));
display_manager_->set_configure_displays(true);
display_manager_->AddObserver(this);
display_manager_->set_delegate(this);
@@ -200,10 +203,6 @@ void ScreenManagerOzoneInternal::RequestCloseDisplay(int64_t display_id) {
fake_display_controller_->RemoveDisplay(display_id);
}
-int64_t ScreenManagerOzoneInternal::GetPrimaryDisplayId() const {
- return primary_display_id_;
-}
-
void ScreenManagerOzoneInternal::ToggleAddRemoveDisplay() {
if (!fake_display_controller_)
return;
« no previous file with comments | « services/ui/display/screen_manager_ozone_internal.h ('k') | services/ui/display/screen_manager_stub_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698