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

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

Issue 2763143002: Remove FrameGenerator::root_window_ (Closed)
Patch Set: Addressed comments Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « services/ui/ws/platform_display_default.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_default.h" 5 #include "services/ui/ws/platform_display_default.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "gpu/ipc/client/gpu_channel_host.h" 8 #include "gpu/ipc/client/gpu_channel_host.h"
9 #include "services/ui/display/screen_manager.h" 9 #include "services/ui/display/screen_manager.h"
10 #include "services/ui/ws/display_client_compositor_frame_sink.h" 10 #include "services/ui/ws/display_client_compositor_frame_sink.h"
(...skipping 19 matching lines...) Expand all
30 namespace ws { 30 namespace ws {
31 31
32 PlatformDisplayDefault::PlatformDisplayDefault( 32 PlatformDisplayDefault::PlatformDisplayDefault(
33 ServerWindow* root_window, 33 ServerWindow* root_window,
34 const display::ViewportMetrics& metrics) 34 const display::ViewportMetrics& metrics)
35 : root_window_(root_window), 35 : root_window_(root_window),
36 #if !defined(OS_ANDROID) 36 #if !defined(OS_ANDROID)
37 image_cursors_(new ImageCursors), 37 image_cursors_(new ImageCursors),
38 #endif 38 #endif
39 metrics_(metrics), 39 metrics_(metrics),
40 widget_(gfx::kNullAcceleratedWidget), 40 widget_(gfx::kNullAcceleratedWidget) {
41 init_device_scale_factor_(metrics.device_scale_factor) {
42 } 41 }
43 42
44 PlatformDisplayDefault::~PlatformDisplayDefault() { 43 PlatformDisplayDefault::~PlatformDisplayDefault() {
45 // Don't notify the delegate from the destructor. 44 // Don't notify the delegate from the destructor.
46 delegate_ = nullptr; 45 delegate_ = nullptr;
47 46
48 frame_generator_.reset(); 47 frame_generator_.reset();
49 // Destroy the PlatformWindow early on as it may call us back during 48 // Destroy the PlatformWindow early on as it may call us back during
50 // destruction and we want to be in a known state. But destroy the surface 49 // destruction and we want to be in a known state. But destroy the surface
51 // first because it can still be using the platform window. 50 // first because it can still be using the platform window.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (metrics_ == metrics) 133 if (metrics_ == metrics)
135 return false; 134 return false;
136 135
137 gfx::Rect bounds = platform_window_->GetBounds(); 136 gfx::Rect bounds = platform_window_->GetBounds();
138 if (bounds.size() != metrics.bounds_in_pixels.size()) { 137 if (bounds.size() != metrics.bounds_in_pixels.size()) {
139 bounds.set_size(metrics.bounds_in_pixels.size()); 138 bounds.set_size(metrics.bounds_in_pixels.size());
140 platform_window_->SetBounds(bounds); 139 platform_window_->SetBounds(bounds);
141 } 140 }
142 141
143 metrics_ = metrics; 142 metrics_ = metrics;
144 if (frame_generator_) 143 if (frame_generator_) {
145 frame_generator_->SetDeviceScaleFactor(metrics_.device_scale_factor); 144 frame_generator_->SetDeviceScaleFactor(metrics_.device_scale_factor);
145 frame_generator_->OnWindowSizeChanged(metrics_.bounds_in_pixels.size());
146 }
146 return true; 147 return true;
147 } 148 }
148 149
149 gfx::AcceleratedWidget PlatformDisplayDefault::GetAcceleratedWidget() const { 150 gfx::AcceleratedWidget PlatformDisplayDefault::GetAcceleratedWidget() const {
150 return widget_; 151 return widget_;
151 } 152 }
152 153
153 void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) { 154 void PlatformDisplayDefault::UpdateEventRootLocation(ui::LocatedEvent* event) {
154 // TODO(riajiang): This is broken for HDPI because it mixes PPs and DIPs. See 155 // TODO(riajiang): This is broken for HDPI because it mixes PPs and DIPs. See
155 // http://crbug.com/701036 for details. 156 // http://crbug.com/701036 for details.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 widget_, mojo::MakeRequest(&compositor_frame_sink), 259 widget_, mojo::MakeRequest(&compositor_frame_sink),
259 std::move(compositor_frame_sink_client), 260 std::move(compositor_frame_sink_client),
260 mojo::MakeRequest(&display_private)); 261 mojo::MakeRequest(&display_private));
261 262
262 auto display_client_compositor_frame_sink = 263 auto display_client_compositor_frame_sink =
263 base::MakeUnique<DisplayClientCompositorFrameSink>( 264 base::MakeUnique<DisplayClientCompositorFrameSink>(
264 root_window_->frame_sink_id(), std::move(compositor_frame_sink), 265 root_window_->frame_sink_id(), std::move(compositor_frame_sink),
265 std::move(display_private), 266 std::move(display_private),
266 std::move(compositor_frame_sink_client_request)); 267 std::move(compositor_frame_sink_client_request));
267 frame_generator_ = base::MakeUnique<FrameGenerator>( 268 frame_generator_ = base::MakeUnique<FrameGenerator>(
268 root_window_, std::move(display_client_compositor_frame_sink)); 269 std::move(display_client_compositor_frame_sink));
269 frame_generator_->SetDeviceScaleFactor(init_device_scale_factor_); 270 frame_generator_->OnWindowSizeChanged(root_window_->bounds().size());
271 frame_generator_->SetDeviceScaleFactor(metrics_.device_scale_factor);
270 } 272 }
271 273
272 void PlatformDisplayDefault::OnAcceleratedWidgetDestroyed() { 274 void PlatformDisplayDefault::OnAcceleratedWidgetDestroyed() {
273 NOTREACHED(); 275 NOTREACHED();
274 } 276 }
275 277
276 void PlatformDisplayDefault::OnActivationChanged(bool active) {} 278 void PlatformDisplayDefault::OnActivationChanged(bool active) {}
277 279
278 } // namespace ws 280 } // namespace ws
279 } // namespace ui 281 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/platform_display_default.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698