summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/BUILD.gn3
-rw-r--r--cc/cc.gyp3
-rw-r--r--cc/debug/rasterize_and_record_benchmark_impl.cc8
-rw-r--r--cc/layers/picture_layer.cc4
-rw-r--r--cc/layers/picture_layer_impl.cc4
-rw-r--r--cc/layers/picture_layer_impl.h8
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc33
-rw-r--r--cc/playback/discardable_image_map_unittest.cc1
-rw-r--r--cc/playback/display_list_raster_source.cc103
-rw-r--r--cc/playback/display_list_raster_source.h116
-rw-r--r--cc/playback/display_list_raster_source_unittest.cc14
-rw-r--r--cc/playback/display_list_recording_source.cc6
-rw-r--r--cc/playback/display_list_recording_source.h3
-rw-r--r--cc/playback/display_list_recording_source_unittest.cc12
-rw-r--r--cc/playback/raster_source.h117
-rw-r--r--cc/playback/raster_source_helper.cc105
-rw-r--r--cc/playback/raster_source_helper.h30
-rw-r--r--cc/quads/draw_quad_unittest.cc4
-rw-r--r--cc/quads/picture_draw_quad.cc48
-rw-r--r--cc/quads/picture_draw_quad.h8
-rw-r--r--cc/raster/bitmap_tile_task_worker_pool.cc4
-rw-r--r--cc/raster/gpu_rasterizer.cc4
-rw-r--r--cc/raster/gpu_rasterizer.h4
-rw-r--r--cc/raster/gpu_tile_task_worker_pool.cc4
-rw-r--r--cc/raster/one_copy_tile_task_worker_pool.cc4
-rw-r--r--cc/raster/one_copy_tile_task_worker_pool.h2
-rw-r--r--cc/raster/raster_buffer.h4
-rw-r--r--cc/raster/tile_task_worker_pool.cc21
-rw-r--r--cc/raster/tile_task_worker_pool.h4
-rw-r--r--cc/raster/tile_task_worker_pool_unittest.cc19
-rw-r--r--cc/raster/zero_copy_tile_task_worker_pool.cc2
-rw-r--r--cc/test/fake_display_list_recording_source.cc4
-rw-r--r--cc/test/fake_display_list_recording_source.h2
-rw-r--r--cc/test/fake_picture_layer_impl.cc6
-rw-r--r--cc/test/fake_picture_layer_impl.h19
-rw-r--r--cc/test/fake_picture_layer_tiling_client.h2
-rw-r--r--cc/tiles/picture_layer_tiling.cc8
-rw-r--r--cc/tiles/picture_layer_tiling.h15
-rw-r--r--cc/tiles/picture_layer_tiling_set.cc12
-rw-r--r--cc/tiles/picture_layer_tiling_set.h13
-rw-r--r--cc/tiles/picture_layer_tiling_unittest.cc17
-rw-r--r--cc/tiles/prioritized_tile.cc5
-rw-r--r--cc/tiles/prioritized_tile.h8
-rw-r--r--cc/tiles/tile_manager.cc52
-rw-r--r--cc/tiles/tile_manager.h18
-rw-r--r--cc/tiles/tile_manager_perftest.cc6
-rw-r--r--cc/tiles/tile_manager_unittest.cc8
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc2
48 files changed, 397 insertions, 502 deletions
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 2906cd0..6bd6aa2 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -307,9 +307,6 @@ component("cc") {
"playback/float_clip_display_item.h",
"playback/largest_display_item.cc",
"playback/largest_display_item.h",
- "playback/raster_source.h",
- "playback/raster_source_helper.cc",
- "playback/raster_source_helper.h",
"playback/transform_display_item.cc",
"playback/transform_display_item.h",
"proto/gfx_conversions.cc",
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 5c28a9b0..00c8aad 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -369,9 +369,6 @@
'playback/float_clip_display_item.h',
'playback/largest_display_item.cc',
'playback/largest_display_item.h',
- 'playback/raster_source.h',
- 'playback/raster_source_helper.cc',
- 'playback/raster_source_helper.h',
'playback/transform_display_item.cc',
'playback/transform_display_item.h',
'proto/gfx_conversions.cc',
diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc
index d798dc6..305cbc5 100644
--- a/cc/debug/rasterize_and_record_benchmark_impl.cc
+++ b/cc/debug/rasterize_and_record_benchmark_impl.cc
@@ -24,7 +24,7 @@ namespace {
const int kDefaultRasterizeRepeatCount = 100;
-void RunBenchmark(RasterSource* raster_source,
+void RunBenchmark(DisplayListRasterSource* raster_source,
const gfx::Rect& content_rect,
float contents_scale,
size_t repeat_count,
@@ -47,7 +47,7 @@ void RunBenchmark(RasterSource* raster_source,
bitmap.allocPixels(SkImageInfo::MakeN32Premul(content_rect.width(),
content_rect.height()));
SkCanvas canvas(bitmap);
- RasterSource::SolidColorAnalysis analysis;
+ DisplayListRasterSource::SolidColorAnalysis analysis;
raster_source->PerformSolidColorAnalysis(content_rect, contents_scale,
&analysis);
@@ -178,7 +178,7 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {
tiling_set->AddTiling(1.f, layer->GetRasterSource());
tiling->set_resolution(HIGH_RESOLUTION);
tiling->CreateAllTilesForTesting();
- RasterSource* raster_source = tiling->raster_source();
+ DisplayListRasterSource* raster_source = tiling->raster_source();
for (PictureLayerTiling::CoverageIterator it(tiling, 1.f,
layer->visible_layer_rect());
it; ++it) {
@@ -203,7 +203,7 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {
rasterize_results_.total_best_time += min_time;
}
- const RasterSource* layer_raster_source = layer->GetRasterSource();
+ const DisplayListRasterSource* layer_raster_source = layer->GetRasterSource();
rasterize_results_.total_memory_usage +=
layer_raster_source->GetPictureMemoryUsage();
}
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index d92ccc1..81ae0b1 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -74,7 +74,7 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
// Preserve lcd text settings from the current raster source.
bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText();
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
recording_source_->CreateRasterSource(can_use_lcd_text);
layer_impl->set_gpu_raster_max_texture_size(
layer_tree_host()->device_viewport_size());
@@ -183,7 +183,7 @@ skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
client_, &recording_invalidation, layer_size, gfx::Rect(layer_size),
update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY);
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
recording_source->CreateRasterSource(false);
return raster_source->GetFlattenedPicture();
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index f8aa213..34357ff 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -524,7 +524,7 @@ PictureLayerImpl* PictureLayerImpl::GetPendingOrActiveTwinLayer() const {
}
void PictureLayerImpl::UpdateRasterSource(
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
Region* new_invalidation,
const PictureLayerTilingSet* pending_set) {
// The bounds and the pile size may differ if the pile wasn't updated (ie.
@@ -586,7 +586,7 @@ void PictureLayerImpl::UpdateCanUseLCDTextAfterCommit() {
// Raster sources are considered const, so in order to update the state
// a new one must be created and all tiles recreated.
- scoped_refptr<RasterSource> new_raster_source =
+ scoped_refptr<DisplayListRasterSource> new_raster_source =
raster_source_->CreateCloneWithoutLCDText();
raster_source_.swap(new_raster_source);
diff --git a/cc/layers/picture_layer_impl.h b/cc/layers/picture_layer_impl.h
index 409afae..9cd7a21 100644
--- a/cc/layers/picture_layer_impl.h
+++ b/cc/layers/picture_layer_impl.h
@@ -66,7 +66,7 @@ class CC_EXPORT PictureLayerImpl
void set_gpu_raster_max_texture_size(gfx::Size gpu_raster_max_texture_size) {
gpu_raster_max_texture_size_ = gpu_raster_max_texture_size;
}
- void UpdateRasterSource(scoped_refptr<RasterSource> raster_source,
+ void UpdateRasterSource(scoped_refptr<DisplayListRasterSource> raster_source,
Region* new_invalidation,
const PictureLayerTilingSet* pending_set);
bool UpdateTiles(bool resourceless_software_draw);
@@ -93,7 +93,9 @@ class CC_EXPORT PictureLayerImpl
bool IsOnActiveOrPendingTree() const;
// Used for benchmarking
- RasterSource* GetRasterSource() const { return raster_source_.get(); }
+ DisplayListRasterSource* GetRasterSource() const {
+ return raster_source_.get();
+ }
protected:
friend class LayerRasterTileIterator;
@@ -132,7 +134,7 @@ class CC_EXPORT PictureLayerImpl
PictureLayerImpl* twin_layer_;
scoped_ptr<PictureLayerTilingSet> tilings_;
- scoped_refptr<RasterSource> raster_source_;
+ scoped_refptr<DisplayListRasterSource> raster_source_;
Region invalidation_;
float ideal_page_scale_;
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 6daa34a..642ef2e 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -173,16 +173,16 @@ class PictureLayerImplTest : public testing::Test {
tile_size, invalidation);
}
- void SetupTrees(scoped_refptr<RasterSource> pending_raster_source,
- scoped_refptr<RasterSource> active_raster_source) {
+ void SetupTrees(scoped_refptr<DisplayListRasterSource> pending_raster_source,
+ scoped_refptr<DisplayListRasterSource> active_raster_source) {
SetupPendingTree(active_raster_source);
ActivateTree();
SetupPendingTreeInternal(pending_raster_source, gfx::Size(), Region());
}
void SetupTreesWithInvalidation(
- scoped_refptr<RasterSource> pending_raster_source,
- scoped_refptr<RasterSource> active_raster_source,
+ scoped_refptr<DisplayListRasterSource> pending_raster_source,
+ scoped_refptr<DisplayListRasterSource> active_raster_source,
const Region& pending_invalidation) {
SetupPendingTreeInternal(active_raster_source, gfx::Size(), Region());
ActivateTree();
@@ -191,8 +191,8 @@ class PictureLayerImplTest : public testing::Test {
}
void SetupTreesWithFixedTileSize(
- scoped_refptr<RasterSource> pending_raster_source,
- scoped_refptr<RasterSource> active_raster_source,
+ scoped_refptr<DisplayListRasterSource> pending_raster_source,
+ scoped_refptr<DisplayListRasterSource> active_raster_source,
const gfx::Size& tile_size,
const Region& pending_invalidation) {
SetupPendingTreeInternal(active_raster_source, tile_size, Region());
@@ -201,26 +201,27 @@ class PictureLayerImplTest : public testing::Test {
pending_invalidation);
}
- void SetupPendingTree(scoped_refptr<RasterSource> raster_source) {
+ void SetupPendingTree(scoped_refptr<DisplayListRasterSource> raster_source) {
SetupPendingTreeInternal(raster_source, gfx::Size(), Region());
}
void SetupPendingTreeWithInvalidation(
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
const Region& invalidation) {
SetupPendingTreeInternal(raster_source, gfx::Size(), invalidation);
}
void SetupPendingTreeWithFixedTileSize(
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
const gfx::Size& tile_size,
const Region& invalidation) {
SetupPendingTreeInternal(raster_source, tile_size, invalidation);
}
- void SetupPendingTreeInternal(scoped_refptr<RasterSource> raster_source,
- const gfx::Size& tile_size,
- const Region& invalidation) {
+ void SetupPendingTreeInternal(
+ scoped_refptr<DisplayListRasterSource> raster_source,
+ const gfx::Size& tile_size,
+ const Region& invalidation) {
host_impl_.CreatePendingTree();
host_impl_.pending_tree()->PushPageScaleFromMainThread(1.f, 0.00001f,
100000.f);
@@ -286,7 +287,7 @@ class PictureLayerImplTest : public testing::Test {
}
static void VerifyAllPrioritizedTilesExistAndHaveRasterSource(
const PictureLayerTiling* tiling,
- RasterSource* raster_source) {
+ DisplayListRasterSource* raster_source) {
auto prioritized_tiles =
tiling->UpdateAndGetAllPrioritizedTilesForTesting();
for (PictureLayerTiling::CoverageIterator iter(
@@ -4497,7 +4498,7 @@ void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) {
&client, &invalidation, layer_bounds, layer_rect, frame_number++,
DisplayListRecordingSource::RECORD_NORMALLY);
- scoped_refptr<RasterSource> pending_raster_source =
+ scoped_refptr<DisplayListRasterSource> pending_raster_source =
recording_source->CreateRasterSource(true);
SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region());
@@ -4561,7 +4562,7 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
&client, &invalidation1, layer_bounds, layer_rect, frame_number++,
DisplayListRecordingSource::RECORD_NORMALLY);
- scoped_refptr<RasterSource> raster_source1 =
+ scoped_refptr<DisplayListRasterSource> raster_source1 =
recording_source->CreateRasterSource(true);
SetupPendingTree(raster_source1);
@@ -4580,7 +4581,7 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) {
&client, &invalidation2, layer_bounds, layer_rect, frame_number++,
DisplayListRecordingSource::RECORD_NORMALLY);
- scoped_refptr<RasterSource> raster_source2 =
+ scoped_refptr<DisplayListRasterSource> raster_source2 =
recording_source->CreateRasterSource(true);
SetupPendingTree(raster_source2);
diff --git a/cc/playback/discardable_image_map_unittest.cc b/cc/playback/discardable_image_map_unittest.cc
index 4f2d1dc..7fc7900 100644
--- a/cc/playback/discardable_image_map_unittest.cc
+++ b/cc/playback/discardable_image_map_unittest.cc
@@ -8,7 +8,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "cc/base/region.h"
-#include "cc/playback/raster_source.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_display_list_recording_source.h"
#include "cc/test/skia_common.h"
diff --git a/cc/playback/display_list_raster_source.cc b/cc/playback/display_list_raster_source.cc
index d59d6dd..3060c04 100644
--- a/cc/playback/display_list_raster_source.cc
+++ b/cc/playback/display_list_raster_source.cc
@@ -8,7 +8,6 @@
#include "cc/base/region.h"
#include "cc/debug/debug_colors.h"
#include "cc/playback/display_item_list.h"
-#include "cc/playback/raster_source_helper.h"
#include "skia/ext/analysis_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
@@ -80,15 +79,99 @@ void DisplayListRasterSource::PlaybackToCanvas(
const gfx::Rect& canvas_bitmap_rect,
const gfx::Rect& canvas_playback_rect,
float contents_scale) const {
- RasterSourceHelper::PrepareForPlaybackToCanvas(
- canvas, canvas_bitmap_rect, canvas_playback_rect, gfx::Rect(size_),
- contents_scale, background_color_, clear_canvas_with_debug_color_,
- requires_clear_);
-
+ PrepareForPlaybackToCanvas(canvas, canvas_bitmap_rect, canvas_playback_rect,
+ contents_scale);
RasterCommon(canvas, NULL, canvas_bitmap_rect, canvas_playback_rect,
contents_scale);
}
+void DisplayListRasterSource::PrepareForPlaybackToCanvas(
+ SkCanvas* canvas,
+ const gfx::Rect& canvas_bitmap_rect,
+ const gfx::Rect& canvas_playback_rect,
+ float contents_scale) const {
+ // TODO(hendrikw): See if we can split this up into separate functions.
+ bool partial_update = canvas_bitmap_rect != canvas_playback_rect;
+
+ if (!partial_update)
+ canvas->discard();
+ if (clear_canvas_with_debug_color_) {
+ // Any non-painted areas in the content bounds will be left in this color.
+ if (!partial_update) {
+ canvas->clear(DebugColors::NonPaintedFillColor());
+ } else {
+ canvas->save();
+ canvas->clipRect(gfx::RectToSkRect(
+ canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin()));
+ canvas->drawColor(DebugColors::NonPaintedFillColor());
+ canvas->restore();
+ }
+ }
+
+ // If this raster source has opaque contents, it is guaranteeing that it will
+ // draw an opaque rect the size of the layer. If it is not, then we must
+ // clear this canvas ourselves.
+ if (requires_clear_) {
+ TRACE_EVENT_INSTANT0("cc", "SkCanvas::clear", TRACE_EVENT_SCOPE_THREAD);
+ // Clearing is about ~4x faster than drawing a rect even if the content
+ // isn't covering a majority of the canvas.
+ if (!partial_update) {
+ canvas->clear(SK_ColorTRANSPARENT);
+ } else {
+ canvas->save();
+ canvas->clipRect(gfx::RectToSkRect(
+ canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin()));
+ canvas->drawColor(SK_ColorTRANSPARENT, SkXfermode::kClear_Mode);
+ canvas->restore();
+ }
+ } else {
+ // Even if completely covered, for rasterizations that touch the edge of the
+ // layer, we also need to raster the background color underneath the last
+ // texel (since the recording won't cover it) and outside the last texel
+ // (due to linear filtering when using this texture).
+ gfx::Rect content_rect =
+ gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale);
+
+ // The final texel of content may only be partially covered by a
+ // rasterization; this rect represents the content rect that is fully
+ // covered by content.
+ gfx::Rect deflated_content_rect = content_rect;
+ deflated_content_rect.Inset(0, 0, 1, 1);
+ deflated_content_rect.Intersect(canvas_playback_rect);
+ if (!deflated_content_rect.Contains(canvas_playback_rect)) {
+ if (clear_canvas_with_debug_color_) {
+ // Any non-painted areas outside of the content bounds are left in
+ // this color. If this is seen then it means that cc neglected to
+ // rerasterize a tile that used to intersect with the content rect
+ // after the content bounds grew.
+ canvas->save();
+ canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y());
+ canvas->clipRect(gfx::RectToSkRect(content_rect),
+ SkRegion::kDifference_Op);
+ canvas->drawColor(DebugColors::MissingResizeInvalidations(),
+ SkXfermode::kSrc_Mode);
+ canvas->restore();
+ }
+
+ // Drawing at most 2 x 2 x (canvas width + canvas height) texels is 2-3X
+ // faster than clearing, so special case this.
+ canvas->save();
+ canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y());
+ gfx::Rect inflated_content_rect = content_rect;
+ // Only clear edges that will be inside the canvas_playback_rect, else we
+ // clear things that are still valid from a previous raster.
+ inflated_content_rect.Inset(0, 0, -1, -1);
+ inflated_content_rect.Intersect(canvas_playback_rect);
+ canvas->clipRect(gfx::RectToSkRect(inflated_content_rect),
+ SkRegion::kReplace_Op);
+ canvas->clipRect(gfx::RectToSkRect(deflated_content_rect),
+ SkRegion::kDifference_Op);
+ canvas->drawColor(background_color_, SkXfermode::kSrc_Mode);
+ canvas->restore();
+ }
+ }
+}
+
void DisplayListRasterSource::RasterCommon(
SkCanvas* canvas,
SkPicture::AbortCallback* callback,
@@ -137,7 +220,7 @@ size_t DisplayListRasterSource::GetPictureMemoryUsage() const {
void DisplayListRasterSource::PerformSolidColorAnalysis(
const gfx::Rect& content_rect,
float contents_scale,
- RasterSource::SolidColorAnalysis* analysis) const {
+ DisplayListRasterSource::SolidColorAnalysis* analysis) const {
DCHECK(analysis);
TRACE_EVENT0("cc", "DisplayListRasterSource::PerformSolidColorAnalysis");
@@ -209,10 +292,10 @@ bool DisplayListRasterSource::CanUseLCDText() const {
return can_use_lcd_text_;
}
-scoped_refptr<RasterSource> DisplayListRasterSource::CreateCloneWithoutLCDText()
- const {
+scoped_refptr<DisplayListRasterSource>
+DisplayListRasterSource::CreateCloneWithoutLCDText() const {
bool can_use_lcd_text = false;
- return scoped_refptr<RasterSource>(
+ return scoped_refptr<DisplayListRasterSource>(
new DisplayListRasterSource(this, can_use_lcd_text));
}
diff --git a/cc/playback/display_list_raster_source.h b/cc/playback/display_list_raster_source.h
index 508423a..a322dcb 100644
--- a/cc/playback/display_list_raster_source.h
+++ b/cc/playback/display_list_raster_source.h
@@ -11,56 +11,107 @@
#include "cc/base/cc_export.h"
#include "cc/debug/rendering_stats_instrumentation.h"
#include "cc/playback/display_list_recording_source.h"
-#include "cc/playback/raster_source.h"
#include "skia/ext/analysis_canvas.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkPicture.h"
namespace cc {
class DisplayItemList;
+class DrawImage;
-class CC_EXPORT DisplayListRasterSource : public RasterSource {
+class CC_EXPORT DisplayListRasterSource
+ : public base::RefCountedThreadSafe<DisplayListRasterSource> {
public:
+ struct CC_EXPORT SolidColorAnalysis {
+ SolidColorAnalysis()
+ : is_solid_color(false), solid_color(SK_ColorTRANSPARENT) {}
+ ~SolidColorAnalysis() {}
+
+ bool is_solid_color;
+ SkColor solid_color;
+ };
+
static scoped_refptr<DisplayListRasterSource>
CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other,
bool can_use_lcd_text);
- // RasterSource overrides.
- void PlaybackToCanvas(SkCanvas* canvas,
- const gfx::Rect& canvas_bitmap_rect,
- const gfx::Rect& canvas_playback_rect,
- float contents_scale) const override;
+ // Raster a subrect of this RasterSource into the given canvas. It is
+ // assumed that contents_scale has already been applied to this canvas.
+ // Writes the total number of pixels rasterized and the time spent
+ // rasterizing to the stats if the respective pointer is not nullptr.
+ // It is assumed that the canvas passed here will only be rasterized by
+ // this raster source via this call.
+ // virtual for testing.
+ virtual void PlaybackToCanvas(SkCanvas* canvas,
+ const gfx::Rect& canvas_bitmap_rect,
+ const gfx::Rect& canvas_playback_rect,
+ float contents_scale) const;
+
+ // Similar to above, except that the canvas passed here can (or was already)
+ // rasterized into by another raster source. That is, it is not safe to clear
+ // the canvas or discard its underlying memory.
void PlaybackToSharedCanvas(SkCanvas* canvas,
const gfx::Rect& canvas_rect,
- float contents_scale) const override;
- void PerformSolidColorAnalysis(
- const gfx::Rect& content_rect,
- float contents_scale,
- RasterSource::SolidColorAnalysis* analysis) const override;
- bool IsSolidColor() const override;
- SkColor GetSolidColor() const override;
- gfx::Size GetSize() const override;
- void GetDiscardableImagesInRect(
- const gfx::Rect& layer_rect,
- std::vector<DrawImage>* images) const override;
- bool CoversRect(const gfx::Rect& layer_rect) const override;
- bool HasRecordings() const override;
- gfx::Rect RecordedViewport() const override;
- void SetShouldAttemptToUseDistanceFieldText() override;
- bool ShouldAttemptToUseDistanceFieldText() const override;
- void DidBeginTracing() override;
- void AsValueInto(base::trace_event::TracedValue* array) const override;
- skia::RefPtr<SkPicture> GetFlattenedPicture() override;
- size_t GetPictureMemoryUsage() const override;
- bool CanUseLCDText() const override;
- scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const override;
+ float contents_scale) const;
+
+ // Analyze to determine if the given rect at given scale is of solid color in
+ // this raster source.
+ void PerformSolidColorAnalysis(const gfx::Rect& content_rect,
+ float contents_scale,
+ SolidColorAnalysis* analysis) const;
+
+ // Returns true iff the whole raster source is of solid color.
+ bool IsSolidColor() const;
+
+ // Returns the color of the raster source if it is solid color. The results
+ // are unspecified if IsSolidColor returns false.
+ SkColor GetSolidColor() const;
+
+ // Returns the size of this raster source.
+ gfx::Size GetSize() const;
+
+ // Populate the given list with all images that may overlap the given
+ // rect in layer space.
+ void GetDiscardableImagesInRect(const gfx::Rect& layer_rect,
+ std::vector<DrawImage>* images) const;
+
+ // Return true iff this raster source can raster the given rect in layer
+ // space.
+ bool CoversRect(const gfx::Rect& layer_rect) const;
+
+ // Returns true if this raster source has anything to rasterize.
+ virtual bool HasRecordings() const;
+
+ // Valid rectangle in which everything is recorded and can be rastered from.
+ virtual gfx::Rect RecordedViewport() const;
+
+ // Informs the raster source that it should attempt to use distance field text
+ // during rasterization.
+ virtual void SetShouldAttemptToUseDistanceFieldText();
+
+ // Return true iff this raster source would benefit from using distance
+ // field text.
+ virtual bool ShouldAttemptToUseDistanceFieldText() const;
+
+ // Tracing functionality.
+ virtual void DidBeginTracing();
+ virtual void AsValueInto(base::trace_event::TracedValue* array) const;
+ virtual skia::RefPtr<SkPicture> GetFlattenedPicture();
+ virtual size_t GetPictureMemoryUsage() const;
+
+ // Return true if LCD anti-aliasing may be used when rastering text.
+ virtual bool CanUseLCDText() const;
+
+ scoped_refptr<DisplayListRasterSource> CreateCloneWithoutLCDText() const;
protected:
+ friend class base::RefCountedThreadSafe<DisplayListRasterSource>;
+
DisplayListRasterSource(const DisplayListRecordingSource* other,
bool can_use_lcd_text);
DisplayListRasterSource(const DisplayListRasterSource* other,
bool can_use_lcd_text);
- ~DisplayListRasterSource() override;
+ virtual ~DisplayListRasterSource();
// These members are const as this raster source may be in use on another
// thread and so should not be touched after construction.
@@ -92,6 +143,11 @@ class CC_EXPORT DisplayListRasterSource : public RasterSource {
const gfx::Rect& canvas_playback_rect,
float contents_scale) const;
+ void PrepareForPlaybackToCanvas(SkCanvas* canvas,
+ const gfx::Rect& canvas_bitmap_rect,
+ const gfx::Rect& canvas_playback_rect,
+ float contents_scale) const;
+
DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource);
};
diff --git a/cc/playback/display_list_raster_source_unittest.cc b/cc/playback/display_list_raster_source_unittest.cc
index 7421102..40f083f 100644
--- a/cc/playback/display_list_raster_source_unittest.cc
+++ b/cc/playback/display_list_raster_source_unittest.cc
@@ -41,7 +41,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) {
// Ensure everything is solid.
for (int y = 0; y <= 300; y += 100) {
for (int x = 0; x <= 300; x += 100) {
- RasterSource::SolidColorAnalysis analysis;
+ DisplayListRasterSource::SolidColorAnalysis analysis;
gfx::Rect rect(x, y, 100, 100);
raster->PerformSolidColorAnalysis(rect, 1.0, &analysis);
EXPECT_TRUE(analysis.is_solid_color) << rect.ToString();
@@ -56,7 +56,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) {
raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource(
recording_source.get(), false);
- RasterSource::SolidColorAnalysis analysis;
+ DisplayListRasterSource::SolidColorAnalysis analysis;
raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 100, 100), 1.0, &analysis);
EXPECT_FALSE(analysis.is_solid_color);
@@ -110,7 +110,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) {
// Ensure everything is solid.
for (int y = 0; y <= 30; y += 10) {
for (int x = 0; x <= 30; x += 10) {
- RasterSource::SolidColorAnalysis analysis;
+ DisplayListRasterSource::SolidColorAnalysis analysis;
gfx::Rect rect(x, y, 10, 10);
raster->PerformSolidColorAnalysis(rect, 0.1f, &analysis);
EXPECT_TRUE(analysis.is_solid_color) << rect.ToString();
@@ -125,7 +125,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) {
raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource(
recording_source.get(), false);
- RasterSource::SolidColorAnalysis analysis;
+ DisplayListRasterSource::SolidColorAnalysis analysis;
raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 10, 10), 0.1f, &analysis);
EXPECT_FALSE(analysis.is_solid_color);
@@ -160,7 +160,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidEmpty) {
scoped_refptr<DisplayListRasterSource> raster =
DisplayListRasterSource::CreateFromDisplayListRecordingSource(
recording_source.get(), false);
- RasterSource::SolidColorAnalysis analysis;
+ DisplayListRasterSource::SolidColorAnalysis analysis;
EXPECT_FALSE(analysis.is_solid_color);
raster->PerformSolidColorAnalysis(gfx::Rect(0, 0, 400, 400), 1.f, &analysis);
@@ -352,7 +352,7 @@ TEST(DisplayListRasterSourceTest, RasterPartialContents) {
black_paint);
recording_source->Rerecord();
- // Make a new RasterSource from the new recording.
+ // Make a new DisplayListRasterSource from the new recording.
raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource(
recording_source.get(), false);
@@ -454,7 +454,7 @@ TEST(DisplayListRasterSourceTest, RasterPartialClear) {
white_paint);
recording_source_light->Rerecord();
- // Make a new RasterSource from the new recording.
+ // Make a new DisplayListRasterSource from the new recording.
raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource(
recording_source_light.get(), false);
diff --git a/cc/playback/display_list_recording_source.cc b/cc/playback/display_list_recording_source.cc
index 26d7437..a199866 100644
--- a/cc/playback/display_list_recording_source.cc
+++ b/cc/playback/display_list_recording_source.cc
@@ -228,9 +228,9 @@ bool DisplayListRecordingSource::IsSuitableForGpuRasterization() const {
return !display_list_ || display_list_->IsSuitableForGpuRasterization();
}
-scoped_refptr<RasterSource> DisplayListRecordingSource::CreateRasterSource(
- bool can_use_lcd_text) const {
- return scoped_refptr<RasterSource>(
+scoped_refptr<DisplayListRasterSource>
+DisplayListRecordingSource::CreateRasterSource(bool can_use_lcd_text) const {
+ return scoped_refptr<DisplayListRasterSource>(
DisplayListRasterSource::CreateFromDisplayListRecordingSource(
this, can_use_lcd_text));
}
diff --git a/cc/playback/display_list_recording_source.h b/cc/playback/display_list_recording_source.h
index d544349..4a19cbe 100644
--- a/cc/playback/display_list_recording_source.h
+++ b/cc/playback/display_list_recording_source.h
@@ -16,7 +16,6 @@ namespace cc {
class ContentLayerClient;
class DisplayItemList;
class DisplayListRasterSource;
-class RasterSource;
class Region;
class CC_EXPORT DisplayListRecordingSource {
@@ -49,7 +48,7 @@ class CC_EXPORT DisplayListRecordingSource {
void SetRequiresClear(bool requires_clear);
// These functions are virtual for testing.
- virtual scoped_refptr<RasterSource> CreateRasterSource(
+ virtual scoped_refptr<DisplayListRasterSource> CreateRasterSource(
bool can_use_lcd_text) const;
virtual bool IsSuitableForGpuRasterization() const;
diff --git a/cc/playback/display_list_recording_source_unittest.cc b/cc/playback/display_list_recording_source_unittest.cc
index 491318d..05d035a 100644
--- a/cc/playback/display_list_recording_source_unittest.cc
+++ b/cc/playback/display_list_recording_source_unittest.cc
@@ -23,7 +23,7 @@ scoped_ptr<FakeDisplayListRecordingSource> CreateRecordingSource(
return recording_source.Pass();
}
-scoped_refptr<RasterSource> CreateRasterSource(
+scoped_refptr<DisplayListRasterSource> CreateRasterSource(
FakeDisplayListRecordingSource* recording_source) {
bool can_use_lcd_text = true;
return DisplayListRasterSource::CreateFromDisplayListRecordingSource(
@@ -250,7 +250,7 @@ TEST(DisplayListRecordingSourceTest, NoGatherImageEmptyImages) {
recording_source->SetGenerateDiscardableImagesMetadata(false);
recording_source->Rerecord();
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
CreateRasterSource(recording_source.get());
// If recording source do not gather images, raster source is not going to
@@ -270,7 +270,7 @@ TEST(DisplayListRecordingSourceTest, EmptyImages) {
recording_source->SetGenerateDiscardableImagesMetadata(true);
recording_source->Rerecord();
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
CreateRasterSource(recording_source.get());
// Tile sized iterators.
@@ -328,7 +328,7 @@ TEST(DisplayListRecordingSourceTest, NoDiscardableImages) {
recording_source->SetGenerateDiscardableImagesMetadata(true);
recording_source->Rerecord();
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
CreateRasterSource(recording_source.get());
// Tile sized iterators.
@@ -380,7 +380,7 @@ TEST(DisplayListRecordingSourceTest, DiscardableImages) {
recording_source->SetGenerateDiscardableImagesMetadata(true);
recording_source->Rerecord();
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
CreateRasterSource(recording_source.get());
// Tile sized iterators. These should find only one image.
@@ -456,7 +456,7 @@ TEST(DisplayListRecordingSourceTest, DiscardableImagesBaseNonDiscardable) {
recording_source->SetGenerateDiscardableImagesMetadata(true);
recording_source->Rerecord();
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
CreateRasterSource(recording_source.get());
// Tile sized iterators. These should find only one image.
diff --git a/cc/playback/raster_source.h b/cc/playback/raster_source.h
deleted file mode 100644
index a4ef8e9..0000000
--- a/cc/playback/raster_source.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_PLAYBACK_RASTER_SOURCE_H_
-#define CC_PLAYBACK_RASTER_SOURCE_H_
-
-#include <vector>
-
-#include "base/memory/ref_counted.h"
-#include "cc/base/cc_export.h"
-#include "cc/debug/traced_value.h"
-#include "cc/playback/discardable_image_map.h"
-#include "skia/ext/refptr.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/size.h"
-
-class SkCanvas;
-class SkPicture;
-
-namespace cc {
-
-class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> {
- public:
- struct CC_EXPORT SolidColorAnalysis {
- SolidColorAnalysis()
- : is_solid_color(false), solid_color(SK_ColorTRANSPARENT) {}
- ~SolidColorAnalysis() {}
-
- bool is_solid_color;
- SkColor solid_color;
- };
-
- // Raster a subrect of this RasterSource into the given canvas. It is
- // assumed that contents_scale has already been applied to this canvas.
- // Writes the total number of pixels rasterized and the time spent
- // rasterizing to the stats if the respective pointer is not nullptr.
- // It is assumed that the canvas passed here will only be rasterized by
- // this raster source via this call.
- virtual void PlaybackToCanvas(SkCanvas* canvas,
- const gfx::Rect& canvas_bitmap_rect,
- const gfx::Rect& canvas_playback_rect,
- float contents_scale) const = 0;
-
- // Similar to above, except that the canvas passed here can (or was already)
- // rasterized into by another raster source. That is, it is not safe to clear
- // the canvas or discard its underlying memory.
- virtual void PlaybackToSharedCanvas(SkCanvas* canvas,
- const gfx::Rect& canvas_rect,
- float contents_scale) const = 0;
-
- // Analyze to determine if the given rect at given scale is of solid color in
- // this raster source.
- virtual void PerformSolidColorAnalysis(
- const gfx::Rect& content_rect,
- float contents_scale,
- SolidColorAnalysis* analysis) const = 0;
-
- // Returns true iff the whole raster source is of solid color.
- virtual bool IsSolidColor() const = 0;
-
- // Returns the color of the raster source if it is solid color. The results
- // are unspecified if IsSolidColor returns false.
- virtual SkColor GetSolidColor() const = 0;
-
- // Returns the size of this raster source.
- virtual gfx::Size GetSize() const = 0;
-
- // Populate the given list with all images that may overlap the given
- // rect in layer space.
- virtual void GetDiscardableImagesInRect(
- const gfx::Rect& layer_rect,
- std::vector<DrawImage>* images) const = 0;
-
- // Return true iff this raster source can raster the given rect in layer
- // space.
- virtual bool CoversRect(const gfx::Rect& layer_rect) const = 0;
-
- // Returns true if this raster source has anything to rasterize.
- virtual bool HasRecordings() const = 0;
-
- // Valid rectangle in which everything is recorded and can be rastered from.
- virtual gfx::Rect RecordedViewport() const = 0;
-
- // Informs the raster source that it should attempt to use distance field text
- // during rasterization.
- virtual void SetShouldAttemptToUseDistanceFieldText() = 0;
-
- // Return true iff this raster source would benefit from using distance
- // field text.
- virtual bool ShouldAttemptToUseDistanceFieldText() const = 0;
-
- // Tracing functionality.
- virtual void DidBeginTracing() = 0;
- virtual void AsValueInto(base::trace_event::TracedValue* array) const = 0;
- virtual skia::RefPtr<SkPicture> GetFlattenedPicture() = 0;
- virtual size_t GetPictureMemoryUsage() const = 0;
-
- // Return true if LCD anti-aliasing may be used when rastering text.
- virtual bool CanUseLCDText() const = 0;
-
- virtual scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const = 0;
-
- protected:
- friend class base::RefCountedThreadSafe<RasterSource>;
-
- RasterSource() {}
- virtual ~RasterSource() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RasterSource);
-};
-
-} // namespace cc
-
-#endif // CC_PLAYBACK_RASTER_SOURCE_H_
diff --git a/cc/playback/raster_source_helper.cc b/cc/playback/raster_source_helper.cc
deleted file mode 100644
index 3655ba3..0000000
--- a/cc/playback/raster_source_helper.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/playback/raster_source_helper.h"
-
-#include "base/trace_event/trace_event.h"
-#include "cc/debug/debug_colors.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "ui/gfx/geometry/rect_conversions.h"
-#include "ui/gfx/skia_util.h"
-
-namespace cc {
-
-void RasterSourceHelper::PrepareForPlaybackToCanvas(
- SkCanvas* canvas,
- const gfx::Rect& canvas_bitmap_rect,
- const gfx::Rect& canvas_playback_rect,
- const gfx::Rect& source_rect,
- float contents_scale,
- SkColor background_color,
- bool clear_canvas_with_debug_color,
- bool requires_clear) {
- bool partial_update = canvas_bitmap_rect != canvas_playback_rect;
-
- if (!partial_update)
- canvas->discard();
- if (clear_canvas_with_debug_color) {
- // Any non-painted areas in the content bounds will be left in this color.
- if (!partial_update) {
- canvas->clear(DebugColors::NonPaintedFillColor());
- } else {
- canvas->save();
- canvas->clipRect(gfx::RectToSkRect(
- canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin()));
- canvas->drawColor(DebugColors::NonPaintedFillColor());
- canvas->restore();
- }
- }
-
- // If this raster source has opaque contents, it is guaranteeing that it will
- // draw an opaque rect the size of the layer. If it is not, then we must
- // clear this canvas ourselves.
- if (requires_clear) {
- TRACE_EVENT_INSTANT0("cc", "SkCanvas::clear", TRACE_EVENT_SCOPE_THREAD);
- // Clearing is about ~4x faster than drawing a rect even if the content
- // isn't covering a majority of the canvas.
- if (!partial_update) {
- canvas->clear(SK_ColorTRANSPARENT);
- } else {
- canvas->save();
- canvas->clipRect(gfx::RectToSkRect(
- canvas_playback_rect - canvas_bitmap_rect.OffsetFromOrigin()));
- canvas->drawColor(SK_ColorTRANSPARENT, SkXfermode::kClear_Mode);
- canvas->restore();
- }
- } else {
- // Even if completely covered, for rasterizations that touch the edge of the
- // layer, we also need to raster the background color underneath the last
- // texel (since the recording won't cover it) and outside the last texel
- // (due to linear filtering when using this texture).
- gfx::Rect content_rect =
- gfx::ScaleToEnclosingRect(source_rect, contents_scale);
-
- // The final texel of content may only be partially covered by a
- // rasterization; this rect represents the content rect that is fully
- // covered by content.
- gfx::Rect deflated_content_rect = content_rect;
- deflated_content_rect.Inset(0, 0, 1, 1);
- deflated_content_rect.Intersect(canvas_playback_rect);
- if (!deflated_content_rect.Contains(canvas_playback_rect)) {
- if (clear_canvas_with_debug_color) {
- // Any non-painted areas outside of the content bounds are left in
- // this color. If this is seen then it means that cc neglected to
- // rerasterize a tile that used to intersect with the content rect
- // after the content bounds grew.
- canvas->save();
- canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y());
- canvas->clipRect(gfx::RectToSkRect(content_rect),
- SkRegion::kDifference_Op);
- canvas->drawColor(DebugColors::MissingResizeInvalidations(),
- SkXfermode::kSrc_Mode);
- canvas->restore();
- }
-
- // Drawing at most 2 x 2 x (canvas width + canvas height) texels is 2-3X
- // faster than clearing, so special case this.
- canvas->save();
- canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y());
- gfx::Rect inflated_content_rect = content_rect;
- // Only clear edges that will be inside the canvas_playback_rect, else we
- // clear things that are still valid from a previous raster.
- inflated_content_rect.Inset(0, 0, -1, -1);
- inflated_content_rect.Intersect(canvas_playback_rect);
- canvas->clipRect(gfx::RectToSkRect(inflated_content_rect),
- SkRegion::kReplace_Op);
- canvas->clipRect(gfx::RectToSkRect(deflated_content_rect),
- SkRegion::kDifference_Op);
- canvas->drawColor(background_color, SkXfermode::kSrc_Mode);
- canvas->restore();
- }
- }
-}
-
-} // namespace cc
diff --git a/cc/playback/raster_source_helper.h b/cc/playback/raster_source_helper.h
deleted file mode 100644
index 9918703..0000000
--- a/cc/playback/raster_source_helper.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_PLAYBACK_RASTER_SOURCE_HELPER_H_
-#define CC_PLAYBACK_RASTER_SOURCE_HELPER_H_
-
-#include "cc/base/cc_export.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "ui/gfx/geometry/rect.h"
-
-class SkCanvas;
-
-namespace cc {
-
-class CC_EXPORT RasterSourceHelper {
- public:
- static void PrepareForPlaybackToCanvas(SkCanvas* canvas,
- const gfx::Rect& canvas_bitmap_rect,
- const gfx::Rect& canvas_playback_rect,
- const gfx::Rect& source_rect,
- float contents_scale,
- SkColor background_color,
- bool clear_canvas_with_debug_color,
- bool requires_clear);
-};
-
-} // namespace cc
-
-#endif // CC_PLAYBACK_RASTER_SOURCE_HELPER_H_
diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc
index 2fd7a80c..838cfe0 100644
--- a/cc/quads/draw_quad_unittest.cc
+++ b/cc/quads/draw_quad_unittest.cc
@@ -666,7 +666,7 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
ResourceFormat texture_format = RGBA_8888;
gfx::Rect content_rect(30, 40, 20, 30);
float contents_scale = 3.141592f;
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
FakeDisplayListRasterSource::CreateEmpty(gfx::Size(100, 100));
CREATE_SHARED_STATE();
@@ -904,7 +904,7 @@ TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
ResourceFormat texture_format = RGBA_8888;
gfx::Rect content_rect(30, 40, 20, 30);
float contents_scale = 3.141592f;
- scoped_refptr<RasterSource> raster_source =
+ scoped_refptr<DisplayListRasterSource> raster_source =
FakeDisplayListRasterSource::CreateEmpty(gfx::Size(100, 100));
CREATE_SHARED_STATE();
diff --git a/cc/quads/picture_draw_quad.cc b/cc/quads/picture_draw_quad.cc
index b98fa90..a1cf96a 100644
--- a/cc/quads/picture_draw_quad.cc
+++ b/cc/quads/picture_draw_quad.cc
@@ -17,17 +17,18 @@ PictureDrawQuad::PictureDrawQuad() {
PictureDrawQuad::~PictureDrawQuad() {
}
-void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
- const gfx::Rect& rect,
- const gfx::Rect& opaque_rect,
- const gfx::Rect& visible_rect,
- const gfx::RectF& tex_coord_rect,
- const gfx::Size& texture_size,
- bool nearest_neighbor,
- ResourceFormat texture_format,
- const gfx::Rect& content_rect,
- float contents_scale,
- scoped_refptr<RasterSource> raster_source) {
+void PictureDrawQuad::SetNew(
+ const SharedQuadState* shared_quad_state,
+ const gfx::Rect& rect,
+ const gfx::Rect& opaque_rect,
+ const gfx::Rect& visible_rect,
+ const gfx::RectF& tex_coord_rect,
+ const gfx::Size& texture_size,
+ bool nearest_neighbor,
+ ResourceFormat texture_format,
+ const gfx::Rect& content_rect,
+ float contents_scale,
+ scoped_refptr<DisplayListRasterSource> raster_source) {
ContentDrawQuadBase::SetNew(
shared_quad_state,
DrawQuad::PICTURE_CONTENT,
@@ -44,18 +45,19 @@ void PictureDrawQuad::SetNew(const SharedQuadState* shared_quad_state,
this->texture_format = texture_format;
}
-void PictureDrawQuad::SetAll(const SharedQuadState* shared_quad_state,
- const gfx::Rect& rect,
- const gfx::Rect& opaque_rect,
- const gfx::Rect& visible_rect,
- bool needs_blending,
- const gfx::RectF& tex_coord_rect,
- const gfx::Size& texture_size,
- bool nearest_neighbor,
- ResourceFormat texture_format,
- const gfx::Rect& content_rect,
- float contents_scale,
- scoped_refptr<RasterSource> raster_source) {
+void PictureDrawQuad::SetAll(
+ const SharedQuadState* shared_quad_state,
+ const gfx::Rect& rect,
+ const gfx::Rect& opaque_rect,
+ const gfx::Rect& visible_rect,
+ bool needs_blending,
+ const gfx::RectF& tex_coord_rect,
+ const gfx::Size& texture_size,
+ bool nearest_neighbor,
+ ResourceFormat texture_format,
+ const gfx::Rect& content_rect,
+ float contents_scale,
+ scoped_refptr<DisplayListRasterSource> raster_source) {
ContentDrawQuadBase::SetAll(shared_quad_state,
DrawQuad::PICTURE_CONTENT,
rect,
diff --git a/cc/quads/picture_draw_quad.h b/cc/quads/picture_draw_quad.h
index 9a01a9b..93140eb 100644
--- a/cc/quads/picture_draw_quad.h
+++ b/cc/quads/picture_draw_quad.h
@@ -8,7 +8,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
#include "cc/quads/content_draw_quad_base.h"
#include "cc/resources/resource_provider.h"
#include "ui/gfx/geometry/rect.h"
@@ -33,7 +33,7 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
ResourceFormat texture_format,
const gfx::Rect& content_rect,
float contents_scale,
- scoped_refptr<RasterSource> raster_source);
+ scoped_refptr<DisplayListRasterSource> raster_source);
void SetAll(const SharedQuadState* shared_quad_state,
const gfx::Rect& rect,
@@ -46,11 +46,11 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase {
ResourceFormat texture_format,
const gfx::Rect& content_rect,
float contents_scale,
- scoped_refptr<RasterSource> raster_source);
+ scoped_refptr<DisplayListRasterSource> raster_source);
gfx::Rect content_rect;
float contents_scale;
- scoped_refptr<RasterSource> raster_source;
+ scoped_refptr<DisplayListRasterSource> raster_source;
ResourceFormat texture_format;
static const PictureDrawQuad* MaterialCast(const DrawQuad* quad);
diff --git a/cc/raster/bitmap_tile_task_worker_pool.cc b/cc/raster/bitmap_tile_task_worker_pool.cc
index 034ad0f..39524ac7 100644
--- a/cc/raster/bitmap_tile_task_worker_pool.cc
+++ b/cc/raster/bitmap_tile_task_worker_pool.cc
@@ -10,7 +10,7 @@
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
#include "cc/debug/traced_value.h"
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
#include "cc/raster/raster_buffer.h"
#include "cc/resources/platform_color.h"
#include "cc/resources/resource.h"
@@ -31,7 +31,7 @@ class RasterBufferImpl : public RasterBuffer {
}
// Overridden from RasterBuffer:
- void Playback(const RasterSource* raster_source,
+ void Playback(const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
uint64_t new_content_id,
diff --git a/cc/raster/gpu_rasterizer.cc b/cc/raster/gpu_rasterizer.cc
index 1768894..9525d8f 100644
--- a/cc/raster/gpu_rasterizer.cc
+++ b/cc/raster/gpu_rasterizer.cc
@@ -12,7 +12,7 @@
#include "cc/debug/devtools_instrumentation.h"
#include "cc/debug/frame_viewer_instrumentation.h"
#include "cc/output/context_provider.h"
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
#include "cc/raster/raster_buffer.h"
#include "cc/raster/scoped_gpu_raster.h"
#include "cc/resources/resource.h"
@@ -40,7 +40,7 @@ GpuRasterizer::~GpuRasterizer() {
void GpuRasterizer::RasterizeSource(
ResourceProvider::ScopedWriteLockGr* write_lock,
- const RasterSource* raster_source,
+ const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& playback_rect,
float scale) {
diff --git a/cc/raster/gpu_rasterizer.h b/cc/raster/gpu_rasterizer.h
index 76e8639..04b5c18 100644
--- a/cc/raster/gpu_rasterizer.h
+++ b/cc/raster/gpu_rasterizer.h
@@ -15,15 +15,15 @@
namespace cc {
class ContextProvider;
+class DisplayListRasterSource;
class ResourceProvider;
-class RasterSource;
class CC_EXPORT GpuRasterizer {
public:
~GpuRasterizer();
void RasterizeSource(ResourceProvider::ScopedWriteLockGr* write_lock,
- const RasterSource* raster_source,
+ const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& playback_rect,
float scale);
diff --git a/cc/raster/gpu_tile_task_worker_pool.cc b/cc/raster/gpu_tile_task_worker_pool.cc
index e8dc102..59c0911 100644
--- a/cc/raster/gpu_tile_task_worker_pool.cc
+++ b/cc/raster/gpu_tile_task_worker_pool.cc
@@ -7,7 +7,7 @@
#include <algorithm>
#include "base/trace_event/trace_event.h"
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
#include "cc/raster/gpu_rasterizer.h"
#include "cc/raster/raster_buffer.h"
#include "cc/raster/scoped_gpu_raster.h"
@@ -34,7 +34,7 @@ class RasterBufferImpl : public RasterBuffer {
}
// Overridden from RasterBuffer:
- void Playback(const RasterSource* raster_source,
+ void Playback(const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
uint64_t new_content_id,
diff --git a/cc/raster/one_copy_tile_task_worker_pool.cc b/cc/raster/one_copy_tile_task_worker_pool.cc
index 86a0561..3dbe5d2 100644
--- a/cc/raster/one_copy_tile_task_worker_pool.cc
+++ b/cc/raster/one_copy_tile_task_worker_pool.cc
@@ -42,7 +42,7 @@ class RasterBufferImpl : public RasterBuffer {
~RasterBufferImpl() override {}
// Overridden from RasterBuffer:
- void Playback(const RasterSource* raster_source,
+ void Playback(const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
uint64_t new_content_id,
@@ -367,7 +367,7 @@ void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster(
void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread(
const Resource* resource,
const ResourceProvider::ScopedWriteLockGL* resource_lock,
- const RasterSource* raster_source,
+ const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
float scale,
diff --git a/cc/raster/one_copy_tile_task_worker_pool.h b/cc/raster/one_copy_tile_task_worker_pool.h
index 3b02bae..9673102 100644
--- a/cc/raster/one_copy_tile_task_worker_pool.h
+++ b/cc/raster/one_copy_tile_task_worker_pool.h
@@ -78,7 +78,7 @@ class CC_EXPORT OneCopyTileTaskWorkerPool
void PlaybackAndCopyOnWorkerThread(
const Resource* resource,
const ResourceProvider::ScopedWriteLockGL* resource_lock,
- const RasterSource* raster_source,
+ const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
float scale,
diff --git a/cc/raster/raster_buffer.h b/cc/raster/raster_buffer.h
index ac4e74c..d3dc01c 100644
--- a/cc/raster/raster_buffer.h
+++ b/cc/raster/raster_buffer.h
@@ -9,14 +9,14 @@
#include "ui/gfx/geometry/rect.h"
namespace cc {
-class RasterSource;
+class DisplayListRasterSource;
class CC_EXPORT RasterBuffer {
public:
RasterBuffer();
virtual ~RasterBuffer();
- virtual void Playback(const RasterSource* raster_source,
+ virtual void Playback(const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
uint64_t new_content_id,
diff --git a/cc/raster/tile_task_worker_pool.cc b/cc/raster/tile_task_worker_pool.cc
index b1d7b70..34c84cb 100644
--- a/cc/raster/tile_task_worker_pool.cc
+++ b/cc/raster/tile_task_worker_pool.cc
@@ -7,7 +7,7 @@
#include <algorithm>
#include "base/trace_event/trace_event.h"
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDrawFilter.h"
@@ -165,15 +165,16 @@ class SkipImageFilter : public SkDrawFilter {
};
// static
-void TileTaskWorkerPool::PlaybackToMemory(void* memory,
- ResourceFormat format,
- const gfx::Size& size,
- size_t stride,
- const RasterSource* raster_source,
- const gfx::Rect& canvas_bitmap_rect,
- const gfx::Rect& canvas_playback_rect,
- float scale,
- bool include_images) {
+void TileTaskWorkerPool::PlaybackToMemory(
+ void* memory,
+ ResourceFormat format,
+ const gfx::Size& size,
+ size_t stride,
+ const DisplayListRasterSource* raster_source,
+ const gfx::Rect& canvas_bitmap_rect,
+ const gfx::Rect& canvas_playback_rect,
+ float scale,
+ bool include_images) {
TRACE_EVENT0("cc", "TileTaskWorkerPool::PlaybackToMemory");
DCHECK(IsSupportedPlaybackToMemoryFormat(format)) << format;
diff --git a/cc/raster/tile_task_worker_pool.h b/cc/raster/tile_task_worker_pool.h
index 0fc9d3f..6657b9a 100644
--- a/cc/raster/tile_task_worker_pool.h
+++ b/cc/raster/tile_task_worker_pool.h
@@ -14,7 +14,7 @@ class SequencedTaskRunner;
}
namespace cc {
-class RasterSource;
+class DisplayListRasterSource;
class RenderingStatsInstrumentation;
class CC_EXPORT TileTaskWorkerPool {
@@ -63,7 +63,7 @@ class CC_EXPORT TileTaskWorkerPool {
ResourceFormat format,
const gfx::Size& size,
size_t stride,
- const RasterSource* raster_source,
+ const DisplayListRasterSource* raster_source,
const gfx::Rect& canvas_bitmap_rect,
const gfx::Rect& canvas_playback_rect,
float scale,
diff --git a/cc/raster/tile_task_worker_pool_unittest.cc b/cc/raster/tile_task_worker_pool_unittest.cc
index 515035b..b97f3ae 100644
--- a/cc/raster/tile_task_worker_pool_unittest.cc
+++ b/cc/raster/tile_task_worker_pool_unittest.cc
@@ -48,8 +48,9 @@ enum TileTaskWorkerPoolType {
class TestRasterTaskImpl : public RasterTask {
public:
- typedef base::Callback<void(const RasterSource::SolidColorAnalysis& analysis,
- bool was_canceled)> Reply;
+ typedef base::Callback<void(
+ const DisplayListRasterSource::SolidColorAnalysis& analysis,
+ bool was_canceled)> Reply;
TestRasterTaskImpl(const Resource* resource,
const Reply& reply,
@@ -75,7 +76,8 @@ class TestRasterTaskImpl : public RasterTask {
}
void CompleteOnOriginThread(TileTaskClient* client) override {
client->ReleaseBufferForRaster(raster_buffer_.Pass());
- reply_.Run(RasterSource::SolidColorAnalysis(), !HasFinishedRunning());
+ reply_.Run(DisplayListRasterSource::SolidColorAnalysis(),
+ !HasFinishedRunning());
}
protected:
@@ -85,7 +87,7 @@ class TestRasterTaskImpl : public RasterTask {
const Resource* resource_;
const Reply reply_;
scoped_ptr<RasterBuffer> raster_buffer_;
- scoped_refptr<RasterSource> raster_source_;
+ scoped_refptr<DisplayListRasterSource> raster_source_;
DISALLOW_COPY_AND_ASSIGN(TestRasterTaskImpl);
};
@@ -288,10 +290,11 @@ class TileTaskWorkerPoolTest
output_surface_.get(), &shared_bitmap_manager_, nullptr);
}
- void OnTaskCompleted(scoped_ptr<ScopedResource> resource,
- unsigned id,
- const RasterSource::SolidColorAnalysis& analysis,
- bool was_canceled) {
+ void OnTaskCompleted(
+ scoped_ptr<ScopedResource> resource,
+ unsigned id,
+ const DisplayListRasterSource::SolidColorAnalysis& analysis,
+ bool was_canceled) {
RasterTaskResult result;
result.id = id;
result.canceled = was_canceled;
diff --git a/cc/raster/zero_copy_tile_task_worker_pool.cc b/cc/raster/zero_copy_tile_task_worker_pool.cc
index 0a6e80e..8a92e63a 100644
--- a/cc/raster/zero_copy_tile_task_worker_pool.cc
+++ b/cc/raster/zero_copy_tile_task_worker_pool.cc
@@ -26,7 +26,7 @@ class RasterBufferImpl : public RasterBuffer {
: lock_(resource_provider, resource->id()), resource_(resource) {}
// Overridden from RasterBuffer:
- void Playback(const RasterSource* raster_source,
+ void Playback(const DisplayListRasterSource* raster_source,
const gfx::Rect& raster_full_rect,
const gfx::Rect& raster_dirty_rect,
uint64_t new_content_id,
diff --git a/cc/test/fake_display_list_recording_source.cc b/cc/test/fake_display_list_recording_source.cc
index 6bfb7f2..9f792c7 100644
--- a/cc/test/fake_display_list_recording_source.cc
+++ b/cc/test/fake_display_list_recording_source.cc
@@ -14,8 +14,8 @@ bool FakeDisplayListRecordingSource::IsSuitableForGpuRasterization() const {
return DisplayListRecordingSource::IsSuitableForGpuRasterization();
}
-scoped_refptr<RasterSource> FakeDisplayListRecordingSource::CreateRasterSource(
- bool can_use_lcd) const {
+scoped_refptr<DisplayListRasterSource>
+FakeDisplayListRecordingSource::CreateRasterSource(bool can_use_lcd) const {
return FakeDisplayListRasterSource::CreateFromRecordingSourceWithWaitable(
this, can_use_lcd, playback_allowed_event_);
}
diff --git a/cc/test/fake_display_list_recording_source.h b/cc/test/fake_display_list_recording_source.h
index 12121f5..8b6436c 100644
--- a/cc/test/fake_display_list_recording_source.h
+++ b/cc/test/fake_display_list_recording_source.h
@@ -46,7 +46,7 @@ class FakeDisplayListRecordingSource : public DisplayListRecordingSource {
}
// DisplayListRecordingSource overrides.
- scoped_refptr<RasterSource> CreateRasterSource(
+ scoped_refptr<DisplayListRasterSource> CreateRasterSource(
bool can_use_lcd) const override;
bool IsSuitableForGpuRasterization() const override;
diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc
index 93cfbc2..8743287 100644
--- a/cc/test/fake_picture_layer_impl.cc
+++ b/cc/test/fake_picture_layer_impl.cc
@@ -13,7 +13,7 @@ namespace cc {
FakePictureLayerImpl::FakePictureLayerImpl(
LayerTreeImpl* tree_impl,
int id,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
bool is_mask)
: PictureLayerImpl(tree_impl,
id,
@@ -31,7 +31,7 @@ FakePictureLayerImpl::FakePictureLayerImpl(
FakePictureLayerImpl::FakePictureLayerImpl(
LayerTreeImpl* tree_impl,
int id,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
bool is_mask,
const gfx::Size& layer_bounds)
: PictureLayerImpl(tree_impl,
@@ -125,7 +125,7 @@ PictureLayerTiling* FakePictureLayerImpl::LowResTiling() const {
}
void FakePictureLayerImpl::SetRasterSourceOnPending(
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
const Region& invalidation) {
DCHECK(layer_tree_impl()->IsPendingTree());
Region invalidation_temp = invalidation;
diff --git a/cc/test/fake_picture_layer_impl.h b/cc/test/fake_picture_layer_impl.h
index 3aeeb1c..291152f 100644
--- a/cc/test/fake_picture_layer_impl.h
+++ b/cc/test/fake_picture_layer_impl.h
@@ -7,7 +7,7 @@
#include "base/memory/scoped_ptr.h"
#include "cc/layers/picture_layer_impl.h"
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
namespace cc {
@@ -29,7 +29,7 @@ class FakePictureLayerImpl : public PictureLayerImpl {
static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource(
LayerTreeImpl* tree_impl,
int id,
- scoped_refptr<RasterSource> raster_source) {
+ scoped_refptr<DisplayListRasterSource> raster_source) {
bool is_mask = false;
return make_scoped_ptr(
new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask));
@@ -39,7 +39,7 @@ class FakePictureLayerImpl : public PictureLayerImpl {
static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource(
LayerTreeImpl* tree_impl,
int id,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
const gfx::Size& layer_bounds) {
bool is_mask = false;
return make_scoped_ptr(new FakePictureLayerImpl(
@@ -51,7 +51,7 @@ class FakePictureLayerImpl : public PictureLayerImpl {
static scoped_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource(
LayerTreeImpl* tree_impl,
int id,
- scoped_refptr<RasterSource> raster_source) {
+ scoped_refptr<DisplayListRasterSource> raster_source) {
bool is_mask = true;
return make_scoped_ptr(
new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask));
@@ -104,9 +104,10 @@ class FakePictureLayerImpl : public PictureLayerImpl {
size_t num_tilings() const { return tilings_->num_tilings(); }
PictureLayerTilingSet* tilings() { return tilings_.get(); }
- RasterSource* raster_source() { return raster_source_.get(); }
- void SetRasterSourceOnPending(scoped_refptr<RasterSource> raster_source,
- const Region& invalidation);
+ DisplayListRasterSource* raster_source() { return raster_source_.get(); }
+ void SetRasterSourceOnPending(
+ scoped_refptr<DisplayListRasterSource> raster_source,
+ const Region& invalidation);
size_t append_quads_count() { return append_quads_count_; }
const Region& invalidation() const { return invalidation_; }
@@ -150,11 +151,11 @@ class FakePictureLayerImpl : public PictureLayerImpl {
protected:
FakePictureLayerImpl(LayerTreeImpl* tree_impl,
int id,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
bool is_mask);
FakePictureLayerImpl(LayerTreeImpl* tree_impl,
int id,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
bool is_mask,
const gfx::Size& layer_bounds);
FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask);
diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h
index bce6648..7352276 100644
--- a/cc/test/fake_picture_layer_tiling_client.h
+++ b/cc/test/fake_picture_layer_tiling_client.h
@@ -46,7 +46,7 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient {
void set_has_valid_tile_priorities(bool has_valid_tile_priorities) {
has_valid_tile_priorities_ = has_valid_tile_priorities;
}
- RasterSource* raster_source() { return raster_source_.get(); }
+ DisplayListRasterSource* raster_source() { return raster_source_.get(); }
TileManager* tile_manager() const {
return tile_manager_.get();
diff --git a/cc/tiles/picture_layer_tiling.cc b/cc/tiles/picture_layer_tiling.cc
index be8a794..0d51a5d 100644
--- a/cc/tiles/picture_layer_tiling.cc
+++ b/cc/tiles/picture_layer_tiling.cc
@@ -16,7 +16,7 @@
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
#include "cc/base/math_util.h"
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
#include "cc/tiles/prioritized_tile.h"
#include "cc/tiles/tile.h"
#include "cc/tiles/tile_priority.h"
@@ -36,7 +36,7 @@ const float kMaxSoonBorderDistanceInScreenPixels = 312.f;
scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
WhichTree tree,
float contents_scale,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
PictureLayerTilingClient* client,
size_t tiling_interest_area_padding,
float skewport_target_time_in_seconds,
@@ -50,7 +50,7 @@ scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
PictureLayerTiling::PictureLayerTiling(
WhichTree tree,
float contents_scale,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
PictureLayerTilingClient* client,
size_t tiling_interest_area_padding,
float skewport_target_time_in_seconds,
@@ -205,7 +205,7 @@ void PictureLayerTiling::TakeTilesAndPropertiesFrom(
}
void PictureLayerTiling::SetRasterSourceAndResize(
- scoped_refptr<RasterSource> raster_source) {
+ scoped_refptr<DisplayListRasterSource> raster_source) {
DCHECK(!raster_source->IsSolidColor());
gfx::Size old_layer_bounds = raster_source_->GetSize();
raster_source_.swap(raster_source);
diff --git a/cc/tiles/picture_layer_tiling.h b/cc/tiles/picture_layer_tiling.h
index 08380b1..0d38f1e 100644
--- a/cc/tiles/picture_layer_tiling.h
+++ b/cc/tiles/picture_layer_tiling.h
@@ -28,9 +28,9 @@ class TracedValue;
namespace cc {
+class DisplayListRasterSource;
class PictureLayerTiling;
class PrioritizedTile;
-class RasterSource;
class CC_EXPORT PictureLayerTilingClient {
public:
@@ -95,13 +95,14 @@ class CC_EXPORT PictureLayerTiling {
static scoped_ptr<PictureLayerTiling> Create(
WhichTree tree,
float contents_scale,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
PictureLayerTilingClient* client,
size_t tiling_interest_area_padding,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content_pixels);
- void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source);
+ void SetRasterSourceAndResize(
+ scoped_refptr<DisplayListRasterSource> raster_source);
void Invalidate(const Region& layer_invalidation);
void CreateMissingTilesInLiveTilesRect();
void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin,
@@ -125,7 +126,9 @@ class CC_EXPORT PictureLayerTiling {
can_require_tiles_for_activation_ = can_require_tiles;
}
- RasterSource* raster_source() const { return raster_source_.get(); }
+ DisplayListRasterSource* raster_source() const {
+ return raster_source_.get();
+ }
gfx::Size tiling_size() const { return tiling_data_.tiling_size(); }
gfx::Rect live_tiles_rect() const { return live_tiles_rect_; }
gfx::Size tile_size() const { return tiling_data_.max_texture_size(); }
@@ -277,7 +280,7 @@ class CC_EXPORT PictureLayerTiling {
PictureLayerTiling(WhichTree tree,
float contents_scale,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
PictureLayerTilingClient* client,
size_t tiling_interest_area_padding,
float skewport_target_time_in_seconds,
@@ -376,7 +379,7 @@ class CC_EXPORT PictureLayerTiling {
const float contents_scale_;
PictureLayerTilingClient* const client_;
const WhichTree tree_;
- scoped_refptr<RasterSource> raster_source_;
+ scoped_refptr<DisplayListRasterSource> raster_source_;
TileResolution resolution_;
bool may_contain_low_resolution_tiles_;
diff --git a/cc/tiles/picture_layer_tiling_set.cc b/cc/tiles/picture_layer_tiling_set.cc
index a9e16f5..9facf9f2 100644
--- a/cc/tiles/picture_layer_tiling_set.cc
+++ b/cc/tiles/picture_layer_tiling_set.cc
@@ -8,7 +8,7 @@
#include <set>
#include <vector>
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
namespace cc {
@@ -60,7 +60,7 @@ PictureLayerTilingSet::~PictureLayerTilingSet() {
void PictureLayerTilingSet::CopyTilingsAndPropertiesFromPendingTwin(
const PictureLayerTilingSet* pending_twin_set,
- const scoped_refptr<RasterSource>& raster_source,
+ const scoped_refptr<DisplayListRasterSource>& raster_source,
const Region& layer_invalidation) {
if (pending_twin_set->tilings_.empty()) {
// If the twin (pending) tiling set is empty, it was not updated for the
@@ -92,7 +92,7 @@ void PictureLayerTilingSet::CopyTilingsAndPropertiesFromPendingTwin(
}
void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation(
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
const PictureLayerTilingSet* pending_twin_set,
const Region& layer_invalidation,
float minimum_contents_scale,
@@ -131,7 +131,7 @@ void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation(
}
void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForCommit(
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
const Region& layer_invalidation,
float minimum_contents_scale,
float maximum_contents_scale) {
@@ -157,7 +157,7 @@ void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForCommit(
}
void PictureLayerTilingSet::UpdateRasterSourceDueToLCDChange(
- const scoped_refptr<RasterSource>& raster_source,
+ const scoped_refptr<DisplayListRasterSource>& raster_source,
const Region& layer_invalidation) {
for (PictureLayerTiling* tiling : tilings_) {
tiling->SetRasterSourceAndResize(raster_source);
@@ -242,7 +242,7 @@ void PictureLayerTilingSet::MarkAllTilingsNonIdeal() {
PictureLayerTiling* PictureLayerTilingSet::AddTiling(
float contents_scale,
- scoped_refptr<RasterSource> raster_source) {
+ scoped_refptr<DisplayListRasterSource> raster_source) {
for (size_t i = 0; i < tilings_.size(); ++i) {
DCHECK_NE(tilings_[i]->contents_scale(), contents_scale);
DCHECK_EQ(tilings_[i]->raster_source(), raster_source.get());
diff --git a/cc/tiles/picture_layer_tiling_set.h b/cc/tiles/picture_layer_tiling_set.h
index b3e22fe..c6d3589 100644
--- a/cc/tiles/picture_layer_tiling_set.h
+++ b/cc/tiles/picture_layer_tiling_set.h
@@ -56,7 +56,7 @@ class CC_EXPORT PictureLayerTilingSet {
// This function is called on the active tree during activation.
void UpdateTilingsToCurrentRasterSourceForActivation(
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
const PictureLayerTilingSet* pending_twin_set,
const Region& layer_invalidation,
float minimum_contents_scale,
@@ -64,18 +64,19 @@ class CC_EXPORT PictureLayerTilingSet {
// This function is called on the sync tree during commit.
void UpdateTilingsToCurrentRasterSourceForCommit(
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
const Region& layer_invalidation,
float minimum_contents_scale,
float maximum_contents_scale);
// This function is called on the sync tree right after commit.
void UpdateRasterSourceDueToLCDChange(
- const scoped_refptr<RasterSource>& raster_source,
+ const scoped_refptr<DisplayListRasterSource>& raster_source,
const Region& layer_invalidation);
- PictureLayerTiling* AddTiling(float contents_scale,
- scoped_refptr<RasterSource> raster_source);
+ PictureLayerTiling* AddTiling(
+ float contents_scale,
+ scoped_refptr<DisplayListRasterSource> raster_source);
size_t num_tilings() const { return tilings_.size(); }
int NumHighResTilings() const;
PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; }
@@ -180,7 +181,7 @@ class CC_EXPORT PictureLayerTilingSet {
void CopyTilingsAndPropertiesFromPendingTwin(
const PictureLayerTilingSet* pending_twin_set,
- const scoped_refptr<RasterSource>& raster_source,
+ const scoped_refptr<DisplayListRasterSource>& raster_source,
const Region& layer_invalidation);
// Remove one tiling.
diff --git a/cc/tiles/picture_layer_tiling_unittest.cc b/cc/tiles/picture_layer_tiling_unittest.cc
index ec3b870..3058b04 100644
--- a/cc/tiles/picture_layer_tiling_unittest.cc
+++ b/cc/tiles/picture_layer_tiling_unittest.cc
@@ -43,7 +43,7 @@ class TestablePictureLayerTiling : public PictureLayerTiling {
static scoped_ptr<TestablePictureLayerTiling> Create(
WhichTree tree,
float contents_scale,
- scoped_refptr<RasterSource> raster_source,
+ scoped_refptr<DisplayListRasterSource> raster_source,
PictureLayerTilingClient* client,
const LayerTreeSettings& settings) {
return make_scoped_ptr(new TestablePictureLayerTiling(
@@ -59,13 +59,14 @@ class TestablePictureLayerTiling : public PictureLayerTiling {
using PictureLayerTiling::RemoveTileAt;
protected:
- TestablePictureLayerTiling(WhichTree tree,
- float contents_scale,
- scoped_refptr<RasterSource> raster_source,
- PictureLayerTilingClient* client,
- size_t tiling_interest_area_padding,
- float skewport_target_time,
- int skewport_extrapolation_limit)
+ TestablePictureLayerTiling(
+ WhichTree tree,
+ float contents_scale,
+ scoped_refptr<DisplayListRasterSource> raster_source,
+ PictureLayerTilingClient* client,
+ size_t tiling_interest_area_padding,
+ float skewport_target_time,
+ int skewport_extrapolation_limit)
: PictureLayerTiling(tree,
contents_scale,
raster_source,
diff --git a/cc/tiles/prioritized_tile.cc b/cc/tiles/prioritized_tile.cc
index 2e0246c..cf6e66f 100644
--- a/cc/tiles/prioritized_tile.cc
+++ b/cc/tiles/prioritized_tile.cc
@@ -14,14 +14,13 @@ PrioritizedTile::PrioritizedTile()
}
PrioritizedTile::PrioritizedTile(Tile* tile,
- RasterSource* raster_source,
+ DisplayListRasterSource* raster_source,
const TilePriority priority,
bool is_occluded)
: tile_(tile),
raster_source_(raster_source),
priority_(priority),
- is_occluded_(is_occluded) {
-}
+ is_occluded_(is_occluded) {}
PrioritizedTile::~PrioritizedTile() {
}
diff --git a/cc/tiles/prioritized_tile.h b/cc/tiles/prioritized_tile.h
index 6811d90..d799f58 100644
--- a/cc/tiles/prioritized_tile.h
+++ b/cc/tiles/prioritized_tile.h
@@ -10,8 +10,8 @@
#include "cc/tiles/tile_priority.h"
namespace cc {
+class DisplayListRasterSource;
class PictureLayerTiling;
-class RasterSource;
class CC_EXPORT PrioritizedTile {
public:
@@ -21,7 +21,7 @@ class CC_EXPORT PrioritizedTile {
~PrioritizedTile();
Tile* tile() const { return tile_; }
- RasterSource* raster_source() const { return raster_source_; }
+ DisplayListRasterSource* raster_source() const { return raster_source_; }
const TilePriority& priority() const { return priority_; }
bool is_occluded() const { return is_occluded_; }
@@ -31,12 +31,12 @@ class CC_EXPORT PrioritizedTile {
friend class PictureLayerTiling;
PrioritizedTile(Tile* tile,
- RasterSource* raster_source,
+ DisplayListRasterSource* raster_source,
const TilePriority priority,
bool is_occluded);
Tile* tile_;
- RasterSource* raster_source_;
+ DisplayListRasterSource* raster_source_;
TilePriority priority_;
bool is_occluded_;
};
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc
index 96ad0c0..c743ab8 100644
--- a/cc/tiles/tile_manager.cc
+++ b/cc/tiles/tile_manager.cc
@@ -38,24 +38,24 @@ DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(
class RasterTaskImpl : public RasterTask {
public:
- RasterTaskImpl(
- const Resource* resource,
- RasterSource* raster_source,
- const gfx::Rect& content_rect,
- const gfx::Rect& invalid_content_rect,
- float contents_scale,
- TileResolution tile_resolution,
- int layer_id,
- uint64_t source_prepare_tiles_id,
- const void* tile,
- uint64_t new_content_id,
- uint64_t previous_content_id,
- uint64_t resource_content_id,
- int source_frame_number,
- bool analyze_picture,
- const base::Callback<void(const RasterSource::SolidColorAnalysis&, bool)>&
- reply,
- ImageDecodeTask::Vector* dependencies)
+ RasterTaskImpl(const Resource* resource,
+ DisplayListRasterSource* raster_source,
+ const gfx::Rect& content_rect,
+ const gfx::Rect& invalid_content_rect,
+ float contents_scale,
+ TileResolution tile_resolution,
+ int layer_id,
+ uint64_t source_prepare_tiles_id,
+ const void* tile,
+ uint64_t new_content_id,
+ uint64_t previous_content_id,
+ uint64_t resource_content_id,
+ int source_frame_number,
+ bool analyze_picture,
+ const base::Callback<
+ void(const DisplayListRasterSource::SolidColorAnalysis&,
+ bool)>& reply,
+ ImageDecodeTask::Vector* dependencies)
: RasterTask(dependencies),
resource_(resource),
raster_source_(raster_source),
@@ -105,7 +105,7 @@ class RasterTaskImpl : public RasterTask {
~RasterTaskImpl() override { DCHECK(!raster_buffer_); }
private:
- void Analyze(const RasterSource* raster_source) {
+ void Analyze(const DisplayListRasterSource* raster_source) {
frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task(
tile_, tile_resolution_, source_frame_number_, layer_id_);
@@ -117,7 +117,7 @@ class RasterTaskImpl : public RasterTask {
analysis_.is_solid_color &= kUseColorEstimator;
}
- void Raster(const RasterSource* raster_source) {
+ void Raster(const DisplayListRasterSource* raster_source) {
frame_viewer_instrumentation::ScopedRasterTask raster_task(
tile_, tile_resolution_, source_frame_number_, layer_id_);
ScopedRasterTaskTimer timer;
@@ -132,8 +132,8 @@ class RasterTaskImpl : public RasterTask {
}
const Resource* resource_;
- RasterSource::SolidColorAnalysis analysis_;
- scoped_refptr<RasterSource> raster_source_;
+ DisplayListRasterSource::SolidColorAnalysis analysis_;
+ scoped_refptr<DisplayListRasterSource> raster_source_;
gfx::Rect content_rect_;
gfx::Rect invalid_content_rect_;
float contents_scale_;
@@ -146,8 +146,8 @@ class RasterTaskImpl : public RasterTask {
uint64_t resource_content_id_;
int source_frame_number_;
bool analyze_picture_;
- const base::Callback<void(const RasterSource::SolidColorAnalysis&, bool)>
- reply_;
+ const base::Callback<void(const DisplayListRasterSource::SolidColorAnalysis&,
+ bool)> reply_;
scoped_ptr<RasterBuffer> raster_buffer_;
DISALLOW_COPY_AND_ASSIGN(RasterTaskImpl);
@@ -700,7 +700,7 @@ scoped_refptr<RasterTask> TileManager::CreateRasterTask(
void TileManager::OnRasterTaskCompleted(
Tile::Id tile_id,
Resource* resource,
- const RasterSource::SolidColorAnalysis& analysis,
+ const DisplayListRasterSource::SolidColorAnalysis& analysis,
bool was_canceled) {
DCHECK(tiles_.find(tile_id) != tiles_.end());
@@ -725,7 +725,7 @@ void TileManager::OnRasterTaskCompleted(
void TileManager::UpdateTileDrawInfo(
Tile* tile,
Resource* resource,
- const RasterSource::SolidColorAnalysis& analysis) {
+ const DisplayListRasterSource::SolidColorAnalysis& analysis) {
TileDrawInfo& draw_info = tile->draw_info();
++flush_stats_.completed_count;
diff --git a/cc/tiles/tile_manager.h b/cc/tiles/tile_manager.h
index d0ba944..a23519b 100644
--- a/cc/tiles/tile_manager.h
+++ b/cc/tiles/tile_manager.h
@@ -15,7 +15,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "cc/base/unique_notifier.h"
-#include "cc/playback/raster_source.h"
+#include "cc/playback/display_list_raster_source.h"
#include "cc/raster/tile_task_runner.h"
#include "cc/resources/memory_history.h"
#include "cc/resources/resource_pool.h"
@@ -251,13 +251,15 @@ class CC_EXPORT TileManager : public TileTaskRunnerClient {
int resource_count_;
};
- void OnRasterTaskCompleted(Tile::Id tile,
- Resource* resource,
- const RasterSource::SolidColorAnalysis& analysis,
- bool was_canceled);
- void UpdateTileDrawInfo(Tile* tile,
- Resource* resource,
- const RasterSource::SolidColorAnalysis& analysis);
+ void OnRasterTaskCompleted(
+ Tile::Id tile,
+ Resource* resource,
+ const DisplayListRasterSource::SolidColorAnalysis& analysis,
+ bool was_canceled);
+ void UpdateTileDrawInfo(
+ Tile* tile,
+ Resource* resource,
+ const DisplayListRasterSource::SolidColorAnalysis& analysis);
void FreeResourcesForTile(Tile* tile);
void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile);
diff --git a/cc/tiles/tile_manager_perftest.cc b/cc/tiles/tile_manager_perftest.cc
index bb61942..3bb46e4 100644
--- a/cc/tiles/tile_manager_perftest.cc
+++ b/cc/tiles/tile_manager_perftest.cc
@@ -154,14 +154,14 @@ class TileManagerPerfTest : public testing::Test {
active_root_layer_->set_fixed_tile_size(tile_size);
}
- void SetupTrees(scoped_refptr<RasterSource> pending_raster_source,
- scoped_refptr<RasterSource> active_raster_source) {
+ void SetupTrees(scoped_refptr<DisplayListRasterSource> pending_raster_source,
+ scoped_refptr<DisplayListRasterSource> active_raster_source) {
SetupPendingTree(active_raster_source);
ActivateTree();
SetupPendingTree(pending_raster_source);
}
- void SetupPendingTree(scoped_refptr<RasterSource> raster_source) {
+ void SetupPendingTree(scoped_refptr<DisplayListRasterSource> raster_source) {
host_impl_.CreatePendingTree();
LayerTreeImpl* pending_tree = host_impl_.pending_tree();
// Clear recycled tree.
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc
index 73a3cec..7cbb6ee 100644
--- a/cc/tiles/tile_manager_unittest.cc
+++ b/cc/tiles/tile_manager_unittest.cc
@@ -112,14 +112,14 @@ class TileManagerTilePriorityQueueTest : public testing::Test {
active_layer_->set_fixed_tile_size(tile_size);
}
- void SetupTrees(scoped_refptr<RasterSource> pending_raster_source,
- scoped_refptr<RasterSource> active_raster_source) {
+ void SetupTrees(scoped_refptr<DisplayListRasterSource> pending_raster_source,
+ scoped_refptr<DisplayListRasterSource> active_raster_source) {
SetupPendingTree(active_raster_source);
ActivateTree();
SetupPendingTree(pending_raster_source);
}
- void SetupPendingTree(scoped_refptr<RasterSource> raster_source) {
+ void SetupPendingTree(scoped_refptr<DisplayListRasterSource> raster_source) {
host_impl_.CreatePendingTree();
LayerTreeImpl* pending_tree = host_impl_.pending_tree();
@@ -1514,7 +1514,7 @@ TEST_F(TileManagerTest, LowResHasNoImage) {
for (size_t i = 0; i < arraysize(resolutions); ++i) {
SCOPED_TRACE(resolutions[i]);
- // Make a RasterSource that will draw a blue bitmap image.
+ // Make a DisplayListRasterSource that will draw a blue bitmap image.
skia::RefPtr<SkSurface> surface = skia::AdoptRef(
SkSurface::NewRasterN32Premul(size.width(), size.height()));
ASSERT_NE(surface, nullptr);
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 9232c5a..d2aeade 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -8370,7 +8370,7 @@ TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) {
host_impl_->CreatePendingTree();
Region empty_invalidation;
- scoped_refptr<RasterSource> raster_source_with_tiles(
+ scoped_refptr<DisplayListRasterSource> raster_source_with_tiles(
FakeDisplayListRasterSource::CreateFilled(gfx::Size(10, 10)));
scoped_ptr<FakePictureLayerImpl> layer =