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

Side by Side Diff: services/ui/ws/platform_display.cc

Issue 2497303002: Fix ws::Display initialization order. (Closed)
Patch Set: Fix use after move in test. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/platform_display_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/platform_display.h" 5 #include "services/ui/ws/platform_display.h"
6 6
7 #include <utility>
8
7 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
8 #include "build/build_config.h" 10 #include "build/build_config.h"
9 #include "cc/ipc/quads.mojom.h" 11 #include "cc/ipc/quads.mojom.h"
10 #include "cc/output/copy_output_request.h" 12 #include "cc/output/copy_output_request.h"
11 #include "cc/output/delegated_frame_data.h" 13 #include "cc/output/delegated_frame_data.h"
12 #include "gpu/ipc/client/gpu_channel_host.h" 14 #include "gpu/ipc/client/gpu_channel_host.h"
13 #include "services/service_manager/public/cpp/connection.h" 15 #include "services/service_manager/public/cpp/connection.h"
14 #include "services/service_manager/public/cpp/connector.h" 16 #include "services/service_manager/public/cpp/connector.h"
15 #include "services/ui/display/platform_screen.h" 17 #include "services/ui/display/platform_screen.h"
16 #include "services/ui/surfaces/display_compositor.h" 18 #include "services/ui/surfaces/display_compositor.h"
(...skipping 20 matching lines...) Expand all
37 #endif 39 #endif
38 40
39 namespace ui { 41 namespace ui {
40 42
41 namespace ws { 43 namespace ws {
42 44
43 // static 45 // static
44 PlatformDisplayFactory* PlatformDisplay::factory_ = nullptr; 46 PlatformDisplayFactory* PlatformDisplay::factory_ = nullptr;
45 47
46 // static 48 // static
47 PlatformDisplay* PlatformDisplay::Create( 49 std::unique_ptr<PlatformDisplay> PlatformDisplay::Create(
48 const PlatformDisplayInitParams& init_params) { 50 const PlatformDisplayInitParams& init_params) {
49 if (factory_) 51 if (factory_)
50 return factory_->CreatePlatformDisplay(); 52 return factory_->CreatePlatformDisplay();
51 53
52 return new DefaultPlatformDisplay(init_params); 54 return base::MakeUnique<DefaultPlatformDisplay>(init_params);
53 } 55 }
54 56
55 DefaultPlatformDisplay::DefaultPlatformDisplay( 57 DefaultPlatformDisplay::DefaultPlatformDisplay(
56 const PlatformDisplayInitParams& init_params) 58 const PlatformDisplayInitParams& init_params)
57 : id_(init_params.display_id), 59 : id_(init_params.display_id),
58 #if !defined(OS_ANDROID) 60 #if !defined(OS_ANDROID)
59 cursor_loader_(ui::CursorLoader::Create()), 61 cursor_loader_(ui::CursorLoader::Create()),
60 #endif 62 #endif
61 frame_generator_(new FrameGenerator(this, init_params.root_window)), 63 frame_generator_(new FrameGenerator(this, init_params.root_window)),
62 metrics_(init_params.metrics) { 64 metrics_(init_params.metrics) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 void DefaultPlatformDisplay::OnWindowStateChanged( 252 void DefaultPlatformDisplay::OnWindowStateChanged(
251 ui::PlatformWindowState new_state) {} 253 ui::PlatformWindowState new_state) {}
252 254
253 void DefaultPlatformDisplay::OnLostCapture() { 255 void DefaultPlatformDisplay::OnLostCapture() {
254 delegate_->OnNativeCaptureLost(); 256 delegate_->OnNativeCaptureLost();
255 } 257 }
256 258
257 void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable( 259 void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable(
258 gfx::AcceleratedWidget widget, 260 gfx::AcceleratedWidget widget,
259 float device_scale_factor) { 261 float device_scale_factor) {
262 // This will get called after Init() is called, either synchronously as part
263 // of the Init() callstack or async after Init() has returned, depending on
264 // the platform.
265 delegate_->OnAcceleratedWidgetAvailable();
260 frame_generator_->OnAcceleratedWidgetAvailable(widget); 266 frame_generator_->OnAcceleratedWidgetAvailable(widget);
261 } 267 }
262 268
263 void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() { 269 void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() {
264 NOTREACHED(); 270 NOTREACHED();
265 } 271 }
266 272
267 void DefaultPlatformDisplay::OnActivationChanged(bool active) {} 273 void DefaultPlatformDisplay::OnActivationChanged(bool active) {}
268 274
269 bool DefaultPlatformDisplay::IsInHighContrastMode() { 275 bool DefaultPlatformDisplay::IsInHighContrastMode() {
270 return delegate_ ? delegate_->IsInHighContrastMode() : false; 276 return delegate_ ? delegate_->IsInHighContrastMode() : false;
271 } 277 }
272 278
273 } // namespace ws 279 } // namespace ws
274 280
275 } // namespace ui 281 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/platform_display.h ('k') | services/ui/ws/platform_display_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698