| Index: cc/layers/picture_layer.cc
|
| diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
|
| index c56ff8be082b67dbf33e8db8193481efc99b2307..5d45caed48099c77a8f232e8ac0dfe9d770e2f72 100644
|
| --- a/cc/layers/picture_layer.cc
|
| +++ b/cc/layers/picture_layer.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/auto_reset.h"
|
| #include "cc/layers/content_layer_client.h"
|
| #include "cc/layers/picture_layer_impl.h"
|
| +#include "cc/resources/picture_pile.h"
|
| #include "cc/trees/layer_tree_impl.h"
|
| #include "third_party/skia/include/core/SkPictureRecorder.h"
|
| #include "ui/gfx/geometry/rect_conversions.h"
|
| @@ -19,6 +20,7 @@ scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) {
|
|
|
| PictureLayer::PictureLayer(ContentLayerClient* client)
|
| : client_(client),
|
| + recording_source_(new PicturePile),
|
| instrumentation_object_tracker_(id()),
|
| update_source_frame_number_(-1),
|
| can_use_lcd_text_last_frame_(can_use_lcd_text()) {
|
| @@ -37,38 +39,39 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
|
|
|
| int source_frame_number = layer_tree_host()->source_frame_number();
|
| gfx::Size impl_bounds = layer_impl->bounds();
|
| - gfx::Size pile_bounds = pile_.tiling_size();
|
| + gfx::Size recording_source_bounds = recording_source_->GetSize();
|
|
|
| - // If update called, then pile size must match bounds pushed to impl layer.
|
| + // If update called, then recording source size must match bounds pushed to
|
| + // impl layer.
|
| DCHECK_IMPLIES(update_source_frame_number_ == source_frame_number,
|
| - impl_bounds == pile_bounds)
|
| - << " bounds " << impl_bounds.ToString() << " pile "
|
| - << pile_bounds.ToString();
|
| + impl_bounds == recording_source_bounds)
|
| + << " bounds " << impl_bounds.ToString() << " recording source "
|
| + << recording_source_bounds.ToString();
|
|
|
| if (update_source_frame_number_ != source_frame_number &&
|
| - pile_bounds != impl_bounds) {
|
| + recording_source_bounds != impl_bounds) {
|
| // Update may not get called for the layer (if it's not in the viewport
|
| - // for example, even though it has resized making the pile no longer
|
| - // valid. In this case just destroy the pile.
|
| - pile_.SetEmptyBounds();
|
| + // for example, even though it has resized making the recording source no
|
| + // longer valid. In this case just destroy the recording source.
|
| + recording_source_->SetEmptyBounds();
|
| }
|
|
|
| // Unlike other properties, invalidation must always be set on layer_impl.
|
| // See PictureLayerImpl::PushPropertiesTo for more details.
|
| layer_impl->invalidation_.Clear();
|
| - layer_impl->invalidation_.Swap(&pile_invalidation_);
|
| - layer_impl->UpdatePile(PicturePileImpl::CreateFromOther(&pile_));
|
| + layer_impl->invalidation_.Swap(&recording_invalidation_);
|
| + layer_impl->UpdateRasterSource(recording_source_->CreateRasterSource());
|
| }
|
|
|
| void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
|
| Layer::SetLayerTreeHost(host);
|
| if (host) {
|
| - pile_.SetMinContentsScale(host->settings().minimum_contents_scale);
|
| - pile_.SetTileGridSize(host->settings().default_tile_grid_size);
|
| - pile_.set_slow_down_raster_scale_factor(
|
| + // TODO(hendrikw): Perhaps use and initialization function to do this work.
|
| + recording_source_->SetMinContentsScale(
|
| + host->settings().minimum_contents_scale);
|
| + recording_source_->SetTileGridSize(host->settings().default_tile_grid_size);
|
| + recording_source_->SetSlowdownRasterScaleFactor(
|
| host->debug_state().slow_down_raster_scale_factor);
|
| - pile_.set_show_debug_picture_borders(
|
| - host->debug_state().show_picture_borders);
|
| }
|
| }
|
|
|
| @@ -97,7 +100,8 @@ bool PictureLayer::Update(ResourceUpdateQueue* queue,
|
| gfx::Size layer_size = paint_properties().bounds;
|
|
|
| if (last_updated_visible_content_rect_ == visible_content_rect() &&
|
| - pile_.tiling_size() == layer_size && pending_invalidation_.IsEmpty()) {
|
| + recording_source_->GetSize() == layer_size &&
|
| + pending_invalidation_.IsEmpty()) {
|
| // Only early out if the visible content rect of this layer hasn't changed.
|
| return updated;
|
| }
|
| @@ -110,7 +114,7 @@ bool PictureLayer::Update(ResourceUpdateQueue* queue,
|
|
|
| // Calling paint in WebKit can sometimes cause invalidations, so save
|
| // off the invalidation prior to calling update.
|
| - pending_invalidation_.Swap(&pile_invalidation_);
|
| + pending_invalidation_.Swap(&recording_invalidation_);
|
| pending_invalidation_.Clear();
|
|
|
| if (layer_tree_host()->settings().record_full_layer) {
|
| @@ -124,32 +128,26 @@ bool PictureLayer::Update(ResourceUpdateQueue* queue,
|
| // to the impl side so that it drops tiles that may not have a recording
|
| // for them.
|
| DCHECK(client_);
|
| - updated |=
|
| - pile_.UpdateAndExpandInvalidation(client_,
|
| - &pile_invalidation_,
|
| - SafeOpaqueBackgroundColor(),
|
| - contents_opaque(),
|
| - client_->FillsBoundsCompletely(),
|
| - layer_size,
|
| - visible_layer_rect,
|
| - update_source_frame_number_,
|
| - Picture::RECORD_NORMALLY,
|
| - rendering_stats_instrumentation());
|
| + updated |= recording_source_->UpdateAndExpandInvalidation(
|
| + client_, &recording_invalidation_, SafeOpaqueBackgroundColor(),
|
| + contents_opaque(), client_->FillsBoundsCompletely(), layer_size,
|
| + visible_layer_rect, update_source_frame_number_,
|
| + Picture::RECORD_NORMALLY);
|
| last_updated_visible_content_rect_ = visible_content_rect();
|
|
|
| if (updated) {
|
| SetNeedsPushProperties();
|
| } else {
|
| - // If this invalidation did not affect the pile, then it can be cleared as
|
| - // an optimization.
|
| - pile_invalidation_.Clear();
|
| + // If this invalidation did not affect the recording source, then it can be
|
| + // cleared as an optimization.
|
| + recording_invalidation_.Clear();
|
| }
|
|
|
| return updated;
|
| }
|
|
|
| void PictureLayer::SetIsMask(bool is_mask) {
|
| - pile_.set_is_mask(is_mask);
|
| + recording_source_->SetIsMask(is_mask);
|
| }
|
|
|
| bool PictureLayer::SupportsLCDText() const {
|
| @@ -166,7 +164,7 @@ void PictureLayer::UpdateCanUseLCDText() {
|
| }
|
|
|
| skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
|
| - // We could either flatten the PicturePile into a single SkPicture,
|
| + // We could either flatten the RecordingSource into a single SkPicture,
|
| // or paint a fresh one depending on what we intend to do with the
|
| // picture. For now we just paint a fresh one to get consistent results.
|
| if (!DrawsContent())
|
| @@ -185,7 +183,7 @@ skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
|
| }
|
|
|
| bool PictureLayer::IsSuitableForGpuRasterization() const {
|
| - return pile_.is_suitable_for_gpu_rasterization();
|
| + return recording_source_->IsSuitableForGpuRasterization();
|
| }
|
|
|
| void PictureLayer::ClearClient() {
|
|
|