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

Side by Side Diff: components/mus/ws/platform_display.cc

Issue 1906623003: Convert //components/mus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « components/mus/ws/platform_display.h ('k') | components/mus/ws/server_window.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 "components/mus/ws/platform_display.h" 5 #include "components/mus/ws/platform_display.h"
6 6
7 #include "base/numerics/safe_conversions.h" 7 #include "base/numerics/safe_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController(); 275 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
276 if (ime) 276 if (ime)
277 ime->SetImeVisibility(visible); 277 ime->SetImeVisibility(visible);
278 } 278 }
279 279
280 void DefaultPlatformDisplay::Draw() { 280 void DefaultPlatformDisplay::Draw() {
281 if (!delegate_->GetRootWindow()->visible()) 281 if (!delegate_->GetRootWindow()->visible())
282 return; 282 return;
283 283
284 // TODO(fsamuel): We should add a trace for generating a top level frame. 284 // TODO(fsamuel): We should add a trace for generating a top level frame.
285 scoped_ptr<cc::CompositorFrame> frame(GenerateCompositorFrame()); 285 std::unique_ptr<cc::CompositorFrame> frame(GenerateCompositorFrame());
286 frame_pending_ = true; 286 frame_pending_ = true;
287 if (top_level_display_client_) { 287 if (top_level_display_client_) {
288 top_level_display_client_->SubmitCompositorFrame( 288 top_level_display_client_->SubmitCompositorFrame(
289 std::move(frame), base::Bind(&DefaultPlatformDisplay::DidDraw, 289 std::move(frame), base::Bind(&DefaultPlatformDisplay::DidDraw,
290 weak_factory_.GetWeakPtr())); 290 weak_factory_.GetWeakPtr()));
291 } 291 }
292 dirty_rect_ = gfx::Rect(); 292 dirty_rect_ = gfx::Rect();
293 } 293 }
294 294
295 void DefaultPlatformDisplay::DidDraw() { 295 void DefaultPlatformDisplay::DidDraw() {
(...skipping 26 matching lines...) Expand all
322 mojom::ViewportMetrics old_metrics; 322 mojom::ViewportMetrics old_metrics;
323 old_metrics.size_in_pixels = metrics_.size_in_pixels.Clone(); 323 old_metrics.size_in_pixels = metrics_.size_in_pixels.Clone();
324 old_metrics.device_pixel_ratio = metrics_.device_pixel_ratio; 324 old_metrics.device_pixel_ratio = metrics_.device_pixel_ratio;
325 325
326 metrics_.size_in_pixels = mojo::Size::From(size); 326 metrics_.size_in_pixels = mojo::Size::From(size);
327 metrics_.device_pixel_ratio = device_pixel_ratio; 327 metrics_.device_pixel_ratio = device_pixel_ratio;
328 328
329 delegate_->OnViewportMetricsChanged(old_metrics, metrics_); 329 delegate_->OnViewportMetricsChanged(old_metrics, metrics_);
330 } 330 }
331 331
332 scoped_ptr<cc::CompositorFrame> 332 std::unique_ptr<cc::CompositorFrame>
333 DefaultPlatformDisplay::GenerateCompositorFrame() { 333 DefaultPlatformDisplay::GenerateCompositorFrame() {
334 scoped_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); 334 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
335 render_pass->damage_rect = dirty_rect_; 335 render_pass->damage_rect = dirty_rect_;
336 render_pass->output_rect = gfx::Rect(metrics_.size_in_pixels.To<gfx::Size>()); 336 render_pass->output_rect = gfx::Rect(metrics_.size_in_pixels.To<gfx::Size>());
337 337
338 std::set<WindowId> referenced_window_ids; 338 std::set<WindowId> referenced_window_ids;
339 DrawWindowTree(render_pass.get(), delegate_->GetRootWindow(), gfx::Vector2d(), 339 DrawWindowTree(render_pass.get(), delegate_->GetRootWindow(), gfx::Vector2d(),
340 1.0f, &referenced_window_ids); 340 1.0f, &referenced_window_ids);
341 341
342 scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); 342 std::unique_ptr<cc::DelegatedFrameData> frame_data(
343 new cc::DelegatedFrameData);
343 frame_data->device_scale_factor = metrics_.device_pixel_ratio; 344 frame_data->device_scale_factor = metrics_.device_pixel_ratio;
344 frame_data->render_pass_list.push_back(std::move(render_pass)); 345 frame_data->render_pass_list.push_back(std::move(render_pass));
345 346
346 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); 347 std::unique_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame);
347 frame->delegated_frame_data = std::move(frame_data); 348 frame->delegated_frame_data = std::move(frame_data);
348 return frame; 349 return frame;
349 } 350 }
350 351
351 void DefaultPlatformDisplay::OnBoundsChanged(const gfx::Rect& new_bounds) { 352 void DefaultPlatformDisplay::OnBoundsChanged(const gfx::Rect& new_bounds) {
352 UpdateMetrics(new_bounds.size(), metrics_.device_pixel_ratio); 353 UpdateMetrics(new_bounds.size(), metrics_.device_pixel_ratio);
353 } 354 }
354 355
355 void DefaultPlatformDisplay::OnDamageRect(const gfx::Rect& damaged_region) { 356 void DefaultPlatformDisplay::OnDamageRect(const gfx::Rect& damaged_region) {
356 dirty_rect_.Union(damaged_region); 357 dirty_rect_.Union(damaged_region);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); 424 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio);
424 } 425 }
425 426
426 void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() { 427 void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() {
427 NOTREACHED(); 428 NOTREACHED();
428 } 429 }
429 430
430 void DefaultPlatformDisplay::OnActivationChanged(bool active) {} 431 void DefaultPlatformDisplay::OnActivationChanged(bool active) {}
431 432
432 void DefaultPlatformDisplay::RequestCopyOfOutput( 433 void DefaultPlatformDisplay::RequestCopyOfOutput(
433 scoped_ptr<cc::CopyOutputRequest> output_request) { 434 std::unique_ptr<cc::CopyOutputRequest> output_request) {
434 if (top_level_display_client_) 435 if (top_level_display_client_)
435 top_level_display_client_->RequestCopyOfOutput(std::move(output_request)); 436 top_level_display_client_->RequestCopyOfOutput(std::move(output_request));
436 } 437 }
437 438
438 } // namespace ws 439 } // namespace ws
439 440
440 } // namespace mus 441 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/platform_display.h ('k') | components/mus/ws/server_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698