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

Side by Side Diff: gpu/ipc/service/ca_layer_partial_damage_tree_mac.mm

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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 | « gpu/ipc/service/ca_layer_partial_damage_tree_mac.h ('k') | gpu/ipc/service/ca_layer_tree_mac.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 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 "gpu/ipc/service/ca_layer_partial_damage_tree_mac.h" 5 #include "gpu/ipc/service/ca_layer_partial_damage_tree_mac.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/mac/sdk_forward_declarations.h" 9 #include "base/mac/sdk_forward_declarations.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 // If there is no damage, don't change anything. 119 // If there is no damage, don't change anything.
120 if (pixel_damage_rect.IsEmpty()) { 120 if (pixel_damage_rect.IsEmpty()) {
121 std::swap(partial_damage_planes_, old_tree->partial_damage_planes_); 121 std::swap(partial_damage_planes_, old_tree->partial_damage_planes_);
122 return; 122 return;
123 } 123 }
124 124
125 // Find the last partial damage plane to re-use the CALayer from. Grow the 125 // Find the last partial damage plane to re-use the CALayer from. Grow the
126 // new rect for this layer to include this damage, and all nearby partial 126 // new rect for this layer to include this damage, and all nearby partial
127 // damage layers. 127 // damage layers.
128 scoped_ptr<OverlayPlane> plane_for_swap; 128 std::unique_ptr<OverlayPlane> plane_for_swap;
129 { 129 {
130 auto plane_to_reuse_iter = old_tree->partial_damage_planes_.end(); 130 auto plane_to_reuse_iter = old_tree->partial_damage_planes_.end();
131 gfx::Rect plane_to_reuse_enlarged_pixel_damage_rect; 131 gfx::Rect plane_to_reuse_enlarged_pixel_damage_rect;
132 132
133 for (auto old_plane_iter = old_tree->partial_damage_planes_.begin(); 133 for (auto old_plane_iter = old_tree->partial_damage_planes_.begin();
134 old_plane_iter != old_tree->partial_damage_planes_.end(); 134 old_plane_iter != old_tree->partial_damage_planes_.end();
135 ++old_plane_iter) { 135 ++old_plane_iter) {
136 gfx::Rect enlarged_pixel_damage_rect = 136 gfx::Rect enlarged_pixel_damage_rect =
137 (*old_plane_iter)->pixel_frame_rect; 137 (*old_plane_iter)->pixel_frame_rect;
138 enlarged_pixel_damage_rect.Union(pixel_damage_rect); 138 enlarged_pixel_damage_rect.Union(pixel_damage_rect);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (!old_plane_covered_by_swap) { 200 if (!old_plane_covered_by_swap) {
201 DCHECK(old_plane->ca_layer); 201 DCHECK(old_plane->ca_layer);
202 partial_damage_planes_.push_back(std::move(old_plane)); 202 partial_damage_planes_.push_back(std::move(old_plane));
203 } 203 }
204 } 204 }
205 205
206 partial_damage_planes_.push_back(std::move(plane_for_swap)); 206 partial_damage_planes_.push_back(std::move(plane_for_swap));
207 } 207 }
208 208
209 void CALayerPartialDamageTree::UpdateRootAndPartialDamagePlanes( 209 void CALayerPartialDamageTree::UpdateRootAndPartialDamagePlanes(
210 scoped_ptr<CALayerPartialDamageTree> old_tree, 210 std::unique_ptr<CALayerPartialDamageTree> old_tree,
211 const gfx::Rect& pixel_damage_rect) { 211 const gfx::Rect& pixel_damage_rect) {
212 // First update the partial damage tree. 212 // First update the partial damage tree.
213 UpdatePartialDamagePlanes(old_tree.get(), pixel_damage_rect); 213 UpdatePartialDamagePlanes(old_tree.get(), pixel_damage_rect);
214 if (old_tree) { 214 if (old_tree) {
215 if (partial_damage_planes_.empty()) { 215 if (partial_damage_planes_.empty()) {
216 // If there are no partial damage planes, then we will be updating the 216 // If there are no partial damage planes, then we will be updating the
217 // root layer. Take the CALayer from the old tree. 217 // root layer. Take the CALayer from the old tree.
218 root_plane_->TakeCALayerFrom(old_tree->root_plane_.get()); 218 root_plane_->TakeCALayerFrom(old_tree->root_plane_.get());
219 } else { 219 } else {
220 // If there is a partial damage tree, then just take the old plane 220 // If there is a partial damage tree, then just take the old plane
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 CALayerPartialDamageTree::~CALayerPartialDamageTree() {} 270 CALayerPartialDamageTree::~CALayerPartialDamageTree() {}
271 271
272 base::ScopedCFTypeRef<IOSurfaceRef> 272 base::ScopedCFTypeRef<IOSurfaceRef>
273 CALayerPartialDamageTree::RootLayerIOSurface() { 273 CALayerPartialDamageTree::RootLayerIOSurface() {
274 return root_plane_->io_surface; 274 return root_plane_->io_surface;
275 } 275 }
276 276
277 void CALayerPartialDamageTree::CommitCALayers( 277 void CALayerPartialDamageTree::CommitCALayers(
278 CALayer* superlayer, 278 CALayer* superlayer,
279 scoped_ptr<CALayerPartialDamageTree> old_tree, 279 std::unique_ptr<CALayerPartialDamageTree> old_tree,
280 float scale_factor, 280 float scale_factor,
281 const gfx::Rect& pixel_damage_rect) { 281 const gfx::Rect& pixel_damage_rect) {
282 TRACE_EVENT0("gpu", "CALayerPartialDamageTree::CommitCALayers"); 282 TRACE_EVENT0("gpu", "CALayerPartialDamageTree::CommitCALayers");
283 UpdateRootAndPartialDamagePlanes(std::move(old_tree), pixel_damage_rect); 283 UpdateRootAndPartialDamagePlanes(std::move(old_tree), pixel_damage_rect);
284 UpdateCALayers(superlayer, scale_factor); 284 UpdateCALayers(superlayer, scale_factor);
285 } 285 }
286 286
287 } // namespace gpu 287 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/ca_layer_partial_damage_tree_mac.h ('k') | gpu/ipc/service/ca_layer_tree_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698