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

Side by Side Diff: ui/ozone/platform/drm/host/drm_overlay_manager.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr 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
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 "ui/ozone/platform/drm/host/drm_overlay_manager.h" 5 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/ptr_util.h"
12 #include "ui/gfx/geometry/rect_conversions.h" 13 #include "ui/gfx/geometry/rect_conversions.h"
13 #include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h" 14 #include "ui/ozone/platform/drm/host/drm_overlay_candidates_host.h"
14 #include "ui/ozone/platform/drm/host/drm_window_host.h" 15 #include "ui/ozone/platform/drm/host/drm_window_host.h"
15 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" 16 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h"
16 #include "ui/ozone/public/ozone_switches.h" 17 #include "ui/ozone/public/ozone_switches.h"
17 18
18 namespace ui { 19 namespace ui {
19 20
20 typedef OverlayCandidatesOzone::OverlaySurfaceCandidateList 21 typedef OverlayCandidatesOzone::OverlaySurfaceCandidateList
21 OverlaySurfaceCandidateList; 22 OverlaySurfaceCandidateList;
22 typedef OverlayCandidatesOzone::OverlaySurfaceCandidate OverlaySurfaceCandidate; 23 typedef OverlayCandidatesOzone::OverlaySurfaceCandidate OverlaySurfaceCandidate;
23 24
24 namespace { 25 namespace {
25 const size_t kMaxCacheSize = 200; 26 const size_t kMaxCacheSize = 200;
26 } // namespace 27 } // namespace
27 28
28 DrmOverlayManager::DrmOverlayManager(GpuThreadAdapter* proxy, 29 DrmOverlayManager::DrmOverlayManager(GpuThreadAdapter* proxy,
29 DrmWindowHostManager* window_manager) 30 DrmWindowHostManager* window_manager)
30 : proxy_(proxy), window_manager_(window_manager), cache_(kMaxCacheSize) { 31 : proxy_(proxy), window_manager_(window_manager), cache_(kMaxCacheSize) {
31 is_supported_ = base::CommandLine::ForCurrentProcess()->HasSwitch( 32 is_supported_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
32 switches::kOzoneTestSingleOverlaySupport); 33 switches::kOzoneTestSingleOverlaySupport);
33 proxy_->RegisterHandlerForDrmOverlayManager(this); 34 proxy_->RegisterHandlerForDrmOverlayManager(this);
34 } 35 }
35 36
36 DrmOverlayManager::~DrmOverlayManager() { 37 DrmOverlayManager::~DrmOverlayManager() {
37 proxy_->UnRegisterHandlerForDrmOverlayManager(); 38 proxy_->UnRegisterHandlerForDrmOverlayManager();
38 } 39 }
39 40
40 scoped_ptr<OverlayCandidatesOzone> DrmOverlayManager::CreateOverlayCandidates( 41 std::unique_ptr<OverlayCandidatesOzone>
41 gfx::AcceleratedWidget w) { 42 DrmOverlayManager::CreateOverlayCandidates(gfx::AcceleratedWidget w) {
42 if (!is_supported_) 43 if (!is_supported_)
43 return nullptr; 44 return nullptr;
44 return make_scoped_ptr(new DrmOverlayCandidatesHost(this, w)); 45 return base::WrapUnique(new DrmOverlayCandidatesHost(this, w));
45 } 46 }
46 47
47 void DrmOverlayManager::CheckOverlaySupport( 48 void DrmOverlayManager::CheckOverlaySupport(
48 OverlayCandidatesOzone::OverlaySurfaceCandidateList* candidates, 49 OverlayCandidatesOzone::OverlaySurfaceCandidateList* candidates,
49 gfx::AcceleratedWidget widget) { 50 gfx::AcceleratedWidget widget) {
50 std::vector<OverlayCheck_Params> overlay_params; 51 std::vector<OverlayCheck_Params> overlay_params;
51 for (auto& candidate : *candidates) { 52 for (auto& candidate : *candidates) {
52 // Reject candidates that don't fall on a pixel boundary. 53 // Reject candidates that don't fall on a pixel boundary.
53 if (!gfx::IsNearestRectWithinDistance(candidate.display_rect, 0.01f)) { 54 if (!gfx::IsNearestRectWithinDistance(candidate.display_rect, 0.01f)) {
54 DCHECK(candidate.plane_z_order != 0); 55 DCHECK(candidate.plane_z_order != 0);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 147 }
147 148
148 if (candidate.is_clipped && 149 if (candidate.is_clipped &&
149 !candidate.clip_rect.Contains(candidate.quad_rect_in_target_space)) 150 !candidate.clip_rect.Contains(candidate.quad_rect_in_target_space))
150 return false; 151 return false;
151 152
152 return true; 153 return true;
153 } 154 }
154 155
155 } // namespace ui 156 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/host/drm_overlay_manager.h ('k') | ui/ozone/platform/drm/host/drm_window_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698