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

Side by Side Diff: cc/layers/picture_layer.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase 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 | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/layers/picture_layer.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "cc/layers/content_layer_client.h" 9 #include "cc/layers/content_layer_client.h"
10 #include "cc/layers/picture_layer_impl.h" 10 #include "cc/layers/picture_layer_impl.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 PictureLayer::PictureLayer(ContentLayerClient* client) 26 PictureLayer::PictureLayer(ContentLayerClient* client)
27 : client_(client), 27 : client_(client),
28 instrumentation_object_tracker_(id()), 28 instrumentation_object_tracker_(id()),
29 update_source_frame_number_(-1), 29 update_source_frame_number_(-1),
30 is_mask_(false), 30 is_mask_(false),
31 nearest_neighbor_(false) {} 31 nearest_neighbor_(false) {}
32 32
33 PictureLayer::PictureLayer(ContentLayerClient* client, 33 PictureLayer::PictureLayer(ContentLayerClient* client,
34 scoped_ptr<RecordingSource> source) 34 std::unique_ptr<RecordingSource> source)
35 : PictureLayer(client) { 35 : PictureLayer(client) {
36 recording_source_ = std::move(source); 36 recording_source_ = std::move(source);
37 } 37 }
38 38
39 PictureLayer::~PictureLayer() { 39 PictureLayer::~PictureLayer() {
40 } 40 }
41 41
42 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 42 std::unique_ptr<LayerImpl> PictureLayer::CreateLayerImpl(
43 LayerTreeImpl* tree_impl) {
43 return PictureLayerImpl::Create(tree_impl, id(), is_mask_); 44 return PictureLayerImpl::Create(tree_impl, id(), is_mask_);
44 } 45 }
45 46
46 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { 47 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
47 Layer::PushPropertiesTo(base_layer); 48 Layer::PushPropertiesTo(base_layer);
48 TRACE_EVENT0("cc", "PictureLayer::PushPropertiesTo"); 49 TRACE_EVENT0("cc", "PictureLayer::PushPropertiesTo");
49 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); 50 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
50 // TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer. 51 // TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer.
51 DCHECK_EQ(layer_impl->is_mask(), is_mask_); 52 DCHECK_EQ(layer_impl->is_mask(), is_mask_);
52 DropRecordingSourceContentIfInvalid(); 53 DropRecordingSourceContentIfInvalid();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 129 }
129 130
130 sk_sp<SkPicture> PictureLayer::GetPicture() const { 131 sk_sp<SkPicture> PictureLayer::GetPicture() const {
131 // We could either flatten the RecordingSource into a single 132 // We could either flatten the RecordingSource into a single
132 // SkPicture, or paint a fresh one depending on what we intend to do with the 133 // SkPicture, or paint a fresh one depending on what we intend to do with the
133 // picture. For now we just paint a fresh one to get consistent results. 134 // picture. For now we just paint a fresh one to get consistent results.
134 if (!DrawsContent()) 135 if (!DrawsContent())
135 return nullptr; 136 return nullptr;
136 137
137 gfx::Size layer_size = bounds(); 138 gfx::Size layer_size = bounds();
138 scoped_ptr<RecordingSource> recording_source(new RecordingSource); 139 std::unique_ptr<RecordingSource> recording_source(new RecordingSource);
139 Region recording_invalidation; 140 Region recording_invalidation;
140 recording_source->UpdateAndExpandInvalidation( 141 recording_source->UpdateAndExpandInvalidation(
141 client_, &recording_invalidation, layer_size, update_source_frame_number_, 142 client_, &recording_invalidation, layer_size, update_source_frame_number_,
142 RecordingSource::RECORD_NORMALLY); 143 RecordingSource::RECORD_NORMALLY);
143 144
144 scoped_refptr<RasterSource> raster_source = 145 scoped_refptr<RasterSource> raster_source =
145 recording_source->CreateRasterSource(false); 146 recording_source->CreateRasterSource(false);
146 147
147 return raster_source->GetFlattenedPicture(); 148 return raster_source->GetFlattenedPicture();
148 } 149 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 if (update_source_frame_number_ != source_frame_number && 235 if (update_source_frame_number_ != source_frame_number &&
235 recording_source_bounds != layer_bounds) { 236 recording_source_bounds != layer_bounds) {
236 // Update may not get called for the layer (if it's not in the viewport 237 // Update may not get called for the layer (if it's not in the viewport
237 // for example), even though it has resized making the recording source no 238 // for example), even though it has resized making the recording source no
238 // longer valid. In this case just destroy the recording source. 239 // longer valid. In this case just destroy the recording source.
239 recording_source_->SetEmptyBounds(); 240 recording_source_->SetEmptyBounds();
240 } 241 }
241 } 242 }
242 243
243 } // namespace cc 244 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698