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

Unified Diff: cc/layers/picture_layer.cc

Issue 1982893002: [blimp] Add SkPicture caching support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from kmarshall Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/picture_layer.cc
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 526c7a498e72a2b52e3eb70014116f7cd66fa74f..99e203a1ec1604c4b689ef2143eefe69161182ff 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -72,6 +72,17 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
if (!recording_source_)
recording_source_.reset(new RecordingSource);
+
+ // Ensure the recording source has a pointer to the correct picture cache.
+ if (layer_tree_host()->IsRemoteServer()) {
+ recording_source_->SetEnginePictureCache(
+ layer_tree_host()->engine_picture_cache());
+ }
+ if (layer_tree_host()->IsRemoteClient()) {
+ recording_source_->SetClientPictureCache(
+ layer_tree_host()->client_picture_cache());
+ }
+
recording_source_->SetSlowdownRasterScaleFactor(
host->debug_state().slow_down_raster_scale_factor);
// If we need to enable image decode tasks, then we have to generate the
@@ -179,9 +190,8 @@ void PictureLayer::LayerSpecificPropertiesToProto(
DropRecordingSourceContentIfInvalid();
proto::PictureLayerProperties* picture = proto->mutable_picture();
- recording_source_->ToProtobuf(
- picture->mutable_recording_source(),
- layer_tree_host()->image_serialization_processor());
+ recording_source_->ToProtobuf(picture->mutable_recording_source());
+
RegionToProto(last_updated_invalidation_, picture->mutable_invalidation());
picture->set_is_mask(is_mask_);
picture->set_nearest_neighbor(nearest_neighbor_);
@@ -198,12 +208,14 @@ void PictureLayer::FromLayerSpecificPropertiesProto(
// If this is a new layer, ensure it has a recording source. During layer
// hierarchy deserialization, ::SetLayerTreeHost(...) is not called, but
// instead the member is set directly, so it needs to be set here explicitly.
- if (!recording_source_)
+ if (!recording_source_) {
recording_source_.reset(new RecordingSource);
+ // A RecordingSource is only ever deserialized on the client.
+ recording_source_->SetClientPictureCache(
+ layer_tree_host()->client_picture_cache());
+ }
- recording_source_->FromProtobuf(
- picture.recording_source(),
- layer_tree_host()->image_serialization_processor());
+ recording_source_->FromProtobuf(picture.recording_source());
Region new_invalidation = RegionFromProto(picture.invalidation());
last_updated_invalidation_.Swap(&new_invalidation);

Powered by Google App Engine
This is Rietveld 408576698