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

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

Issue 2646623002: cc: Remove all blimp code from cc. (Closed)
Patch Set: test build Created 3 years, 11 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_unittest.cc » ('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/blimp/client_picture_cache.h"
10 #include "cc/blimp/engine_picture_cache.h"
11 #include "cc/layers/content_layer_client.h" 9 #include "cc/layers/content_layer_client.h"
12 #include "cc/layers/picture_layer_impl.h" 10 #include "cc/layers/picture_layer_impl.h"
13 #include "cc/playback/recording_source.h" 11 #include "cc/playback/recording_source.h"
14 #include "cc/proto/cc_conversions.h"
15 #include "cc/proto/gfx_conversions.h"
16 #include "cc/proto/layer.pb.h"
17 #include "cc/trees/layer_tree_host.h" 12 #include "cc/trees/layer_tree_host.h"
18 #include "cc/trees/layer_tree_impl.h" 13 #include "cc/trees/layer_tree_impl.h"
19 #include "third_party/skia/include/core/SkPictureRecorder.h" 14 #include "third_party/skia/include/core/SkPictureRecorder.h"
20 #include "ui/gfx/geometry/rect_conversions.h" 15 #include "ui/gfx/geometry/rect_conversions.h"
21 16
22 namespace cc { 17 namespace cc {
23 18
24 PictureLayer::PictureLayerInputs::PictureLayerInputs() = default; 19 PictureLayer::PictureLayerInputs::PictureLayerInputs() = default;
25 20
26 PictureLayer::PictureLayerInputs::~PictureLayerInputs() = default; 21 PictureLayer::PictureLayerInputs::~PictureLayerInputs() = default;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return; 190 return;
196 191
197 picture_layer_inputs_.nearest_neighbor = nearest_neighbor; 192 picture_layer_inputs_.nearest_neighbor = nearest_neighbor;
198 SetNeedsCommit(); 193 SetNeedsCommit();
199 } 194 }
200 195
201 bool PictureLayer::HasDrawableContent() const { 196 bool PictureLayer::HasDrawableContent() const {
202 return picture_layer_inputs_.client && Layer::HasDrawableContent(); 197 return picture_layer_inputs_.client && Layer::HasDrawableContent();
203 } 198 }
204 199
205 void PictureLayer::SetTypeForProtoSerialization(proto::LayerNode* proto) const {
206 proto->set_type(proto::LayerNode::PICTURE_LAYER);
207 }
208
209 void PictureLayer::ToLayerPropertiesProto(proto::LayerProperties* proto) {
210 DCHECK(GetLayerTree());
211 DCHECK(GetLayerTree()->engine_picture_cache());
212
213 Layer::ToLayerPropertiesProto(proto);
214 DropRecordingSourceContentIfInvalid();
215 proto::PictureLayerProperties* picture = proto->mutable_picture();
216
217 picture->set_nearest_neighbor(picture_layer_inputs_.nearest_neighbor);
218 RectToProto(picture_layer_inputs_.recorded_viewport,
219 picture->mutable_recorded_viewport());
220 if (picture_layer_inputs_.display_list) {
221 picture_layer_inputs_.display_list->ToProtobuf(
222 picture->mutable_display_list());
223 for (const auto& item : *picture_layer_inputs_.display_list) {
224 sk_sp<const SkPicture> picture = item.GetPicture();
225 // Only DrawingDisplayItems have SkPictures.
226 if (!picture)
227 continue;
228
229 GetLayerTree()->engine_picture_cache()->MarkUsed(picture.get());
230 }
231 }
232 }
233
234 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 200 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
235 benchmark->RunOnLayer(this); 201 benchmark->RunOnLayer(this);
236 } 202 }
237 203
238 void PictureLayer::DropRecordingSourceContentIfInvalid() { 204 void PictureLayer::DropRecordingSourceContentIfInvalid() {
239 int source_frame_number = layer_tree_host()->SourceFrameNumber(); 205 int source_frame_number = layer_tree_host()->SourceFrameNumber();
240 gfx::Size recording_source_bounds = recording_source_->GetSize(); 206 gfx::Size recording_source_bounds = recording_source_->GetSize();
241 207
242 gfx::Size layer_bounds = bounds(); 208 gfx::Size layer_bounds = bounds();
243 if (paint_properties().source_frame_number == source_frame_number) 209 if (paint_properties().source_frame_number == source_frame_number)
(...skipping 16 matching lines...) Expand all
260 picture_layer_inputs_.display_list = nullptr; 226 picture_layer_inputs_.display_list = nullptr;
261 picture_layer_inputs_.painter_reported_memory_usage = 0; 227 picture_layer_inputs_.painter_reported_memory_usage = 0;
262 } 228 }
263 } 229 }
264 230
265 const DisplayItemList* PictureLayer::GetDisplayItemList() { 231 const DisplayItemList* PictureLayer::GetDisplayItemList() {
266 return picture_layer_inputs_.display_list.get(); 232 return picture_layer_inputs_.display_list.get();
267 } 233 }
268 234
269 } // namespace cc 235 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698