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

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

Issue 2397843003: cc/blimp: Add (de)-serialization for PictureLayer and ScrollbarLayer. (Closed)
Patch Set: Addressed comments Created 4 years, 2 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/layer_unittest.cc ('k') | cc/layers/solid_color_scrollbar_layer.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/blimp/client_picture_cache.h" 9 #include "cc/blimp/client_picture_cache.h"
10 #include "cc/blimp/engine_picture_cache.h" 10 #include "cc/blimp/engine_picture_cache.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 void PictureLayer::SetTypeForProtoSerialization(proto::LayerNode* proto) const { 205 void PictureLayer::SetTypeForProtoSerialization(proto::LayerNode* proto) const {
206 proto->set_type(proto::LayerNode::PICTURE_LAYER); 206 proto->set_type(proto::LayerNode::PICTURE_LAYER);
207 } 207 }
208 208
209 void PictureLayer::LayerSpecificPropertiesToProto(proto::LayerProperties* proto, 209 void PictureLayer::LayerSpecificPropertiesToProto(proto::LayerProperties* proto,
210 bool inputs_only) { 210 bool inputs_only) {
211 Layer::LayerSpecificPropertiesToProto(proto, inputs_only); 211 Layer::LayerSpecificPropertiesToProto(proto, inputs_only);
212 DropRecordingSourceContentIfInvalid(); 212 DropRecordingSourceContentIfInvalid();
213 proto::PictureLayerProperties* picture = proto->mutable_picture();
213 214
214 proto::PictureLayerProperties* picture = proto->mutable_picture(); 215 picture->set_nearest_neighbor(picture_layer_inputs_.nearest_neighbor);
215 recording_source_->ToProtobuf(picture->mutable_recording_source());
216
217 RectToProto(picture_layer_inputs_.recorded_viewport, 216 RectToProto(picture_layer_inputs_.recorded_viewport,
218 picture->mutable_recorded_viewport()); 217 picture->mutable_recorded_viewport());
219 if (picture_layer_inputs_.display_list) { 218 if (picture_layer_inputs_.display_list) {
220 picture_layer_inputs_.display_list->ToProtobuf( 219 picture_layer_inputs_.display_list->ToProtobuf(
221 picture->mutable_display_list()); 220 picture->mutable_display_list());
222 for (const auto& item : *picture_layer_inputs_.display_list) { 221 for (const auto& item : *picture_layer_inputs_.display_list) {
223 sk_sp<const SkPicture> picture = item.GetPicture(); 222 sk_sp<const SkPicture> picture = item.GetPicture();
224 // Only DrawingDisplayItems have SkPictures. 223 // Only DrawingDisplayItems have SkPictures.
225 if (!picture) 224 if (!picture)
226 continue; 225 continue;
227 226
228 GetLayerTree()->engine_picture_cache()->MarkUsed(picture.get()); 227 GetLayerTree()->engine_picture_cache()->MarkUsed(picture.get());
229 } 228 }
230 } 229 }
231 230
231 if (inputs_only)
232 return;
233
234 recording_source_->ToProtobuf(picture->mutable_recording_source());
232 RegionToProto(last_updated_invalidation_, picture->mutable_invalidation()); 235 RegionToProto(last_updated_invalidation_, picture->mutable_invalidation());
233 picture->set_is_mask(is_mask_); 236 picture->set_is_mask(is_mask_);
234 picture->set_nearest_neighbor(picture_layer_inputs_.nearest_neighbor);
235
236 picture->set_update_source_frame_number(update_source_frame_number_); 237 picture->set_update_source_frame_number(update_source_frame_number_);
237
238 last_updated_invalidation_.Clear(); 238 last_updated_invalidation_.Clear();
239 } 239 }
240 240
241 void PictureLayer::FromLayerSpecificPropertiesProto( 241 void PictureLayer::FromLayerSpecificPropertiesProto(
242 const proto::LayerProperties& proto) { 242 const proto::LayerProperties& proto) {
243 Layer::FromLayerSpecificPropertiesProto(proto); 243 Layer::FromLayerSpecificPropertiesProto(proto);
244 const proto::PictureLayerProperties& picture = proto.picture(); 244 const proto::PictureLayerProperties& picture = proto.picture();
245 // If this is a new layer, ensure it has a recording source. During layer 245 // If this is a new layer, ensure it has a recording source. During layer
246 // hierarchy deserialization, ::SetLayerTreeHost(...) is not called, but 246 // hierarchy deserialization, ::SetLayerTreeHost(...) is not called, but
247 // instead the member is set directly, so it needs to be set here explicitly. 247 // instead the member is set directly, so it needs to be set here explicitly.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 picture_layer_inputs_.display_list = nullptr; 311 picture_layer_inputs_.display_list = nullptr;
312 picture_layer_inputs_.painter_reported_memory_usage = 0; 312 picture_layer_inputs_.painter_reported_memory_usage = 0;
313 } 313 }
314 } 314 }
315 315
316 const DisplayItemList* PictureLayer::GetDisplayItemList() { 316 const DisplayItemList* PictureLayer::GetDisplayItemList() {
317 return picture_layer_inputs_.display_list.get(); 317 return picture_layer_inputs_.display_list.get();
318 } 318 }
319 319
320 } // namespace cc 320 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_unittest.cc ('k') | cc/layers/solid_color_scrollbar_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698