Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "cc/layers/content_layer_client.h" | 8 #include "cc/layers/content_layer_client.h" |
| 9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
| 10 #include "cc/playback/display_list_recording_source.h" | 10 #include "cc/playback/display_list_recording_source.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); | 133 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); |
| 134 | 134 |
| 135 // Calling paint in WebKit can sometimes cause invalidations, so save | 135 // Calling paint in WebKit can sometimes cause invalidations, so save |
| 136 // off the invalidation prior to calling update. | 136 // off the invalidation prior to calling update. |
| 137 pending_invalidation_.Swap(&recording_invalidation_); | 137 pending_invalidation_.Swap(&recording_invalidation_); |
| 138 pending_invalidation_.Clear(); | 138 pending_invalidation_.Clear(); |
| 139 | 139 |
| 140 if (layer_tree_host()->settings().record_full_layer) { | 140 if (layer_tree_host()->settings().record_full_layer) { |
| 141 // Workaround for http://crbug.com/235910 - to retain backwards compat | 141 // Workaround for http://crbug.com/235910 - to retain backwards compat |
| 142 // the full page content must always be provided in the picture layer. | 142 // the full page content must always be provided in the picture layer. |
| 143 update_rect = gfx::Rect(layer_size); | 143 update_rect = gfx::Rect(layer_size); |
|
enne (OOO)
2015/11/17 23:44:49
You need to implement this in Blink as a part of s
chrishtr
2015/11/18 21:09:40
Done.
| |
| 144 } | 144 } |
| 145 | 145 |
| 146 // UpdateAndExpandInvalidation will give us an invalidation that covers | 146 // UpdateAndExpandInvalidation will give us an invalidation that covers |
| 147 // anything not explicitly recorded in this frame. We give this region | 147 // anything not explicitly recorded in this frame. We give this region |
| 148 // to the impl side so that it drops tiles that may not have a recording | 148 // to the impl side so that it drops tiles that may not have a recording |
| 149 // for them. | 149 // for them. |
| 150 DCHECK(client_); | 150 DCHECK(client_); |
| 151 updated |= recording_source_->UpdateAndExpandInvalidation( | 151 updated |= recording_source_->UpdateAndExpandInvalidation( |
| 152 client_, &recording_invalidation_, layer_size, update_rect, | 152 client_, &recording_invalidation_, layer_size, update_rect, |
| 153 update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY); | 153 update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY, |
| 154 layer_tree_host()->settings().blink_synchronized_painting_enabled); | |
| 154 last_updated_visible_layer_rect_ = visible_layer_rect(); | 155 last_updated_visible_layer_rect_ = visible_layer_rect(); |
| 155 | 156 |
| 156 if (updated) { | 157 if (updated) { |
| 157 SetNeedsPushProperties(); | 158 SetNeedsPushProperties(); |
| 158 } else { | 159 } else { |
| 159 // If this invalidation did not affect the recording source, then it can be | 160 // If this invalidation did not affect the recording source, then it can be |
| 160 // cleared as an optimization. | 161 // cleared as an optimization. |
| 161 recording_invalidation_.Clear(); | 162 recording_invalidation_.Clear(); |
| 162 } | 163 } |
| 163 | 164 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 174 // picture. For now we just paint a fresh one to get consistent results. | 175 // picture. For now we just paint a fresh one to get consistent results. |
| 175 if (!DrawsContent()) | 176 if (!DrawsContent()) |
| 176 return skia::RefPtr<SkPicture>(); | 177 return skia::RefPtr<SkPicture>(); |
| 177 | 178 |
| 178 gfx::Size layer_size = bounds(); | 179 gfx::Size layer_size = bounds(); |
| 179 scoped_ptr<DisplayListRecordingSource> recording_source( | 180 scoped_ptr<DisplayListRecordingSource> recording_source( |
| 180 new DisplayListRecordingSource); | 181 new DisplayListRecordingSource); |
| 181 Region recording_invalidation; | 182 Region recording_invalidation; |
| 182 recording_source->UpdateAndExpandInvalidation( | 183 recording_source->UpdateAndExpandInvalidation( |
| 183 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), | 184 client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), |
| 184 update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY); | 185 update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY, |
| 186 layer_tree_host()->settings().blink_synchronized_painting_enabled); | |
| 185 | 187 |
| 186 scoped_refptr<DisplayListRasterSource> raster_source = | 188 scoped_refptr<DisplayListRasterSource> raster_source = |
| 187 recording_source->CreateRasterSource(false); | 189 recording_source->CreateRasterSource(false); |
| 188 | 190 |
| 189 return raster_source->GetFlattenedPicture(); | 191 return raster_source->GetFlattenedPicture(); |
| 190 } | 192 } |
| 191 | 193 |
| 192 bool PictureLayer::IsSuitableForGpuRasterization() const { | 194 bool PictureLayer::IsSuitableForGpuRasterization() const { |
| 193 return recording_source_->IsSuitableForGpuRasterization(); | 195 return recording_source_->IsSuitableForGpuRasterization(); |
| 194 } | 196 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 208 | 210 |
| 209 bool PictureLayer::HasDrawableContent() const { | 211 bool PictureLayer::HasDrawableContent() const { |
| 210 return client_ && Layer::HasDrawableContent(); | 212 return client_ && Layer::HasDrawableContent(); |
| 211 } | 213 } |
| 212 | 214 |
| 213 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 215 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 214 benchmark->RunOnLayer(this); | 216 benchmark->RunOnLayer(this); |
| 215 } | 217 } |
| 216 | 218 |
| 217 } // namespace cc | 219 } // namespace cc |
| OLD | NEW |