diff --git a/cc/BUILD.gn b/cc/BUILD.gn index 5d5d1c69276b57..2513c6ea02d08e 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn @@ -293,8 +293,6 @@ component("cc") { "playback/display_item_list_settings.h", "playback/display_item_proto_factory.cc", "playback/display_item_proto_factory.h", - "playback/display_list_raster_source.cc", - "playback/display_list_raster_source.h", "playback/display_list_recording_source.cc", "playback/display_list_recording_source.h", "playback/draw_image.cc", @@ -309,6 +307,8 @@ component("cc") { "playback/image_hijack_canvas.h", "playback/largest_display_item.cc", "playback/largest_display_item.h", + "playback/raster_source.cc", + "playback/raster_source.h", "playback/skip_image_canvas.cc", "playback/skip_image_canvas.h", "playback/transform_display_item.cc", @@ -586,8 +586,6 @@ source_set("test_support") { "test/fake_channel_impl.h", "test/fake_content_layer_client.cc", "test/fake_content_layer_client.h", - "test/fake_display_list_raster_source.cc", - "test/fake_display_list_raster_source.h", "test/fake_display_list_recording_source.cc", "test/fake_display_list_recording_source.h", "test/fake_external_begin_frame_source.cc", @@ -619,6 +617,8 @@ source_set("test_support") { "test/fake_picture_layer_tiling_client.h", "test/fake_proxy.cc", "test/fake_proxy.h", + "test/fake_raster_source.cc", + "test/fake_raster_source.h", "test/fake_renderer_client.cc", "test/fake_renderer_client.h", "test/fake_rendering_stats_instrumentation.h", @@ -833,8 +833,8 @@ test("cc_unittests") { "output/texture_mailbox_deleter_unittest.cc", "playback/discardable_image_map_unittest.cc", "playback/display_item_list_unittest.cc", - "playback/display_list_raster_source_unittest.cc", "playback/display_list_recording_source_unittest.cc", + "playback/raster_source_unittest.cc", "proto/base_conversions_unittest.cc", "proto/cc_conversions_unittest.cc", "proto/gfx_conversions_unittest.cc", diff --git a/cc/cc.gyp b/cc/cc.gyp index 44d2b8762f9851..fe65c544f2203f 100644 --- a/cc/cc.gyp +++ b/cc/cc.gyp @@ -355,8 +355,6 @@ 'playback/display_item_list_settings.h', 'playback/display_item_proto_factory.cc', 'playback/display_item_proto_factory.h', - 'playback/display_list_raster_source.cc', - 'playback/display_list_raster_source.h', 'playback/display_list_recording_source.cc', 'playback/display_list_recording_source.h', 'playback/draw_image.cc', @@ -371,6 +369,8 @@ 'playback/image_hijack_canvas.h', 'playback/largest_display_item.cc', 'playback/largest_display_item.h', + 'playback/raster_source.cc', + 'playback/raster_source.h', 'playback/skip_image_canvas.cc', 'playback/skip_image_canvas.h', 'playback/transform_display_item.cc', diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index 8cbc51dcb2ec8e..10862d1b84583f 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -85,8 +85,8 @@ 'output/texture_mailbox_deleter_unittest.cc', 'playback/discardable_image_map_unittest.cc', 'playback/display_item_list_unittest.cc', - 'playback/display_list_raster_source_unittest.cc', 'playback/display_list_recording_source_unittest.cc', + 'playback/raster_source_unittest.cc', 'proto/base_conversions_unittest.cc', 'proto/cc_conversions_unittest.cc', 'proto/gfx_conversions_unittest.cc', @@ -183,8 +183,6 @@ 'test/fake_channel_impl.h', 'test/fake_content_layer_client.cc', 'test/fake_content_layer_client.h', - 'test/fake_display_list_raster_source.cc', - 'test/fake_display_list_raster_source.h', 'test/fake_display_list_recording_source.cc', 'test/fake_display_list_recording_source.h', 'test/fake_external_begin_frame_source.cc', @@ -216,6 +214,8 @@ 'test/fake_picture_layer_tiling_client.h', 'test/fake_proxy.cc', 'test/fake_proxy.h', + 'test/fake_raster_source.cc', + 'test/fake_raster_source.h', 'test/fake_renderer_client.cc', 'test/fake_renderer_client.h', 'test/fake_rendering_stats_instrumentation.h', diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc index d2999c5ec22375..438acd833022ec 100644 --- a/cc/debug/rasterize_and_record_benchmark_impl.cc +++ b/cc/debug/rasterize_and_record_benchmark_impl.cc @@ -25,7 +25,7 @@ namespace { const int kDefaultRasterizeRepeatCount = 100; -void RunBenchmark(DisplayListRasterSource* raster_source, +void RunBenchmark(RasterSource* raster_source, const gfx::Rect& content_rect, float contents_scale, size_t repeat_count, @@ -179,7 +179,7 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) { tiling_set->AddTiling(1.f, layer->GetRasterSource()); tiling->set_resolution(HIGH_RESOLUTION); tiling->CreateAllTilesForTesting(); - DisplayListRasterSource* raster_source = tiling->raster_source().get(); + RasterSource* raster_source = tiling->raster_source().get(); for (PictureLayerTiling::CoverageIterator it(tiling, 1.f, layer->visible_layer_rect()); it; ++it) { @@ -204,7 +204,7 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) { rasterize_results_.total_best_time += min_time; } - const DisplayListRasterSource* layer_raster_source = layer->GetRasterSource(); + const RasterSource* layer_raster_source = layer->GetRasterSource(); rasterize_results_.total_memory_usage += layer_raster_source->GetPictureMemoryUsage(); } diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc index 238683963c8bc7..63dd21b9586f4d 100644 --- a/cc/layers/picture_image_layer_impl_unittest.cc +++ b/cc/layers/picture_image_layer_impl_unittest.cc @@ -7,10 +7,10 @@ #include "base/thread_task_runner_handle.h" #include "cc/layers/append_quads_data.h" #include "cc/quads/draw_quad.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_impl_task_runner_provider.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_output_surface.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_task_graph_runner.h" #include "cc/tiles/tile_priority.h" @@ -71,7 +71,7 @@ class PictureImageLayerImplTest : public testing::Test { } TestablePictureImageLayerImpl* layer = new TestablePictureImageLayerImpl(tree, id); - layer->raster_source_ = FakeDisplayListRasterSource::CreateInfiniteFilled(); + layer->raster_source_ = FakeRasterSource::CreateInfiniteFilled(); layer->SetBounds(layer->raster_source_->GetSize()); return make_scoped_ptr(layer); } diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc index 2763cf90975708..56885c3ffe6b69 100644 --- a/cc/layers/picture_layer.cc +++ b/cc/layers/picture_layer.cc @@ -55,7 +55,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 raster_source = + scoped_refptr raster_source = recording_source_->CreateRasterSource(can_use_lcd_text); layer_impl->set_gpu_raster_max_texture_size( layer_tree_host()->device_viewport_size()); @@ -144,7 +144,7 @@ sk_sp PictureLayer::GetPicture() const { client_, &recording_invalidation, layer_size, gfx::Rect(layer_size), update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY); - scoped_refptr raster_source = + scoped_refptr 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 cf2e36a209bdcb..d74a3b6ff7979a 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -526,7 +526,7 @@ PictureLayerImpl* PictureLayerImpl::GetPendingOrActiveTwinLayer() const { } void PictureLayerImpl::UpdateRasterSource( - scoped_refptr raster_source, + scoped_refptr raster_source, Region* new_invalidation, const PictureLayerTilingSet* pending_set) { // The bounds and the pile size may differ if the pile wasn't updated (ie. @@ -593,7 +593,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 new_raster_source = + scoped_refptr 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 6b10911afbc2f9..8293de03aeb4c5 100644 --- a/cc/layers/picture_layer_impl.h +++ b/cc/layers/picture_layer_impl.h @@ -62,7 +62,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 raster_source, + void UpdateRasterSource(scoped_refptr raster_source, Region* new_invalidation, const PictureLayerTilingSet* pending_set); bool UpdateTiles(); @@ -89,9 +89,7 @@ class CC_EXPORT PictureLayerImpl bool IsOnActiveOrPendingTree() const; // Used for benchmarking - DisplayListRasterSource* GetRasterSource() const { - return raster_source_.get(); - } + RasterSource* GetRasterSource() const { return raster_source_.get(); } protected: friend class LayerRasterTileIterator; @@ -127,7 +125,7 @@ class CC_EXPORT PictureLayerImpl PictureLayerImpl* twin_layer_; scoped_ptr tilings_; - scoped_refptr raster_source_; + scoped_refptr raster_source_; Region invalidation_; float ideal_page_scale_; diff --git a/cc/layers/picture_layer_impl_perftest.cc b/cc/layers/picture_layer_impl_perftest.cc index 2bf89e7113c92e..72d135371a90d1 100644 --- a/cc/layers/picture_layer_impl_perftest.cc +++ b/cc/layers/picture_layer_impl_perftest.cc @@ -7,11 +7,11 @@ #include "base/macros.h" #include "base/thread_task_runner_handle.h" #include "cc/debug/lap_timer.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_impl_task_runner_provider.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_picture_layer_impl.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_task_graph_runner.h" #include "cc/tiles/tiling_set_raster_queue_all.h" @@ -57,8 +57,8 @@ class PictureLayerImplPerfTest : public testing::Test { } void SetupPendingTree(const gfx::Size& layer_bounds) { - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); host_impl_.CreatePendingTree(); LayerTreeImpl* pending_tree = host_impl_.pending_tree(); pending_tree->ClearLayers(); diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index a73e2933d4a636..525d5854bd0553 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -21,12 +21,12 @@ #include "cc/quads/tile_draw_quad.h" #include "cc/test/begin_frame_args_test.h" #include "cc/test/fake_content_layer_client.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_display_list_recording_source.h" #include "cc/test/fake_impl_task_runner_provider.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_picture_layer_impl.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/gpu_rasterization_enabled_settings.h" #include "cc/test/layer_test_common.h" @@ -122,20 +122,20 @@ class PictureLayerImplTest : public testing::Test { } void SetupDefaultTrees(const gfx::Size& layer_bounds) { - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTrees(pending_raster_source, active_raster_source); } void SetupDefaultTreesWithInvalidation(const gfx::Size& layer_bounds, const Region& invalidation) { - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTreesWithInvalidation(pending_raster_source, active_raster_source, invalidation); @@ -163,25 +163,25 @@ class PictureLayerImplTest : public testing::Test { void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds, const gfx::Size& tile_size, const Region& invalidation) { - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source, tile_size, invalidation); } - void SetupTrees(scoped_refptr pending_raster_source, - scoped_refptr active_raster_source) { + void SetupTrees(scoped_refptr pending_raster_source, + scoped_refptr active_raster_source) { SetupPendingTree(active_raster_source); ActivateTree(); SetupPendingTreeInternal(pending_raster_source, gfx::Size(), Region()); } void SetupTreesWithInvalidation( - scoped_refptr pending_raster_source, - scoped_refptr active_raster_source, + scoped_refptr pending_raster_source, + scoped_refptr active_raster_source, const Region& pending_invalidation) { SetupPendingTreeInternal(active_raster_source, gfx::Size(), Region()); ActivateTree(); @@ -190,8 +190,8 @@ class PictureLayerImplTest : public testing::Test { } void SetupTreesWithFixedTileSize( - scoped_refptr pending_raster_source, - scoped_refptr active_raster_source, + scoped_refptr pending_raster_source, + scoped_refptr active_raster_source, const gfx::Size& tile_size, const Region& pending_invalidation) { SetupPendingTreeInternal(active_raster_source, tile_size, Region()); @@ -200,27 +200,26 @@ class PictureLayerImplTest : public testing::Test { pending_invalidation); } - void SetupPendingTree(scoped_refptr raster_source) { + void SetupPendingTree(scoped_refptr raster_source) { SetupPendingTreeInternal(raster_source, gfx::Size(), Region()); } void SetupPendingTreeWithInvalidation( - scoped_refptr raster_source, + scoped_refptr raster_source, const Region& invalidation) { SetupPendingTreeInternal(raster_source, gfx::Size(), invalidation); } void SetupPendingTreeWithFixedTileSize( - scoped_refptr raster_source, + scoped_refptr raster_source, const gfx::Size& tile_size, const Region& invalidation) { SetupPendingTreeInternal(raster_source, tile_size, invalidation); } - void SetupPendingTreeInternal( - scoped_refptr raster_source, - const gfx::Size& tile_size, - const Region& invalidation) { + void SetupPendingTreeInternal(scoped_refptr raster_source, + const gfx::Size& tile_size, + const Region& invalidation) { host_impl_.CreatePendingTree(); host_impl_.pending_tree()->PushPageScaleFromMainThread(1.f, 0.00001f, 100000.f); @@ -306,7 +305,7 @@ class PictureLayerImplTest : public testing::Test { static void VerifyAllPrioritizedTilesExistAndHaveRasterSource( const PictureLayerTiling* tiling, - DisplayListRasterSource* raster_source) { + RasterSource* raster_source) { auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting(); for (PictureLayerTiling::CoverageIterator iter( @@ -417,8 +416,8 @@ TEST_F(PictureLayerImplTest, TileGridAlignment) { gfx::Size layer_size(settings.default_tile_size.width() * 7 / 2, settings.default_tile_size.height() * 7 / 2); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_size); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_size); // Create an active recording source, but make sure it's not solid. scoped_ptr active_recording_source = @@ -428,9 +427,9 @@ TEST_F(PictureLayerImplTest, TileGridAlignment) { active_recording_source->add_draw_rect( gfx::Rect(0, 0, layer_size.width() - 1, layer_size.height() - 1)); active_recording_source->Rerecord(); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - active_recording_source.get(), false); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFromRecordingSource(active_recording_source.get(), + false); SetupTrees(pending_raster_source, active_raster_source); @@ -453,9 +452,9 @@ TEST_F(PictureLayerImplTest, TileGridAlignment) { // Force re-raster with newly injected content active_recording_source->Rerecord(); - scoped_refptr updated_active_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - active_recording_source.get(), false); + scoped_refptr updated_active_raster_source = + FakeRasterSource::CreateFromRecordingSource(active_recording_source.get(), + false); std::vector::const_iterator rect_iter = rects.begin(); for (tile_iter = tiles.begin(); tile_iter < tiles.end(); tile_iter++) { @@ -602,12 +601,12 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { gfx::Size layer_bounds(400, 400); gfx::Rect layer_invalidation(150, 200, 30, 180); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr lost_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr lost_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(lost_raster_source, gfx::Size(50, 50), Region()); @@ -682,10 +681,10 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { TEST_F(PictureLayerImplTest, CloneFullInvalidation) { gfx::Size layer_bounds(300, 500); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTreesWithInvalidation(pending_raster_source, active_raster_source, gfx::Rect(layer_bounds)); @@ -837,10 +836,10 @@ TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) { // makes it valid again should be able to create tilings. gfx::Size layer_bounds(1300, 1900); - scoped_refptr empty_raster_source = - FakeDisplayListRasterSource::CreateEmpty(layer_bounds); - scoped_refptr valid_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr empty_raster_source = + FakeRasterSource::CreateEmpty(layer_bounds); + scoped_refptr valid_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(valid_raster_source); ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); @@ -863,10 +862,10 @@ TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) { TEST_F(PictureLayerImplTest, LowResTilingStaysOnActiveTree) { gfx::Size layer_bounds(1300, 1900); - scoped_refptr valid_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr other_valid_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr valid_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr other_valid_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(valid_raster_source); ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); @@ -1244,10 +1243,10 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { gfx::Size layer_bounds(host_impl_.settings().default_tile_size); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTrees(pending_raster_source, active_raster_source); @@ -1316,8 +1315,8 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { gfx::Size layer_bounds(1000, 1000); - scoped_refptr valid_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr valid_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(valid_raster_source); scoped_ptr mask_ptr = @@ -1371,8 +1370,8 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { // Resize larger than the max texture size. int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size; gfx::Size huge_bounds(max_texture_size + 1, 10); - scoped_refptr huge_raster_source = - FakeDisplayListRasterSource::CreateFilled(huge_bounds); + scoped_refptr huge_raster_source = + FakeRasterSource::CreateFilled(huge_bounds); SetupPendingTree(huge_raster_source); pending_mask->SetBounds(huge_bounds); @@ -1423,8 +1422,8 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { // contents scale. Then the layer should no longer have any tiling. float min_contents_scale = host_impl_.settings().minimum_contents_scale; gfx::Size extra_huge_bounds(max_texture_size / min_contents_scale + 1, 10); - scoped_refptr extra_huge_raster_source = - FakeDisplayListRasterSource::CreateFilled(extra_huge_bounds); + scoped_refptr extra_huge_raster_source = + FakeRasterSource::CreateFilled(extra_huge_bounds); SetupPendingTree(extra_huge_raster_source); pending_mask->SetBounds(extra_huge_bounds); @@ -1445,8 +1444,8 @@ TEST_F(PictureLayerImplTest, ScaledMaskLayer) { SetInitialDeviceScaleFactor(1.3f); - scoped_refptr valid_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr valid_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(valid_raster_source); scoped_ptr mask_ptr = @@ -1518,8 +1517,8 @@ TEST_F(PictureLayerImplTest, ReleaseResources) { TEST_F(PictureLayerImplTest, ClampTilesToMaxTileSize) { gfx::Size layer_bounds(5000, 5000); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source); EXPECT_GE(pending_layer_->tilings()->num_tilings(), 1u); @@ -1638,9 +1637,8 @@ TEST_F(PictureLayerImplTest, ResourcelessPartialRecording) { SetInitialDeviceScaleFactor(2.f); gfx::Rect recorded_viewport(20, 30, 40, 50); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds, - recorded_viewport); + scoped_refptr active_raster_source = + FakeRasterSource::CreatePartiallyFilled(layer_bounds, recorded_viewport); SetupPendingTree(active_raster_source); ActivateTree(); @@ -1671,9 +1669,8 @@ TEST_F(PictureLayerImplTest, ResourcelessEmptyRecording) { scoped_ptr render_pass = RenderPass::Create(); gfx::Size layer_bounds(700, 650); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds, - gfx::Rect()); + scoped_refptr active_raster_source = + FakeRasterSource::CreatePartiallyFilled(layer_bounds, gfx::Rect()); SetupPendingTree(active_raster_source); ActivateTree(); @@ -1694,10 +1691,10 @@ TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) { gfx::Size layer_bounds(1500, 1500); gfx::Rect visible_rect(250, 250, 1000, 1000); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilledSolidColor(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilledSolidColor(layer_bounds); SetupTrees(pending_raster_source, active_raster_source); @@ -1720,10 +1717,10 @@ TEST_F(PictureLayerImplTest, SolidColorLayerHasVisibleFullCoverage) { TEST_F(PictureLayerImplTest, TileScalesWithSolidColorRasterSource) { gfx::Size layer_bounds(200, 200); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilledSolidColor(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilledSolidColor(layer_bounds); SetupTrees(pending_raster_source, active_raster_source); // Solid color raster source should not allow tilings at any scale. @@ -1744,8 +1741,8 @@ TEST_F(NoLowResPictureLayerImplTest, MarkRequiredOffscreenTiles) { gfx::Rect viewport(0, 0, 100, 200); host_impl_.SetExternalTilePriorityConstraints(viewport, transform); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, gfx::Size(100, 100), Region()); @@ -1861,8 +1858,8 @@ TEST_F(PictureLayerImplTest, HighResTileIsComplete) { gfx::Size tile_size(100, 100); gfx::Size layer_bounds(200, 200); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); ActivateTree(); @@ -1891,8 +1888,8 @@ TEST_F(PictureLayerImplTest, HighResTileIsIncomplete) { gfx::Size tile_size(100, 100); gfx::Size layer_bounds(200, 200); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); ActivateTree(); @@ -1914,8 +1911,8 @@ TEST_F(PictureLayerImplTest, HighResTileIsIncompleteLowResComplete) { gfx::Size tile_size(100, 100); gfx::Size layer_bounds(200, 200); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); ActivateTree(); @@ -1941,8 +1938,8 @@ TEST_F(PictureLayerImplTest, LowResTileIsIncomplete) { gfx::Size tile_size(100, 100); gfx::Size layer_bounds(200, 200); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); ActivateTree(); @@ -2038,9 +2035,8 @@ TEST_F(PictureLayerImplTest, AppendQuadsDataForCheckerboard) { gfx::Size layer_bounds(200, 200); gfx::Rect recorded_viewport(0, 0, 150, 150); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds, - recorded_viewport); + scoped_refptr pending_raster_source = + FakeRasterSource::CreatePartiallyFilled(layer_bounds, recorded_viewport); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); ActivateTree(); @@ -2151,15 +2147,14 @@ TEST_F(PictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { gfx::Size layer_bounds(400, 400); gfx::Size tile_size(100, 100); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); // This raster source will create tilings, but has no recordings so will not // create any tiles. This is attempting to simulate scrolling past the end of // recorded content on the active layer, where the recordings are so far away // that no tiles are created. - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds, - gfx::Rect()); + scoped_refptr active_raster_source = + FakeRasterSource::CreatePartiallyFilled(layer_bounds, gfx::Rect()); SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source, tile_size, Region()); @@ -2181,10 +2176,10 @@ TEST_F(PictureLayerImplTest, HighResRequiredIfActiveCantHaveTiles) { gfx::Size layer_bounds(400, 400); gfx::Size tile_size(100, 100); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateEmpty(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateEmpty(layer_bounds); SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source, tile_size, Region()); @@ -2206,10 +2201,10 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) { gfx::Size active_layer_bounds(200, 200); gfx::Size tile_size(100, 100); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(pending_layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(active_layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(pending_layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(active_layer_bounds); SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source, tile_size, Region()); @@ -2228,8 +2223,8 @@ TEST_F(PictureLayerImplTest, HighResRequiredWhenActiveHasDifferentBounds) { TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) { gfx::Size layer_bounds(400, 400); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); host_impl_.CreatePendingTree(); LayerTreeImpl* pending_tree = host_impl_.pending_tree(); @@ -2262,8 +2257,8 @@ TEST_F(PictureLayerImplTest, ActivateUninitializedLayer) { TEST_F(PictureLayerImplTest, ShareTilesOnNextFrame) { gfx::Size layer_bounds(1500, 1500); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source); @@ -2342,17 +2337,17 @@ TEST_F(PictureLayerImplTest, PendingHasNoTilesWithNoInvalidation) { TEST_F(PictureLayerImplTest, ShareInvalidActiveTreeTiles) { gfx::Size layer_bounds(1500, 1500); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTreesWithInvalidation(pending_raster_source, active_raster_source, gfx::Rect(1, 1)); // Activate the invalidation. ActivateTree(); // Make another pending tree without any invalidation in it. - scoped_refptr pending_raster_source2 = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source2 = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source2); EXPECT_GE(active_layer_->num_tilings(), 1u); @@ -2407,10 +2402,10 @@ TEST_F(PictureLayerImplTest, SyncTilingAfterGpuRasterizationToggles) { gfx::Size layer_bounds(10, 10); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTrees(pending_raster_source, active_raster_source); @@ -2458,8 +2453,8 @@ TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) { // Put 0.5 as high res. SetInitialDeviceScaleFactor(0.5f); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(gfx::Size(10, 10)); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(gfx::Size(10, 10)); SetupPendingTree(pending_raster_source); // Sanity checks. @@ -2469,8 +2464,7 @@ TEST_F(PictureLayerImplTest, HighResCreatedWhenBoundsShrink) { ActivateTree(); // Now, set the bounds to be 1x1, so that minimum contents scale becomes 1. - pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(gfx::Size(1, 1)); + pending_raster_source = FakeRasterSource::CreateFilled(gfx::Size(1, 1)); SetupPendingTree(pending_raster_source); // Another sanity check. @@ -2886,8 +2880,8 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueue) { gfx::Size layer_bounds(1000, 1000); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source); EXPECT_EQ(1u, pending_layer_->num_tilings()); @@ -3018,8 +3012,8 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueueActiveTree) { gfx::Size layer_bounds(1000, 1000); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source); ActivateTree(); @@ -3044,9 +3038,8 @@ TEST_F(PictureLayerImplTest, TilingSetRasterQueueActiveTree) { } TEST_F(PictureLayerImplTest, TilingSetRasterQueueRequiredNoHighRes) { - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilledSolidColor( - gfx::Size(1024, 1024)); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilledSolidColor(gfx::Size(1024, 1024)); SetupPendingTree(pending_raster_source); EXPECT_FALSE( @@ -3066,8 +3059,8 @@ TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) { host_impl_.SetViewportSize(gfx::Size(500, 500)); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); // TODO(vmpstr): Add a test with tilings other than high res on the active // tree (crbug.com/519607). @@ -3211,8 +3204,8 @@ TEST_F(PictureLayerImplTest, Occlusion) { LayerTestCommon::LayerImplTest impl; host_impl_.SetViewportSize(viewport_size); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); ActivateTree(); @@ -3496,15 +3489,14 @@ TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) { gfx::Size layer_bounds(400, 400); gfx::Size tile_size(100, 100); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); // This raster source will create tilings, but has no recordings so will not // create any tiles. This is attempting to simulate scrolling past the end of // recorded content on the active layer, where the recordings are so far away // that no tiles are created. - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreatePartiallyFilled(layer_bounds, - gfx::Rect()); + scoped_refptr active_raster_source = + FakeRasterSource::CreatePartiallyFilled(layer_bounds, gfx::Rect()); SetupTreesWithFixedTileSize(pending_raster_source, active_raster_source, tile_size, Region()); @@ -3727,8 +3719,8 @@ TEST_F(PictureLayerImplTestWithDelegatingRenderer, gfx::Size layer_bounds(1000, 1000); // Create tiles. - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source); pending_layer_->SetBounds(layer_bounds); ActivateTree(); @@ -3834,8 +3826,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, host_impl_.SetViewportSize(viewport_size); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); // No occlusion. @@ -3926,8 +3918,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, host_impl_.SetViewportSize(viewport_size); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); // No occlusion. @@ -4044,8 +4036,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) { gfx::Size viewport_size(500, 500); gfx::PointF occluding_layer_position(310.f, 0.f); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); host_impl_.SetViewportSize(viewport_size); @@ -4118,10 +4110,10 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) { gfx::PointF occluding_layer_position(310.f, 0.f); gfx::Rect invalidation_rect(230, 230, 102, 102); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); host_impl_.SetViewportSize(viewport_size); SetupPendingTree(active_raster_source); @@ -4212,10 +4204,10 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, host_impl_.SetViewportSize(viewport_size); SetInitialDeviceScaleFactor(2.f); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(active_raster_source, tile_size, Region()); @@ -4351,8 +4343,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, TEST_F(PictureLayerImplTest, PendingOrActiveTwinLayer) { gfx::Size layer_bounds(1000, 1000); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(raster_source); EXPECT_FALSE(pending_layer_->GetPendingOrActiveTwinLayer()); @@ -4401,7 +4393,7 @@ void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) { &client, &invalidation, layer_bounds, layer_rect, frame_number++, DisplayListRecordingSource::RECORD_NORMALLY); - scoped_refptr pending_raster_source = + scoped_refptr pending_raster_source = recording_source->CreateRasterSource(true); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); @@ -4466,7 +4458,7 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { &client, &invalidation1, layer_bounds, layer_rect, frame_number++, DisplayListRecordingSource::RECORD_NORMALLY); - scoped_refptr raster_source1 = + scoped_refptr raster_source1 = recording_source->CreateRasterSource(true); SetupPendingTree(raster_source1); @@ -4486,7 +4478,7 @@ TEST_F(PictureLayerImplTest, NonSolidToSolidNoTilings) { &client, &invalidation2, layer_bounds, layer_rect, frame_number++, DisplayListRecordingSource::RECORD_NORMALLY); - scoped_refptr raster_source2 = + scoped_refptr raster_source2 = recording_source->CreateRasterSource(true); SetupPendingTree(raster_source2); @@ -4559,12 +4551,12 @@ TEST_F(PictureLayerImplTest, CloneMissingRecordings) { gfx::Size tile_size(100, 100); gfx::Size layer_bounds(400, 400); - scoped_refptr filled_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr filled_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); - scoped_refptr partial_raster_source = - FakeDisplayListRasterSource::CreatePartiallyFilled( - layer_bounds, gfx::Rect(100, 100, 300, 300)); + scoped_refptr partial_raster_source = + FakeRasterSource::CreatePartiallyFilled(layer_bounds, + gfx::Rect(100, 100, 300, 300)); SetupPendingTreeWithFixedTileSize(filled_raster_source, tile_size, Region()); ActivateTree(); @@ -4626,10 +4618,10 @@ TEST_F(PictureLayerImplTest, ScrollPastLiveTilesRectAndBack) { host_impl_.SetViewportSize(viewport_size); SetInitialDeviceScaleFactor(1.f); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTreeWithFixedTileSize(active_raster_source, tile_size, Region()); @@ -4697,8 +4689,8 @@ TEST_F(PictureLayerImplTest, UpdateLCDInvalidatesPendingTree) { host_impl_.SetViewportSize(viewport_size); SetInitialDeviceScaleFactor(1.f); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilledLCD(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilledLCD(layer_bounds); SetupPendingTreeWithFixedTileSize(pending_raster_source, tile_size, Region()); EXPECT_TRUE(pending_layer_->RasterSourceUsesLCDText()); @@ -4732,8 +4724,8 @@ TEST_F(PictureLayerImplTest, TilingAllTilesDone) { gfx::Size layer_bounds(1000, 1000); // Create tiles. - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source); pending_layer_->SetBounds(layer_bounds); ActivateTree(); diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index a953a927531426..9d93aa8b703625 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -11,8 +11,8 @@ #include "cc/quads/picture_draw_quad.h" #include "cc/quads/texture_draw_quad.h" #include "cc/resources/video_resource_updater.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_display_list_recording_source.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/pixel_test.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "media/base/video_frame.h" @@ -823,9 +823,8 @@ TYPED_TEST(IntersectingQuadSoftwareTest, PictureQuads) { blue_recording->add_draw_rect_with_paint(outer_rect, black_paint); blue_recording->add_draw_rect_with_paint(inner_rect, blue_paint); blue_recording->Rerecord(); - scoped_refptr blue_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - blue_recording.get(), false); + scoped_refptr blue_raster_source = + FakeRasterSource::CreateFromRecordingSource(blue_recording.get(), false); PictureDrawQuad* blue_quad = this->render_pass_->template CreateAndAppendDrawQuad(); @@ -841,9 +840,8 @@ TYPED_TEST(IntersectingQuadSoftwareTest, PictureQuads) { green_recording->add_draw_rect_with_paint(outer_rect, green_paint); green_recording->add_draw_rect_with_paint(inner_rect, black_paint); green_recording->Rerecord(); - scoped_refptr green_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - green_recording.get(), false); + scoped_refptr green_raster_source = + FakeRasterSource::CreateFromRecordingSource(green_recording.get(), false); PictureDrawQuad* green_quad = this->render_pass_->template CreateAndAppendDrawQuad(); @@ -2348,9 +2346,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadIdentityScale) { blue_recording->add_draw_rect_with_paint(blue_clip_rect, blue_paint); blue_recording->Rerecord(); - scoped_refptr blue_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - blue_recording.get(), false); + scoped_refptr blue_raster_source = + FakeRasterSource::CreateFromRecordingSource(blue_recording.get(), false); gfx::Vector2d offset(viewport.bottom_right() - blue_rect.bottom_right()); gfx::Transform blue_quad_to_target_transform; @@ -2377,9 +2374,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadIdentityScale) { green_paint.setColor(SK_ColorGREEN); green_recording->add_draw_rect_with_paint(viewport, green_paint); green_recording->Rerecord(); - scoped_refptr green_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - green_recording.get(), false); + scoped_refptr green_raster_source = + FakeRasterSource::CreateFromRecordingSource(green_recording.get(), false); gfx::Transform green_quad_to_target_transform; SharedQuadState* green_shared_state = CreateTestSharedQuadState( @@ -2420,9 +2416,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadOpacity) { green_paint.setColor(SK_ColorGREEN); green_recording->add_draw_rect_with_paint(viewport, green_paint); green_recording->Rerecord(); - scoped_refptr green_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - green_recording.get(), false); + scoped_refptr green_raster_source = + FakeRasterSource::CreateFromRecordingSource(green_recording.get(), false); gfx::Transform green_quad_to_target_transform; SharedQuadState* green_shared_state = CreateTestSharedQuadState( @@ -2443,9 +2438,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadOpacity) { white_paint.setColor(SK_ColorWHITE); white_recording->add_draw_rect_with_paint(viewport, white_paint); white_recording->Rerecord(); - scoped_refptr white_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - white_recording.get(), false); + scoped_refptr white_raster_source = + FakeRasterSource::CreateFromRecordingSource(white_recording.get(), false); gfx::Transform white_quad_to_target_transform; SharedQuadState* white_shared_state = CreateTestSharedQuadState( @@ -2515,9 +2509,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadDisableImageFiltering) { paint.setFilterQuality(kLow_SkFilterQuality); recording->add_draw_image_with_paint(image.get(), gfx::Point(), paint); recording->Rerecord(); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource(recording.get(), - false); + scoped_refptr raster_source = + FakeRasterSource::CreateFromRecordingSource(recording.get(), false); gfx::Transform quad_to_target_transform; SharedQuadState* shared_state = @@ -2567,9 +2560,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadNearestNeighbor) { paint.setFilterQuality(kLow_SkFilterQuality); recording->add_draw_image_with_paint(image.get(), gfx::Point(), paint); recording->Rerecord(); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource(recording.get(), - false); + scoped_refptr raster_source = + FakeRasterSource::CreateFromRecordingSource(recording.get(), false); gfx::Transform quad_to_target_transform; SharedQuadState* shared_state = @@ -2774,9 +2766,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadNonIdentityScale) { green_recording->add_draw_rect_with_paint(green_rect1, green_paint); green_recording->add_draw_rect_with_paint(green_rect2, green_paint); green_recording->Rerecord(); - scoped_refptr green_raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource( - green_recording.get(), false); + scoped_refptr green_raster_source = + FakeRasterSource::CreateFromRecordingSource(green_recording.get(), false); SharedQuadState* top_right_green_shared_quad_state = CreateTestSharedQuadState(green_quad_to_target_transform, viewport, @@ -2845,9 +2836,8 @@ TYPED_TEST(SoftwareRendererPixelTest, PictureDrawQuadNonIdentityScale) { recording->add_draw_rectf_with_paint(blue_layer_rect1, blue_paint); recording->add_draw_rectf_with_paint(blue_layer_rect2, blue_paint); recording->Rerecord(); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFromRecordingSource(recording.get(), - false); + scoped_refptr raster_source = + FakeRasterSource::CreateFromRecordingSource(recording.get(), false); gfx::Rect content_rect( gfx::ScaleToEnclosingRect(layer_rect, contents_scale)); diff --git a/cc/playback/display_list_recording_source.cc b/cc/playback/display_list_recording_source.cc index a6f558492dbdc1..9f396371daef45 100644 --- a/cc/playback/display_list_recording_source.cc +++ b/cc/playback/display_list_recording_source.cc @@ -13,7 +13,7 @@ #include "cc/base/region.h" #include "cc/layers/content_layer_client.h" #include "cc/playback/display_item_list.h" -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/proto/display_list_recording_source.pb.h" #include "cc/proto/gfx_conversions.h" #include "skia/ext/analysis_canvas.h" @@ -232,11 +232,11 @@ bool DisplayListRecordingSource::IsSuitableForGpuRasterization() const { return !display_list_ || display_list_->IsSuitableForGpuRasterization(); } -scoped_refptr -DisplayListRecordingSource::CreateRasterSource(bool can_use_lcd_text) const { - return scoped_refptr( - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - this, can_use_lcd_text)); +scoped_refptr DisplayListRecordingSource::CreateRasterSource( + bool can_use_lcd_text) const { + return scoped_refptr( + RasterSource::CreateFromDisplayListRecordingSource(this, + can_use_lcd_text)); } void DisplayListRecordingSource::DetermineIfSolidColor() { diff --git a/cc/playback/display_list_recording_source.h b/cc/playback/display_list_recording_source.h index 754cec94ad79d0..fb9aa571544efa 100644 --- a/cc/playback/display_list_recording_source.h +++ b/cc/playback/display_list_recording_source.h @@ -24,7 +24,7 @@ class DisplayListRecordingSource; class ContentLayerClient; class DisplayItemList; -class DisplayListRasterSource; +class RasterSource; class ImageSerializationProcessor; class Region; @@ -67,7 +67,7 @@ class CC_EXPORT DisplayListRecordingSource { void SetNeedsDisplayRect(const gfx::Rect& layer_rect); // These functions are virtual for testing. - virtual scoped_refptr CreateRasterSource( + virtual scoped_refptr CreateRasterSource( bool can_use_lcd_text) const; virtual bool IsSuitableForGpuRasterization() const; @@ -95,7 +95,7 @@ class CC_EXPORT DisplayListRecordingSource { Region* invalidation); void FinishDisplayItemListUpdate(); - friend class DisplayListRasterSource; + friend class RasterSource; void DetermineIfSolidColor(); diff --git a/cc/playback/display_list_recording_source_unittest.cc b/cc/playback/display_list_recording_source_unittest.cc index 3b619bbcbe7c7f..6f87c1b4b3fbb0 100644 --- a/cc/playback/display_list_recording_source_unittest.cc +++ b/cc/playback/display_list_recording_source_unittest.cc @@ -5,7 +5,7 @@ #include #include "cc/base/region.h" -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/proto/display_list_recording_source.pb.h" #include "cc/test/fake_content_layer_client.h" #include "cc/test/fake_display_list_recording_source.h" @@ -25,11 +25,11 @@ scoped_ptr CreateRecordingSource( return recording_source; } -scoped_refptr CreateRasterSource( +scoped_refptr CreateRasterSource( FakeDisplayListRecordingSource* recording_source) { bool can_use_lcd_text = true; - return DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source, can_use_lcd_text); + return RasterSource::CreateFromDisplayListRecordingSource(recording_source, + can_use_lcd_text); } void ValidateRecordingSourceSerialization( @@ -133,9 +133,9 @@ TEST(DisplayListRecordingSourceTest, DiscardableImagesWithTransform) { recording_source->Rerecord(); bool can_use_lcd_text = true; - scoped_refptr raster_source = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), can_use_lcd_text); + scoped_refptr raster_source = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + can_use_lcd_text); // Tile sized iterators. These should find only one pixel ref. { @@ -196,7 +196,7 @@ TEST(DisplayListRecordingSourceTest, NoGatherImageEmptyImages) { recording_source->SetGenerateDiscardableImagesMetadata(false); recording_source->Rerecord(); - scoped_refptr raster_source = + scoped_refptr raster_source = CreateRasterSource(recording_source.get()); // If recording source do not gather images, raster source is not going to @@ -216,7 +216,7 @@ TEST(DisplayListRecordingSourceTest, EmptyImages) { recording_source->SetGenerateDiscardableImagesMetadata(true); recording_source->Rerecord(); - scoped_refptr raster_source = + scoped_refptr raster_source = CreateRasterSource(recording_source.get()); // Tile sized iterators. @@ -274,7 +274,7 @@ TEST(DisplayListRecordingSourceTest, NoDiscardableImages) { recording_source->SetGenerateDiscardableImagesMetadata(true); recording_source->Rerecord(); - scoped_refptr raster_source = + scoped_refptr raster_source = CreateRasterSource(recording_source.get()); // Tile sized iterators. @@ -326,7 +326,7 @@ TEST(DisplayListRecordingSourceTest, DiscardableImages) { recording_source->SetGenerateDiscardableImagesMetadata(true); recording_source->Rerecord(); - scoped_refptr raster_source = + scoped_refptr raster_source = CreateRasterSource(recording_source.get()); // Tile sized iterators. These should find only one image. @@ -402,7 +402,7 @@ TEST(DisplayListRecordingSourceTest, DiscardableImagesBaseNonDiscardable) { recording_source->SetGenerateDiscardableImagesMetadata(true); recording_source->Rerecord(); - scoped_refptr raster_source = + scoped_refptr raster_source = CreateRasterSource(recording_source.get()); // Tile sized iterators. These should find only one image. diff --git a/cc/playback/display_list_raster_source.cc b/cc/playback/raster_source.cc similarity index 77% rename from cc/playback/display_list_raster_source.cc rename to cc/playback/raster_source.cc index 970648fbade4d2..091c40a2bde844 100644 --- a/cc/playback/display_list_raster_source.cc +++ b/cc/playback/raster_source.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include @@ -23,17 +23,14 @@ namespace cc { -scoped_refptr -DisplayListRasterSource::CreateFromDisplayListRecordingSource( +scoped_refptr RasterSource::CreateFromDisplayListRecordingSource( const DisplayListRecordingSource* other, bool can_use_lcd_text) { - return make_scoped_refptr( - new DisplayListRasterSource(other, can_use_lcd_text)); + return make_scoped_refptr(new RasterSource(other, can_use_lcd_text)); } -DisplayListRasterSource::DisplayListRasterSource( - const DisplayListRecordingSource* other, - bool can_use_lcd_text) +RasterSource::RasterSource(const DisplayListRecordingSource* other, + bool can_use_lcd_text) : display_list_(other->display_list_), painter_reported_memory_usage_(other->painter_reported_memory_usage_), background_color_(other->background_color_), @@ -53,14 +50,11 @@ DisplayListRasterSource::DisplayListRasterSource( // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 if (base::ThreadTaskRunnerHandle::IsSet()) { base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( - this, "cc::DisplayListRasterSource", - base::ThreadTaskRunnerHandle::Get()); + this, "cc::RasterSource", base::ThreadTaskRunnerHandle::Get()); } } -DisplayListRasterSource::DisplayListRasterSource( - const DisplayListRasterSource* other, - bool can_use_lcd_text) +RasterSource::RasterSource(const RasterSource* other, bool can_use_lcd_text) : display_list_(other->display_list_), painter_reported_memory_usage_(other->painter_reported_memory_usage_), background_color_(other->background_color_), @@ -81,24 +75,22 @@ DisplayListRasterSource::DisplayListRasterSource( // TODO(ericrk): Get this working in Android Webview. crbug.com/517156 if (base::ThreadTaskRunnerHandle::IsSet()) { base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( - this, "cc::DisplayListRasterSource", - base::ThreadTaskRunnerHandle::Get()); + this, "cc::RasterSource", base::ThreadTaskRunnerHandle::Get()); } } -DisplayListRasterSource::~DisplayListRasterSource() { +RasterSource::~RasterSource() { // For MemoryDumpProvider deregistration to work correctly, this must happen - // on the same thread that the DisplayListRasterSource was created on. + // on the same thread that the RasterSource was created on. DCHECK(memory_dump_thread_checker_.CalledOnValidThread()); base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( this); } -void DisplayListRasterSource::PlaybackToSharedCanvas( - SkCanvas* raster_canvas, - const gfx::Rect& canvas_rect, - float contents_scale, - bool include_images) const { +void RasterSource::PlaybackToSharedCanvas(SkCanvas* raster_canvas, + const gfx::Rect& canvas_rect, + float contents_scale, + bool include_images) const { // TODO(vmpstr): This can be improved by plumbing whether the tile itself has // discardable images. This way we would only pay for the hijack canvas if the // tile actually needed it. @@ -118,18 +110,17 @@ void DisplayListRasterSource::PlaybackToSharedCanvas( } } -void DisplayListRasterSource::RasterForAnalysis(skia::AnalysisCanvas* canvas, - const gfx::Rect& canvas_rect, - float contents_scale) const { +void RasterSource::RasterForAnalysis(skia::AnalysisCanvas* canvas, + const gfx::Rect& canvas_rect, + float contents_scale) const { RasterCommon(canvas, canvas, canvas_rect, canvas_rect, contents_scale); } -void DisplayListRasterSource::PlaybackToCanvas( - SkCanvas* raster_canvas, - const gfx::Rect& canvas_bitmap_rect, - const gfx::Rect& canvas_playback_rect, - float contents_scale, - bool include_images) const { +void RasterSource::PlaybackToCanvas(SkCanvas* raster_canvas, + const gfx::Rect& canvas_bitmap_rect, + const gfx::Rect& canvas_playback_rect, + float contents_scale, + bool include_images) const { PrepareForPlaybackToCanvas(raster_canvas, canvas_bitmap_rect, canvas_playback_rect, contents_scale); @@ -150,7 +141,7 @@ void DisplayListRasterSource::PlaybackToCanvas( } } -void DisplayListRasterSource::PrepareForPlaybackToCanvas( +void RasterSource::PrepareForPlaybackToCanvas( SkCanvas* canvas, const gfx::Rect& canvas_bitmap_rect, const gfx::Rect& canvas_playback_rect, @@ -237,12 +228,11 @@ void DisplayListRasterSource::PrepareForPlaybackToCanvas( } } -void DisplayListRasterSource::RasterCommon( - SkCanvas* canvas, - SkPicture::AbortCallback* callback, - const gfx::Rect& canvas_bitmap_rect, - const gfx::Rect& canvas_playback_rect, - float contents_scale) const { +void RasterSource::RasterCommon(SkCanvas* canvas, + SkPicture::AbortCallback* callback, + const gfx::Rect& canvas_bitmap_rect, + const gfx::Rect& canvas_playback_rect, + float contents_scale) const { canvas->translate(-canvas_bitmap_rect.x(), -canvas_bitmap_rect.y()); gfx::Rect content_rect = gfx::ScaleToEnclosingRect(gfx::Rect(size_), contents_scale); @@ -260,8 +250,8 @@ void DisplayListRasterSource::RasterCommon( } } -sk_sp DisplayListRasterSource::GetFlattenedPicture() { - TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture"); +sk_sp RasterSource::GetFlattenedPicture() { + TRACE_EVENT0("cc", "RasterSource::GetFlattenedPicture"); gfx::Rect display_list_rect(size_); SkPictureRecorder recorder; @@ -276,18 +266,17 @@ sk_sp DisplayListRasterSource::GetFlattenedPicture() { return recorder.finishRecordingAsPicture(); } -size_t DisplayListRasterSource::GetPictureMemoryUsage() const { +size_t RasterSource::GetPictureMemoryUsage() const { if (!display_list_) return 0; return display_list_->ApproximateMemoryUsage() + painter_reported_memory_usage_; } -bool DisplayListRasterSource::PerformSolidColorAnalysis( - const gfx::Rect& content_rect, - float contents_scale, - SkColor* color) const { - TRACE_EVENT0("cc", "DisplayListRasterSource::PerformSolidColorAnalysis"); +bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect, + float contents_scale, + SkColor* color) const { + TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis"); gfx::Rect layer_rect = gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); @@ -298,7 +287,7 @@ bool DisplayListRasterSource::PerformSolidColorAnalysis( return canvas.GetColorIfSolid(color); } -void DisplayListRasterSource::GetDiscardableImagesInRect( +void RasterSource::GetDiscardableImagesInRect( const gfx::Rect& layer_rect, float raster_scale, std::vector* images) const { @@ -306,7 +295,7 @@ void DisplayListRasterSource::GetDiscardableImagesInRect( display_list_->GetDiscardableImagesInRect(layer_rect, raster_scale, images); } -bool DisplayListRasterSource::CoversRect(const gfx::Rect& layer_rect) const { +bool RasterSource::CoversRect(const gfx::Rect& layer_rect) const { if (size_.IsEmpty()) return false; gfx::Rect bounded_rect = layer_rect; @@ -314,72 +303,68 @@ bool DisplayListRasterSource::CoversRect(const gfx::Rect& layer_rect) const { return recorded_viewport_.Contains(bounded_rect); } -gfx::Size DisplayListRasterSource::GetSize() const { +gfx::Size RasterSource::GetSize() const { return size_; } -bool DisplayListRasterSource::IsSolidColor() const { +bool RasterSource::IsSolidColor() const { return is_solid_color_; } -SkColor DisplayListRasterSource::GetSolidColor() const { +SkColor RasterSource::GetSolidColor() const { DCHECK(IsSolidColor()); return solid_color_; } -bool DisplayListRasterSource::HasRecordings() const { +bool RasterSource::HasRecordings() const { return !!display_list_.get(); } -gfx::Rect DisplayListRasterSource::RecordedViewport() const { +gfx::Rect RasterSource::RecordedViewport() const { return recorded_viewport_; } -void DisplayListRasterSource::SetShouldAttemptToUseDistanceFieldText() { +void RasterSource::SetShouldAttemptToUseDistanceFieldText() { should_attempt_to_use_distance_field_text_ = true; } -bool DisplayListRasterSource::ShouldAttemptToUseDistanceFieldText() const { +bool RasterSource::ShouldAttemptToUseDistanceFieldText() const { return should_attempt_to_use_distance_field_text_; } -void DisplayListRasterSource::AsValueInto( - base::trace_event::TracedValue* array) const { +void RasterSource::AsValueInto(base::trace_event::TracedValue* array) const { if (display_list_.get()) TracedValue::AppendIDRef(display_list_.get(), array); } -void DisplayListRasterSource::DidBeginTracing() { +void RasterSource::DidBeginTracing() { if (display_list_.get()) display_list_->EmitTraceSnapshot(); } -bool DisplayListRasterSource::CanUseLCDText() const { +bool RasterSource::CanUseLCDText() const { return can_use_lcd_text_; } -scoped_refptr -DisplayListRasterSource::CreateCloneWithoutLCDText() const { +scoped_refptr RasterSource::CreateCloneWithoutLCDText() const { bool can_use_lcd_text = false; - return scoped_refptr( - new DisplayListRasterSource(this, can_use_lcd_text)); + return scoped_refptr(new RasterSource(this, can_use_lcd_text)); } -void DisplayListRasterSource::SetImageDecodeController( +void RasterSource::SetImageDecodeController( ImageDecodeController* image_decode_controller) { DCHECK(image_decode_controller); image_decode_controller_ = image_decode_controller; } -bool DisplayListRasterSource::OnMemoryDump( - const base::trace_event::MemoryDumpArgs& args, - base::trace_event::ProcessMemoryDump* pmd) { +bool RasterSource::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, + base::trace_event::ProcessMemoryDump* pmd) { DCHECK(memory_dump_thread_checker_.CalledOnValidThread()); uint64_t memory_usage = GetPictureMemoryUsage(); if (memory_usage > 0) { - std::string dump_name = base::StringPrintf( - "cc/display_lists/display_list_raster_source_%p", this); + std::string dump_name = + base::StringPrintf("cc/display_lists/raster_source_%p", this); base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, diff --git a/cc/playback/display_list_raster_source.h b/cc/playback/raster_source.h similarity index 86% rename from cc/playback/display_list_raster_source.h rename to cc/playback/raster_source.h index f9df1964f66c62..062316ca2a31dd 100644 --- a/cc/playback/display_list_raster_source.h +++ b/cc/playback/raster_source.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ -#define CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ +#ifndef CC_PLAYBACK_RASTER_SOURCE_H_ +#define CC_PLAYBACK_RASTER_SOURCE_H_ #include @@ -25,13 +25,12 @@ class DisplayItemList; class DrawImage; class ImageDecodeController; -class CC_EXPORT DisplayListRasterSource - : public base::trace_event::MemoryDumpProvider, - public base::RefCountedThreadSafe { +class CC_EXPORT RasterSource : public base::trace_event::MemoryDumpProvider, + public base::RefCountedThreadSafe { public: - static scoped_refptr - CreateFromDisplayListRecordingSource(const DisplayListRecordingSource* other, - bool can_use_lcd_text); + static scoped_refptr CreateFromDisplayListRecordingSource( + const DisplayListRecordingSource* other, + bool can_use_lcd_text); // Raster a subrect of this RasterSource into the given canvas. It is // assumed that contents_scale has already been applied to this canvas. @@ -108,7 +107,7 @@ class CC_EXPORT DisplayListRasterSource // Return true if LCD anti-aliasing may be used when rastering text. virtual bool CanUseLCDText() const; - scoped_refptr CreateCloneWithoutLCDText() const; + scoped_refptr CreateCloneWithoutLCDText() const; // Image decode controller should be set once. Its lifetime has to exceed that // of the raster source, since the raster source will access it during raster. @@ -119,13 +118,11 @@ class CC_EXPORT DisplayListRasterSource base::trace_event::ProcessMemoryDump* pmd) override; protected: - friend class base::RefCountedThreadSafe; + friend class base::RefCountedThreadSafe; - DisplayListRasterSource(const DisplayListRecordingSource* other, - bool can_use_lcd_text); - DisplayListRasterSource(const DisplayListRasterSource* other, - bool can_use_lcd_text); - ~DisplayListRasterSource() override; + RasterSource(const DisplayListRecordingSource* other, bool can_use_lcd_text); + RasterSource(const RasterSource* other, bool can_use_lcd_text); + ~RasterSource() override; // These members are const as this raster source may be in use on another // thread and so should not be touched after construction. @@ -169,9 +166,9 @@ class CC_EXPORT DisplayListRasterSource // Used to ensure that memory dump logic always happens on the same thread. base::ThreadChecker memory_dump_thread_checker_; - DISALLOW_COPY_AND_ASSIGN(DisplayListRasterSource); + DISALLOW_COPY_AND_ASSIGN(RasterSource); }; } // namespace cc -#endif // CC_PLAYBACK_DISPLAY_LIST_RASTER_SOURCE_H_ +#endif // CC_PLAYBACK_RASTER_SOURCE_H_ diff --git a/cc/playback/display_list_raster_source_unittest.cc b/cc/playback/raster_source_unittest.cc similarity index 88% rename from cc/playback/display_list_raster_source_unittest.cc rename to cc/playback/raster_source_unittest.cc index ffaf892cc3bfb2..7b972d37af6b20 100644 --- a/cc/playback/display_list_raster_source_unittest.cc +++ b/cc/playback/raster_source_unittest.cc @@ -5,7 +5,7 @@ #include #include "base/memory/scoped_ptr.h" -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/test/fake_display_list_recording_source.h" #include "cc/test/skia_common.h" #include "skia/ext/refptr.h" @@ -18,7 +18,7 @@ namespace cc { namespace { -TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) { +TEST(RasterSourceTest, AnalyzeIsSolidUnscaled) { gfx::Size layer_bounds(400, 400); scoped_ptr recording_source = @@ -38,9 +38,9 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) { solid_paint); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); // Ensure everything is solid. for (int y = 0; y <= 300; y += 100) { @@ -56,7 +56,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) { recording_source->add_draw_rect_with_paint(gfx::Rect(50, 50, 1, 1), non_solid_paint); recording_source->Rerecord(); - raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource( + raster = RasterSource::CreateFromDisplayListRecordingSource( recording_source.get(), false); color = SK_ColorTRANSPARENT; @@ -90,7 +90,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidUnscaled) { EXPECT_EQ(solid_color, color); } -TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) { +TEST(RasterSourceTest, AnalyzeIsSolidScaled) { gfx::Size layer_bounds(400, 400); scoped_ptr recording_source = @@ -110,9 +110,9 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) { solid_paint); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); // Ensure everything is solid. for (int y = 0; y <= 30; y += 10) { @@ -128,7 +128,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) { recording_source->add_draw_rect_with_paint(gfx::Rect(50, 50, 1, 1), non_solid_paint); recording_source->Rerecord(); - raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource( + raster = RasterSource::CreateFromDisplayListRecordingSource( recording_source.get(), false); color = SK_ColorTRANSPARENT; @@ -162,16 +162,16 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidScaled) { EXPECT_EQ(color, solid_color); } -TEST(DisplayListRasterSourceTest, AnalyzeIsSolidEmpty) { +TEST(RasterSourceTest, AnalyzeIsSolidEmpty) { gfx::Size layer_bounds(400, 400); scoped_ptr recording_source = FakeDisplayListRecordingSource::CreateFilledRecordingSource(layer_bounds); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); SkColor color = SK_ColorTRANSPARENT; bool is_solid_color = @@ -181,7 +181,7 @@ TEST(DisplayListRasterSourceTest, AnalyzeIsSolidEmpty) { EXPECT_EQ(color, SkColorSetARGB(0, 0, 0, 0)); } -TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) { +TEST(RasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) { gfx::Size layer_bounds(512, 512); scoped_ptr recording_source = @@ -207,9 +207,9 @@ TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) { recording_source->SetGenerateDiscardableImagesMetadata(true); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); // Tile sized iterators. These should find only one pixel ref. { @@ -244,7 +244,7 @@ TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) { } } -TEST(DisplayListRasterSourceTest, RasterFullContents) { +TEST(RasterSourceTest, RasterFullContents) { gfx::Size layer_bounds(3, 5); float contents_scale = 1.5f; float raster_divisions = 2.f; @@ -262,9 +262,9 @@ TEST(DisplayListRasterSourceTest, RasterFullContents) { white_paint); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); gfx::Size content_bounds( gfx::ScaleToCeiledSize(layer_bounds, contents_scale)); @@ -312,7 +312,7 @@ TEST(DisplayListRasterSourceTest, RasterFullContents) { } } -TEST(DisplayListRasterSourceTest, RasterPartialContents) { +TEST(RasterSourceTest, RasterPartialContents) { gfx::Size layer_bounds(3, 5); float contents_scale = 1.5f; @@ -328,9 +328,9 @@ TEST(DisplayListRasterSourceTest, RasterPartialContents) { white_paint); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); gfx::Size content_bounds( gfx::ScaleToCeiledSize(layer_bounds, contents_scale)); @@ -368,8 +368,8 @@ TEST(DisplayListRasterSourceTest, RasterPartialContents) { black_paint); recording_source->Rerecord(); - // Make a new DisplayListRasterSource from the new recording. - raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource( + // Make a new RasterSource from the new recording. + raster = RasterSource::CreateFromDisplayListRecordingSource( recording_source.get(), false); // We're going to playback from "everything is black" into a smaller area, @@ -405,7 +405,7 @@ TEST(DisplayListRasterSourceTest, RasterPartialContents) { EXPECT_GT(num_white, 0); } -TEST(DisplayListRasterSourceTest, RasterPartialClear) { +TEST(RasterSourceTest, RasterPartialClear) { gfx::Size layer_bounds(3, 5); gfx::Size partial_bounds(2, 4); float contents_scale = 1.5f; @@ -425,9 +425,9 @@ TEST(DisplayListRasterSourceTest, RasterPartialClear) { white_paint); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); gfx::Size content_bounds( gfx::ScaleToCeiledSize(layer_bounds, contents_scale)); @@ -471,8 +471,8 @@ TEST(DisplayListRasterSourceTest, RasterPartialClear) { white_paint); recording_source_light->Rerecord(); - // Make a new DisplayListRasterSource from the new recording. - raster = DisplayListRasterSource::CreateFromDisplayListRecordingSource( + // Make a new RasterSource from the new recording. + raster = RasterSource::CreateFromDisplayListRecordingSource( recording_source_light.get(), false); // We're going to playback from alpha(18) white rectangle into a smaller area @@ -497,7 +497,7 @@ TEST(DisplayListRasterSourceTest, RasterPartialClear) { } } -TEST(DisplayListRasterSourceTest, RasterContentsTransparent) { +TEST(RasterSourceTest, RasterContentsTransparent) { gfx::Size layer_bounds(5, 3); float contents_scale = 0.5f; @@ -508,9 +508,9 @@ TEST(DisplayListRasterSourceTest, RasterContentsTransparent) { recording_source->SetClearCanvasWithDebugColor(false); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); gfx::Size content_bounds( gfx::ScaleToCeiledSize(layer_bounds, contents_scale)); @@ -532,8 +532,7 @@ TEST(DisplayListRasterSourceTest, RasterContentsTransparent) { } } -TEST(DisplayListRasterSourceTest, - GetPictureMemoryUsageIncludesClientReportedMemory) { +TEST(RasterSourceTest, GetPictureMemoryUsageIncludesClientReportedMemory) { const size_t kReportedMemoryUsageInBytes = 100 * 1024 * 1024; gfx::Size layer_bounds(5, 3); scoped_ptr recording_source = @@ -541,9 +540,9 @@ TEST(DisplayListRasterSourceTest, recording_source->set_reported_memory_usage(kReportedMemoryUsageInBytes); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); size_t total_memory_usage = raster->GetPictureMemoryUsage(); EXPECT_GE(total_memory_usage, kReportedMemoryUsageInBytes); EXPECT_LT(total_memory_usage, 2 * kReportedMemoryUsageInBytes); diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc index 8bde8c034fd533..1059470cbd07e5 100644 --- a/cc/quads/draw_quad_unittest.cc +++ b/cc/quads/draw_quad_unittest.cc @@ -24,7 +24,7 @@ #include "cc/quads/texture_draw_quad.h" #include "cc/quads/tile_draw_quad.h" #include "cc/quads/yuv_video_draw_quad.h" -#include "cc/test/fake_display_list_raster_source.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/geometry_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/effects/SkBlurImageFilter.h" @@ -701,8 +701,8 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) { ResourceFormat texture_format = RGBA_8888; gfx::Rect content_rect(30, 40, 20, 30); float contents_scale = 3.141592f; - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateEmpty(gfx::Size(100, 100)); + scoped_refptr raster_source = + FakeRasterSource::CreateEmpty(gfx::Size(100, 100)); CREATE_SHARED_STATE(); CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, @@ -940,8 +940,8 @@ 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 raster_source = - FakeDisplayListRasterSource::CreateEmpty(gfx::Size(100, 100)); + scoped_refptr raster_source = + FakeRasterSource::CreateEmpty(gfx::Size(100, 100)); CREATE_SHARED_STATE(); CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect, diff --git a/cc/quads/picture_draw_quad.cc b/cc/quads/picture_draw_quad.cc index bc528d0d277ca1..14c0123040fe32 100644 --- a/cc/quads/picture_draw_quad.cc +++ b/cc/quads/picture_draw_quad.cc @@ -19,18 +19,17 @@ PictureDrawQuad::PictureDrawQuad(const PictureDrawQuad& other) = default; 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 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 raster_source) { ContentDrawQuadBase::SetNew( shared_quad_state, DrawQuad::PICTURE_CONTENT, @@ -47,19 +46,18 @@ void PictureDrawQuad::SetNew( 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 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 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 66ee776b206bb1..27abd611eb1a02 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/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/quads/content_draw_quad_base.h" #include "cc/resources/resource_provider.h" #include "ui/gfx/geometry/rect.h" @@ -34,7 +34,7 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase { ResourceFormat texture_format, const gfx::Rect& content_rect, float contents_scale, - scoped_refptr raster_source); + scoped_refptr raster_source); void SetAll(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -47,11 +47,11 @@ class CC_EXPORT PictureDrawQuad : public ContentDrawQuadBase { ResourceFormat texture_format, const gfx::Rect& content_rect, float contents_scale, - scoped_refptr raster_source); + scoped_refptr raster_source); gfx::Rect content_rect; float contents_scale; - scoped_refptr raster_source; + scoped_refptr 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 de651476ea5276..e8d2bfa0db6cbb 100644 --- a/cc/raster/bitmap_tile_task_worker_pool.cc +++ b/cc/raster/bitmap_tile_task_worker_pool.cc @@ -14,7 +14,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/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/raster/raster_buffer.h" #include "cc/resources/platform_color.h" #include "cc/resources/resource.h" @@ -35,7 +35,7 @@ class RasterBufferImpl : public RasterBuffer { } // Overridden from RasterBuffer: - void Playback(const DisplayListRasterSource* raster_source, + void Playback(const RasterSource* 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 18c83f76154345..498030d571f40d 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/display_list_raster_source.h" +#include "cc/playback/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 DisplayListRasterSource* raster_source, + const RasterSource* 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 e14ea26fa5cdeb..51cf89fdb5d420 100644 --- a/cc/raster/gpu_rasterizer.h +++ b/cc/raster/gpu_rasterizer.h @@ -16,7 +16,7 @@ namespace cc { class ContextProvider; -class DisplayListRasterSource; +class RasterSource; class ResourceProvider; class CC_EXPORT GpuRasterizer { @@ -24,7 +24,7 @@ class CC_EXPORT GpuRasterizer { ~GpuRasterizer(); void RasterizeSource(ResourceProvider::ScopedWriteLockGr* write_lock, - const DisplayListRasterSource* raster_source, + const RasterSource* 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 e54672e6f1aebb..75c9646a85858c 100644 --- a/cc/raster/gpu_tile_task_worker_pool.cc +++ b/cc/raster/gpu_tile_task_worker_pool.cc @@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/trace_event/trace_event.h" -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/raster/gpu_rasterizer.h" #include "cc/raster/raster_buffer.h" #include "cc/raster/scoped_gpu_raster.h" @@ -37,7 +37,7 @@ class RasterBufferImpl : public RasterBuffer { } // Overridden from RasterBuffer: - void Playback(const DisplayListRasterSource* raster_source, + void Playback(const RasterSource* 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 0158752440a8d7..fc69466ada5da4 100644 --- a/cc/raster/one_copy_tile_task_worker_pool.cc +++ b/cc/raster/one_copy_tile_task_worker_pool.cc @@ -47,7 +47,7 @@ class RasterBufferImpl : public RasterBuffer { ~RasterBufferImpl() override {} // Overridden from RasterBuffer: - void Playback(const DisplayListRasterSource* raster_source, + void Playback(const RasterSource* raster_source, const gfx::Rect& raster_full_rect, const gfx::Rect& raster_dirty_rect, uint64_t new_content_id, @@ -318,7 +318,7 @@ void OneCopyTileTaskWorkerPool::ReleaseBufferForRaster( void OneCopyTileTaskWorkerPool::PlaybackAndCopyOnWorkerThread( const Resource* resource, ResourceProvider::ScopedWriteLockGL* resource_lock, - const DisplayListRasterSource* raster_source, + const RasterSource* 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 fce75fe2af8138..1b0007b088b6d3 100644 --- a/cc/raster/one_copy_tile_task_worker_pool.h +++ b/cc/raster/one_copy_tile_task_worker_pool.h @@ -80,7 +80,7 @@ class CC_EXPORT OneCopyTileTaskWorkerPool void PlaybackAndCopyOnWorkerThread( const Resource* resource, ResourceProvider::ScopedWriteLockGL* resource_lock, - const DisplayListRasterSource* raster_source, + const RasterSource* 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 8bd305d75fe1eb..29b6e3ae0b8255 100644 --- a/cc/raster/raster_buffer.h +++ b/cc/raster/raster_buffer.h @@ -11,14 +11,14 @@ #include "ui/gfx/geometry/rect.h" namespace cc { -class DisplayListRasterSource; +class RasterSource; class CC_EXPORT RasterBuffer { public: RasterBuffer(); virtual ~RasterBuffer(); - virtual void Playback(const DisplayListRasterSource* raster_source, + virtual void Playback(const RasterSource* 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 263720d79f53eb..2b69278bebc3d4 100644 --- a/cc/raster/tile_task_worker_pool.cc +++ b/cc/raster/tile_task_worker_pool.cc @@ -7,7 +7,7 @@ #include #include "base/trace_event/trace_event.h" -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/raster/texture_compressor.h" #include "skia/ext/refptr.h" #include "third_party/skia/include/core/SkCanvas.h" @@ -60,16 +60,15 @@ bool IsSupportedPlaybackToMemoryFormat(ResourceFormat format) { } // anonymous namespace // static -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) { +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) { 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 5f229619b5ddfd..db78391738bfa0 100644 --- a/cc/raster/tile_task_worker_pool.h +++ b/cc/raster/tile_task_worker_pool.h @@ -16,7 +16,7 @@ class SequencedTaskRunner; } namespace cc { -class DisplayListRasterSource; +class RasterSource; class RenderingStatsInstrumentation; class CC_EXPORT TileTaskWorkerPool { @@ -39,7 +39,7 @@ class CC_EXPORT TileTaskWorkerPool { ResourceFormat format, const gfx::Size& size, size_t stride, - const DisplayListRasterSource* raster_source, + const RasterSource* 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 2473629e5f1ce2..4f0bae45c41674 100644 --- a/cc/raster/tile_task_worker_pool_unittest.cc +++ b/cc/raster/tile_task_worker_pool_unittest.cc @@ -28,9 +28,9 @@ #include "cc/resources/resource_pool.h" #include "cc/resources/resource_provider.h" #include "cc/resources/scoped_resource.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/fake_resource_provider.h" #include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" @@ -61,8 +61,7 @@ class TestRasterTaskImpl : public RasterTask { : RasterTask(dependencies), resource_(resource), reply_(reply), - raster_source_( - FakeDisplayListRasterSource::CreateFilled(gfx::Size(1, 1))) {} + raster_source_(FakeRasterSource::CreateFilled(gfx::Size(1, 1))) {} // Overridden from Task: void RunOnWorkerThread() override { @@ -89,7 +88,7 @@ class TestRasterTaskImpl : public RasterTask { const Resource* resource_; const Reply reply_; scoped_ptr raster_buffer_; - scoped_refptr raster_source_; + scoped_refptr raster_source_; DISALLOW_COPY_AND_ASSIGN(TestRasterTaskImpl); }; diff --git a/cc/raster/zero_copy_tile_task_worker_pool.cc b/cc/raster/zero_copy_tile_task_worker_pool.cc index 410540a7848b33..718063349ec75d 100644 --- a/cc/raster/zero_copy_tile_task_worker_pool.cc +++ b/cc/raster/zero_copy_tile_task_worker_pool.cc @@ -29,7 +29,7 @@ class RasterBufferImpl : public RasterBuffer { : lock_(resource_provider, resource->id()), resource_(resource) {} // Overridden from RasterBuffer: - void Playback(const DisplayListRasterSource* raster_source, + void Playback(const RasterSource* 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_raster_source.h b/cc/test/fake_display_list_raster_source.h deleted file mode 100644 index 1d63fe63f82eb3..00000000000000 --- a/cc/test/fake_display_list_raster_source.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015 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_TEST_FAKE_DISPLAY_LIST_RASTER_SOURCE_H_ -#define CC_TEST_FAKE_DISPLAY_LIST_RASTER_SOURCE_H_ - -#include "base/memory/ref_counted.h" -#include "cc/playback/display_list_raster_source.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "ui/gfx/geometry/rect.h" -#include "ui/gfx/geometry/size.h" - -namespace cc { - -class DisplayListRecordingSource; - -class FakeDisplayListRasterSource : public DisplayListRasterSource { - public: - static scoped_refptr CreateInfiniteFilled(); - static scoped_refptr CreateFilled( - const gfx::Size& size); - static scoped_refptr CreateFilledLCD( - const gfx::Size& size); - static scoped_refptr CreateFilledSolidColor( - const gfx::Size& size); - static scoped_refptr CreatePartiallyFilled( - const gfx::Size& size, - const gfx::Rect& recorded_viewport); - static scoped_refptr CreateEmpty( - const gfx::Size& size); - static scoped_refptr CreateFromRecordingSource( - const DisplayListRecordingSource* recording_source, - bool can_use_lcd); - static scoped_refptr - CreateFromRecordingSourceWithWaitable( - const DisplayListRecordingSource* recording_source, - bool can_use_lcd, - base::WaitableEvent* playback_allowed_event); - - void PlaybackToCanvas(SkCanvas* canvas, - const gfx::Rect& canvas_bitmap_rect, - const gfx::Rect& canvas_playback_rect, - float contents_scale, - bool include_images) const override; - - protected: - FakeDisplayListRasterSource( - const DisplayListRecordingSource* recording_source, - bool can_use_lcd); - FakeDisplayListRasterSource( - const DisplayListRecordingSource* recording_source, - bool can_use_lcd, - base::WaitableEvent* playback_allowed_event); - ~FakeDisplayListRasterSource() override; - - private: - base::WaitableEvent* playback_allowed_event_; -}; - -} // namespace cc - -#endif // CC_TEST_FAKE_DISPLAY_LIST_RASTER_SOURCE_H_ diff --git a/cc/test/fake_display_list_recording_source.cc b/cc/test/fake_display_list_recording_source.cc index 01e6048527c256..4771b11986e02d 100644 --- a/cc/test/fake_display_list_recording_source.cc +++ b/cc/test/fake_display_list_recording_source.cc @@ -4,7 +4,7 @@ #include "cc/test/fake_display_list_recording_source.h" -#include "cc/test/fake_display_list_raster_source.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/skia_common.h" namespace cc { @@ -19,9 +19,9 @@ bool FakeDisplayListRecordingSource::IsSuitableForGpuRasterization() const { return DisplayListRecordingSource::IsSuitableForGpuRasterization(); } -scoped_refptr -FakeDisplayListRecordingSource::CreateRasterSource(bool can_use_lcd) const { - return FakeDisplayListRasterSource::CreateFromRecordingSourceWithWaitable( +scoped_refptr FakeDisplayListRecordingSource::CreateRasterSource( + bool can_use_lcd) const { + return FakeRasterSource::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 28ea1ab7ab3950..23f2e442547f38 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 CreateRasterSource( + scoped_refptr 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 cffed1c0a8fbd9..95e81a7ed5f3db 100644 --- a/cc/test/fake_picture_layer_impl.cc +++ b/cc/test/fake_picture_layer_impl.cc @@ -15,7 +15,7 @@ namespace cc { FakePictureLayerImpl::FakePictureLayerImpl( LayerTreeImpl* tree_impl, int id, - scoped_refptr raster_source, + scoped_refptr raster_source, bool is_mask) : PictureLayerImpl(tree_impl, id, is_mask), append_quads_count_(0), @@ -30,7 +30,7 @@ FakePictureLayerImpl::FakePictureLayerImpl( FakePictureLayerImpl::FakePictureLayerImpl( LayerTreeImpl* tree_impl, int id, - scoped_refptr raster_source, + scoped_refptr raster_source, bool is_mask, const gfx::Size& layer_bounds) : PictureLayerImpl(tree_impl, id, is_mask), @@ -108,7 +108,7 @@ PictureLayerTiling* FakePictureLayerImpl::LowResTiling() const { } void FakePictureLayerImpl::SetRasterSourceOnPending( - scoped_refptr raster_source, + scoped_refptr 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 2ba976176e29a3..b631635555b39f 100644 --- a/cc/test/fake_picture_layer_impl.h +++ b/cc/test/fake_picture_layer_impl.h @@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" #include "cc/layers/picture_layer_impl.h" -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" namespace cc { @@ -31,7 +31,7 @@ class FakePictureLayerImpl : public PictureLayerImpl { static scoped_ptr CreateWithRasterSource( LayerTreeImpl* tree_impl, int id, - scoped_refptr raster_source) { + scoped_refptr raster_source) { bool is_mask = false; return make_scoped_ptr( new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); @@ -41,7 +41,7 @@ class FakePictureLayerImpl : public PictureLayerImpl { static scoped_ptr CreateWithPartialRasterSource( LayerTreeImpl* tree_impl, int id, - scoped_refptr raster_source, + scoped_refptr raster_source, const gfx::Size& layer_bounds) { bool is_mask = false; return make_scoped_ptr(new FakePictureLayerImpl( @@ -53,7 +53,7 @@ class FakePictureLayerImpl : public PictureLayerImpl { static scoped_ptr CreateMaskWithRasterSource( LayerTreeImpl* tree_impl, int id, - scoped_refptr raster_source) { + scoped_refptr raster_source) { bool is_mask = true; return make_scoped_ptr( new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); @@ -106,10 +106,9 @@ class FakePictureLayerImpl : public PictureLayerImpl { size_t num_tilings() const { return tilings_->num_tilings(); } PictureLayerTilingSet* tilings() { return tilings_.get(); } - DisplayListRasterSource* raster_source() { return raster_source_.get(); } - void SetRasterSourceOnPending( - scoped_refptr raster_source, - const Region& invalidation); + RasterSource* raster_source() { return raster_source_.get(); } + void SetRasterSourceOnPending(scoped_refptr raster_source, + const Region& invalidation); size_t append_quads_count() { return append_quads_count_; } const Region& invalidation() const { return invalidation_; } @@ -149,11 +148,11 @@ class FakePictureLayerImpl : public PictureLayerImpl { protected: FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, - scoped_refptr raster_source, + scoped_refptr raster_source, bool is_mask); FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, - scoped_refptr raster_source, + scoped_refptr 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.cc b/cc/test/fake_picture_layer_tiling_client.cc index aa76d6a5eaed46..06d780e21cb52a 100644 --- a/cc/test/fake_picture_layer_tiling_client.cc +++ b/cc/test/fake_picture_layer_tiling_client.cc @@ -9,14 +9,14 @@ #include #include "base/thread_task_runner_handle.h" -#include "cc/test/fake_display_list_raster_source.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/fake_tile_manager.h" namespace cc { FakePictureLayerTilingClient::FakePictureLayerTilingClient() : tile_manager_(new FakeTileManager(&tile_manager_client_)), - raster_source_(FakeDisplayListRasterSource::CreateInfiniteFilled()), + raster_source_(FakeRasterSource::CreateInfiniteFilled()), twin_set_(nullptr), twin_tiling_(nullptr), has_valid_tile_priorities_(true) {} @@ -28,7 +28,7 @@ FakePictureLayerTilingClient::FakePictureLayerTilingClient( base::ThreadTaskRunnerHandle::Get().get())), tile_manager_( new FakeTileManager(&tile_manager_client_, resource_pool_.get())), - raster_source_(FakeDisplayListRasterSource::CreateInfiniteFilled()), + raster_source_(FakeRasterSource::CreateInfiniteFilled()), twin_set_(nullptr), twin_tiling_(nullptr), has_valid_tile_priorities_(true) {} diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h index 735227695b28a0..0c1bc84c354800 100644 --- a/cc/test/fake_picture_layer_tiling_client.h +++ b/cc/test/fake_picture_layer_tiling_client.h @@ -5,7 +5,7 @@ #ifndef CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ #define CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/test/fake_tile_manager_client.h" #include "cc/tiles/picture_layer_tiling.h" #include "cc/tiles/tile.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; } - DisplayListRasterSource* raster_source() { return raster_source_.get(); } + RasterSource* raster_source() { return raster_source_.get(); } TileManager* tile_manager() const { return tile_manager_.get(); @@ -56,7 +56,7 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient { FakeTileManagerClient tile_manager_client_; scoped_ptr resource_pool_; scoped_ptr tile_manager_; - scoped_refptr raster_source_; + scoped_refptr raster_source_; gfx::Size tile_size_; PictureLayerTilingSet* twin_set_; PictureLayerTiling* twin_tiling_; diff --git a/cc/test/fake_display_list_raster_source.cc b/cc/test/fake_raster_source.cc similarity index 61% rename from cc/test/fake_display_list_raster_source.cc rename to cc/test/fake_raster_source.cc index 8acca504aa6ca2..53625c69735e40 100644 --- a/cc/test/fake_display_list_raster_source.cc +++ b/cc/test/fake_raster_source.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/test/fake_display_list_raster_source.h" +#include "cc/test/fake_raster_source.h" #include @@ -13,15 +13,14 @@ namespace cc { -scoped_refptr -FakeDisplayListRasterSource::CreateInfiniteFilled() { +scoped_refptr FakeRasterSource::CreateInfiniteFilled() { gfx::Size size(std::numeric_limits::max() / 10, std::numeric_limits::max() / 10); return CreateFilled(size); } -scoped_refptr -FakeDisplayListRasterSource::CreateFilled(const gfx::Size& size) { +scoped_refptr FakeRasterSource::CreateFilled( + const gfx::Size& size) { auto recording_source = FakeDisplayListRecordingSource::CreateFilledRecordingSource(size); @@ -38,11 +37,11 @@ FakeDisplayListRasterSource::CreateFilled(const gfx::Size& size) { recording_source->Rerecord(); return make_scoped_refptr( - new FakeDisplayListRasterSource(recording_source.get(), false)); + new FakeRasterSource(recording_source.get(), false)); } -scoped_refptr -FakeDisplayListRasterSource::CreateFilledLCD(const gfx::Size& size) { +scoped_refptr FakeRasterSource::CreateFilledLCD( + const gfx::Size& size) { auto recording_source = FakeDisplayListRecordingSource::CreateFilledRecordingSource(size); @@ -58,12 +57,11 @@ FakeDisplayListRasterSource::CreateFilledLCD(const gfx::Size& size) { recording_source->Rerecord(); - return make_scoped_refptr( - new FakeDisplayListRasterSource(recording_source.get(), true)); + return make_scoped_refptr(new FakeRasterSource(recording_source.get(), true)); } -scoped_refptr -FakeDisplayListRasterSource::CreateFilledSolidColor(const gfx::Size& size) { +scoped_refptr FakeRasterSource::CreateFilledSolidColor( + const gfx::Size& size) { auto recording_source = FakeDisplayListRecordingSource::CreateFilledRecordingSource(size); @@ -71,15 +69,14 @@ FakeDisplayListRasterSource::CreateFilledSolidColor(const gfx::Size& size) { red_paint.setColor(SK_ColorRED); recording_source->add_draw_rect_with_paint(gfx::Rect(size), red_paint); recording_source->Rerecord(); - auto raster_source = make_scoped_refptr( - new FakeDisplayListRasterSource(recording_source.get(), false)); + auto raster_source = + make_scoped_refptr(new FakeRasterSource(recording_source.get(), false)); if (!raster_source->IsSolidColor()) ADD_FAILURE() << "Not solid color!"; return raster_source; } -scoped_refptr -FakeDisplayListRasterSource::CreatePartiallyFilled( +scoped_refptr FakeRasterSource::CreatePartiallyFilled( const gfx::Size& size, const gfx::Rect& recorded_viewport) { DCHECK(recorded_viewport.IsEmpty() || @@ -101,60 +98,58 @@ FakeDisplayListRasterSource::CreatePartiallyFilled( recording_source->SetRecordedViewport(recorded_viewport); return make_scoped_refptr( - new FakeDisplayListRasterSource(recording_source.get(), false)); + new FakeRasterSource(recording_source.get(), false)); } -scoped_refptr -FakeDisplayListRasterSource::CreateEmpty(const gfx::Size& size) { +scoped_refptr FakeRasterSource::CreateEmpty( + const gfx::Size& size) { auto recording_source = FakeDisplayListRecordingSource::CreateFilledRecordingSource(size); return make_scoped_refptr( - new FakeDisplayListRasterSource(recording_source.get(), false)); + new FakeRasterSource(recording_source.get(), false)); } -scoped_refptr -FakeDisplayListRasterSource::CreateFromRecordingSource( +scoped_refptr FakeRasterSource::CreateFromRecordingSource( const DisplayListRecordingSource* recording_source, bool can_use_lcd) { return make_scoped_refptr( - new FakeDisplayListRasterSource(recording_source, can_use_lcd)); + new FakeRasterSource(recording_source, can_use_lcd)); } -scoped_refptr -FakeDisplayListRasterSource::CreateFromRecordingSourceWithWaitable( +scoped_refptr +FakeRasterSource::CreateFromRecordingSourceWithWaitable( const DisplayListRecordingSource* recording_source, bool can_use_lcd, base::WaitableEvent* playback_allowed_event) { - return make_scoped_refptr(new FakeDisplayListRasterSource( - recording_source, can_use_lcd, playback_allowed_event)); + return make_scoped_refptr(new FakeRasterSource(recording_source, can_use_lcd, + playback_allowed_event)); } -FakeDisplayListRasterSource::FakeDisplayListRasterSource( +FakeRasterSource::FakeRasterSource( const DisplayListRecordingSource* recording_source, bool can_use_lcd) - : DisplayListRasterSource(recording_source, can_use_lcd), + : RasterSource(recording_source, can_use_lcd), playback_allowed_event_(nullptr) {} -FakeDisplayListRasterSource::FakeDisplayListRasterSource( +FakeRasterSource::FakeRasterSource( const DisplayListRecordingSource* recording_source, bool can_use_lcd, base::WaitableEvent* playback_allowed_event) - : DisplayListRasterSource(recording_source, can_use_lcd), + : RasterSource(recording_source, can_use_lcd), playback_allowed_event_(playback_allowed_event) {} -FakeDisplayListRasterSource::~FakeDisplayListRasterSource() {} +FakeRasterSource::~FakeRasterSource() {} -void FakeDisplayListRasterSource::PlaybackToCanvas( - SkCanvas* canvas, - const gfx::Rect& canvas_bitmap_rect, - const gfx::Rect& canvas_playback_rect, - float contents_scale, - bool include_images) const { +void FakeRasterSource::PlaybackToCanvas(SkCanvas* canvas, + const gfx::Rect& canvas_bitmap_rect, + const gfx::Rect& canvas_playback_rect, + float contents_scale, + bool include_images) const { if (playback_allowed_event_) playback_allowed_event_->Wait(); - DisplayListRasterSource::PlaybackToCanvas(canvas, canvas_bitmap_rect, - canvas_playback_rect, - contents_scale, include_images); + RasterSource::PlaybackToCanvas(canvas, canvas_bitmap_rect, + canvas_playback_rect, contents_scale, + include_images); } } // namespace cc diff --git a/cc/test/fake_raster_source.h b/cc/test/fake_raster_source.h new file mode 100644 index 00000000000000..8d1fcbeba8c9b2 --- /dev/null +++ b/cc/test/fake_raster_source.h @@ -0,0 +1,57 @@ +// Copyright 2015 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_TEST_FAKE_RASTER_SOURCE_H_ +#define CC_TEST_FAKE_RASTER_SOURCE_H_ + +#include "base/memory/ref_counted.h" +#include "cc/playback/raster_source.h" +#include "third_party/skia/include/core/SkCanvas.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/size.h" + +namespace cc { + +class DisplayListRecordingSource; + +class FakeRasterSource : public RasterSource { + public: + static scoped_refptr CreateInfiniteFilled(); + static scoped_refptr CreateFilled(const gfx::Size& size); + static scoped_refptr CreateFilledLCD(const gfx::Size& size); + static scoped_refptr CreateFilledSolidColor( + const gfx::Size& size); + static scoped_refptr CreatePartiallyFilled( + const gfx::Size& size, + const gfx::Rect& recorded_viewport); + static scoped_refptr CreateEmpty(const gfx::Size& size); + static scoped_refptr CreateFromRecordingSource( + const DisplayListRecordingSource* recording_source, + bool can_use_lcd); + static scoped_refptr CreateFromRecordingSourceWithWaitable( + const DisplayListRecordingSource* recording_source, + bool can_use_lcd, + base::WaitableEvent* playback_allowed_event); + + void PlaybackToCanvas(SkCanvas* canvas, + const gfx::Rect& canvas_bitmap_rect, + const gfx::Rect& canvas_playback_rect, + float contents_scale, + bool include_images) const override; + + protected: + FakeRasterSource(const DisplayListRecordingSource* recording_source, + bool can_use_lcd); + FakeRasterSource(const DisplayListRecordingSource* recording_source, + bool can_use_lcd, + base::WaitableEvent* playback_allowed_event); + ~FakeRasterSource() override; + + private: + base::WaitableEvent* playback_allowed_event_; +}; + +} // namespace cc + +#endif // CC_TEST_FAKE_RASTER_SOURCE_H_ diff --git a/cc/tiles/picture_layer_tiling.cc b/cc/tiles/picture_layer_tiling.cc index a9d10bbdfecc03..4282204ee6198a 100644 --- a/cc/tiles/picture_layer_tiling.cc +++ b/cc/tiles/picture_layer_tiling.cc @@ -17,7 +17,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/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/tiles/prioritized_tile.h" #include "cc/tiles/tile.h" #include "cc/tiles/tile_priority.h" @@ -38,7 +38,7 @@ const float kMaxSoonBorderDistanceInScreenPixels = 312.f; scoped_ptr PictureLayerTiling::Create( WhichTree tree, float contents_scale, - scoped_refptr raster_source, + scoped_refptr raster_source, PictureLayerTilingClient* client, size_t tiling_interest_area_padding, float skewport_target_time_in_seconds, @@ -52,7 +52,7 @@ scoped_ptr PictureLayerTiling::Create( PictureLayerTiling::PictureLayerTiling( WhichTree tree, float contents_scale, - scoped_refptr raster_source, + scoped_refptr raster_source, PictureLayerTilingClient* client, size_t tiling_interest_area_padding, float skewport_target_time_in_seconds, @@ -208,7 +208,7 @@ void PictureLayerTiling::TakeTilesAndPropertiesFrom( } void PictureLayerTiling::SetRasterSourceAndResize( - scoped_refptr raster_source) { + scoped_refptr raster_source) { DCHECK(!raster_source->IsSolidColor()); gfx::Size old_layer_bounds = raster_source_->GetSize(); raster_source_ = std::move(raster_source); diff --git a/cc/tiles/picture_layer_tiling.h b/cc/tiles/picture_layer_tiling.h index 7d85242875cb46..fb2018295dc580 100644 --- a/cc/tiles/picture_layer_tiling.h +++ b/cc/tiles/picture_layer_tiling.h @@ -31,7 +31,7 @@ class TracedValue; namespace cc { -class DisplayListRasterSource; +class RasterSource; class PictureLayerTiling; class PrioritizedTile; @@ -91,14 +91,13 @@ class CC_EXPORT PictureLayerTiling { static scoped_ptr Create( WhichTree tree, float contents_scale, - scoped_refptr raster_source, + scoped_refptr 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 raster_source); + void SetRasterSourceAndResize(scoped_refptr raster_source); void Invalidate(const Region& layer_invalidation); void CreateMissingTilesInLiveTilesRect(); void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, @@ -122,7 +121,7 @@ class CC_EXPORT PictureLayerTiling { can_require_tiles_for_activation_ = can_require_tiles; } - const scoped_refptr& raster_source() const { + const scoped_refptr& raster_source() const { return raster_source_; } gfx::Size tiling_size() const { return tiling_data_.tiling_size(); } @@ -276,7 +275,7 @@ class CC_EXPORT PictureLayerTiling { PictureLayerTiling(WhichTree tree, float contents_scale, - scoped_refptr raster_source, + scoped_refptr raster_source, PictureLayerTilingClient* client, size_t tiling_interest_area_padding, float skewport_target_time_in_seconds, @@ -375,7 +374,7 @@ class CC_EXPORT PictureLayerTiling { const float contents_scale_; PictureLayerTilingClient* const client_; const WhichTree tree_; - scoped_refptr raster_source_; + scoped_refptr raster_source_; TileResolution resolution_; bool may_contain_low_resolution_tiles_; diff --git a/cc/tiles/picture_layer_tiling_perftest.cc b/cc/tiles/picture_layer_tiling_perftest.cc index 8a169bc282b233..f612f39ca4ee32 100644 --- a/cc/tiles/picture_layer_tiling_perftest.cc +++ b/cc/tiles/picture_layer_tiling_perftest.cc @@ -5,10 +5,10 @@ #include "cc/debug/lap_timer.h" #include "cc/resources/resource_provider.h" #include "cc/resources/scoped_resource.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_picture_layer_tiling_client.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/fake_resource_provider.h" #include "cc/test/test_context_provider.h" #include "cc/test/test_shared_bitmap_manager.h" @@ -44,9 +44,8 @@ class PictureLayerTilingPerfTest : public testing::Test { void SetUp() override { LayerTreeSettings defaults; picture_layer_tiling_client_.SetTileSize(gfx::Size(256, 256)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled( - gfx::Size(256 * 50, 256 * 50)); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(gfx::Size(256 * 50, 256 * 50)); picture_layer_tiling_ = PictureLayerTiling::Create( PENDING_TREE, 1.f, raster_source, &picture_layer_tiling_client_, defaults.tiling_interest_area_padding, diff --git a/cc/tiles/picture_layer_tiling_set.cc b/cc/tiles/picture_layer_tiling_set.cc index d2b0350a215c2a..2c8e930df3a464 100644 --- a/cc/tiles/picture_layer_tiling_set.cc +++ b/cc/tiles/picture_layer_tiling_set.cc @@ -10,7 +10,7 @@ #include #include -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" namespace cc { @@ -63,7 +63,7 @@ PictureLayerTilingSet::~PictureLayerTilingSet() { void PictureLayerTilingSet::CopyTilingsAndPropertiesFromPendingTwin( const PictureLayerTilingSet* pending_twin_set, - scoped_refptr raster_source, + scoped_refptr 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 @@ -97,7 +97,7 @@ void PictureLayerTilingSet::CopyTilingsAndPropertiesFromPendingTwin( } void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation( - scoped_refptr raster_source, + scoped_refptr raster_source, const PictureLayerTilingSet* pending_twin_set, const Region& layer_invalidation, float minimum_contents_scale, @@ -136,7 +136,7 @@ void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForActivation( } void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForCommit( - scoped_refptr raster_source, + scoped_refptr raster_source, const Region& layer_invalidation, float minimum_contents_scale, float maximum_contents_scale) { @@ -162,7 +162,7 @@ void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSourceForCommit( } void PictureLayerTilingSet::UpdateRasterSourceDueToLCDChange( - scoped_refptr raster_source, + scoped_refptr raster_source, const Region& layer_invalidation) { for (const auto& tiling : tilings_) { tiling->SetRasterSourceAndResize(raster_source); @@ -249,7 +249,7 @@ void PictureLayerTilingSet::MarkAllTilingsNonIdeal() { PictureLayerTiling* PictureLayerTilingSet::AddTiling( float contents_scale, - scoped_refptr raster_source) { + scoped_refptr 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 06aa3a9300b269..41a2dad07e9c83 100644 --- a/cc/tiles/picture_layer_tiling_set.h +++ b/cc/tiles/picture_layer_tiling_set.h @@ -58,7 +58,7 @@ class CC_EXPORT PictureLayerTilingSet { // This function is called on the active tree during activation. void UpdateTilingsToCurrentRasterSourceForActivation( - scoped_refptr raster_source, + scoped_refptr raster_source, const PictureLayerTilingSet* pending_twin_set, const Region& layer_invalidation, float minimum_contents_scale, @@ -66,19 +66,18 @@ class CC_EXPORT PictureLayerTilingSet { // This function is called on the sync tree during commit. void UpdateTilingsToCurrentRasterSourceForCommit( - scoped_refptr raster_source, + scoped_refptr 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( - scoped_refptr raster_source, + scoped_refptr raster_source, const Region& layer_invalidation); - PictureLayerTiling* AddTiling( - float contents_scale, - scoped_refptr raster_source); + PictureLayerTiling* AddTiling(float contents_scale, + scoped_refptr raster_source); size_t num_tilings() const { return tilings_.size(); } int NumHighResTilings() const; PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx].get(); } @@ -183,7 +182,7 @@ class CC_EXPORT PictureLayerTilingSet { void CopyTilingsAndPropertiesFromPendingTwin( const PictureLayerTilingSet* pending_twin_set, - scoped_refptr raster_source, + scoped_refptr raster_source, const Region& layer_invalidation); // Remove one tiling. diff --git a/cc/tiles/picture_layer_tiling_set_unittest.cc b/cc/tiles/picture_layer_tiling_set_unittest.cc index a8afd820547a90..477c8f55281c7a 100644 --- a/cc/tiles/picture_layer_tiling_set_unittest.cc +++ b/cc/tiles/picture_layer_tiling_set_unittest.cc @@ -8,10 +8,10 @@ #include #include "cc/resources/resource_provider.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_picture_layer_tiling_client.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/fake_resource_provider.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/layer_tree_settings.h" @@ -36,8 +36,8 @@ TEST(PictureLayerTilingSetTest, NoResources) { scoped_ptr set = CreateTilingSet(&client); client.SetTileSize(gfx::Size(256, 256)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateEmpty(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateEmpty(layer_bounds); set->AddTiling(1.0, raster_source); set->AddTiling(1.5, raster_source); @@ -74,8 +74,8 @@ TEST(PictureLayerTilingSetTest, TilingRange) { PictureLayerTiling* high_res_tiling; PictureLayerTiling* low_res_tiling; - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); scoped_ptr set = CreateTilingSet(&client); set->AddTiling(2.0, raster_source); @@ -225,8 +225,8 @@ class PictureLayerTilingSetTestWithResources : public testing::Test { client.SetTileSize(gfx::Size(256, 256)); gfx::Size layer_bounds(1000, 800); scoped_ptr set = CreateTilingSet(&client); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); float scale = min_scale; for (int i = 0; i < num_tilings; ++i, scale += scale_increment) { @@ -305,8 +305,8 @@ TEST(PictureLayerTilingSetTest, TileSizeChange) { ACTIVE_TREE, &active_client, 1000, 1.f, 1000); gfx::Size layer_bounds(100, 100); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); gfx::Size tile_size1(10, 10); gfx::Size tile_size2(30, 30); @@ -412,8 +412,8 @@ TEST(PictureLayerTilingSetTest, MaxContentScale) { ACTIVE_TREE, &active_client, 1000, 1.f, 1000); gfx::Size layer_bounds(100, 105); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateEmpty(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateEmpty(layer_bounds); // Tilings can be added of any scale, the tiling client can controls this. pending_set->AddTiling(1.f, raster_source); diff --git a/cc/tiles/picture_layer_tiling_unittest.cc b/cc/tiles/picture_layer_tiling_unittest.cc index b937804e8852a9..40f288fcd36428 100644 --- a/cc/tiles/picture_layer_tiling_unittest.cc +++ b/cc/tiles/picture_layer_tiling_unittest.cc @@ -9,10 +9,10 @@ #include "base/macros.h" #include "cc/base/math_util.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_picture_layer_tiling_client.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/test_context_provider.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/tiles/picture_layer_tiling.h" @@ -46,7 +46,7 @@ class TestablePictureLayerTiling : public PictureLayerTiling { static scoped_ptr Create( WhichTree tree, float contents_scale, - scoped_refptr raster_source, + scoped_refptr raster_source, PictureLayerTilingClient* client, const LayerTreeSettings& settings) { return make_scoped_ptr(new TestablePictureLayerTiling( @@ -63,14 +63,13 @@ class TestablePictureLayerTiling : public PictureLayerTiling { using PictureLayerTiling::RemoveTilesInRegion; protected: - TestablePictureLayerTiling( - WhichTree tree, - float contents_scale, - scoped_refptr 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 raster_source, + PictureLayerTilingClient* client, + size_t tiling_interest_area_padding, + float skewport_target_time, + int skewport_extrapolation_limit) : PictureLayerTiling(tree, contents_scale, raster_source, @@ -89,8 +88,8 @@ class PictureLayerTilingIteratorTest : public testing::Test { float contents_scale, const gfx::Size& layer_bounds) { client_.SetTileSize(tile_size); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale, raster_source, &client_, LayerTreeSettings()); @@ -101,8 +100,8 @@ class PictureLayerTilingIteratorTest : public testing::Test { float contents_scale, const gfx::Size& layer_bounds) { client_.SetTileSize(tile_size); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); tiling_ = TestablePictureLayerTiling::Create(ACTIVE_TREE, contents_scale, raster_source, &client_, LayerTreeSettings()); @@ -217,9 +216,8 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) { // Stop creating tiles so that any invalidations are left as holes. gfx::Size new_layer_size(200, 200); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreatePartiallyFilled(new_layer_size, - gfx::Rect()); + scoped_refptr raster_source = + FakeRasterSource::CreatePartiallyFilled(new_layer_size, gfx::Rect()); Region invalidation = SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size)); @@ -279,9 +277,8 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeTilingOverTileBorders) { // Shrink the tiling so that the last tile row/column is entirely in the // border pixels of the interior tiles. That row/column is removed. - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled( - gfx::Size(right + 1, bottom + 1)); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(gfx::Size(right + 1, bottom + 1)); tiling_->SetRasterSourceAndResize(raster_source); EXPECT_EQ(2, tiling_->TilingDataForTesting().num_tiles_x()); EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_y()); @@ -299,8 +296,8 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeTilingOverTileBorders) { // Growing outside the current right/bottom tiles border pixels should create // the tiles again, even though the live rect has not changed size. - raster_source = FakeDisplayListRasterSource::CreateFilled( - gfx::Size(right + 2, bottom + 2)); + raster_source = + FakeRasterSource::CreateFilled(gfx::Size(right + 2, bottom + 2)); tiling_->SetRasterSourceAndResize(raster_source); EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x()); EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y()); @@ -433,9 +430,8 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) { EXPECT_TRUE(tiling_->TileAt(0, 0)); // Stop creating tiles so that any invalidations are left as holes. - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreatePartiallyFilled(gfx::Size(200, 200), - gfx::Rect()); + scoped_refptr raster_source = + FakeRasterSource::CreatePartiallyFilled(gfx::Size(200, 200), gfx::Rect()); tiling_->SetRasterSourceAndResize(raster_source); Region invalidation = @@ -585,8 +581,8 @@ TEST(PictureLayerTilingTest, SkewportLimits) { LayerTreeSettings settings; settings.skewport_extrapolation_limit_in_content_pixels = 75; - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, settings); @@ -669,8 +665,8 @@ TEST(PictureLayerTilingTest, ComputeSkewportExtremeCases) { gfx::Size layer_bounds(200, 200); client.SetTileSize(gfx::Size(100, 100)); LayerTreeSettings settings; - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, settings); @@ -702,8 +698,8 @@ TEST(PictureLayerTilingTest, ComputeSkewport) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); @@ -764,8 +760,8 @@ TEST(PictureLayerTilingTest, SkewportThroughUpdateTilePriorities) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); @@ -838,8 +834,8 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) { // for instance begins at (8, 16) pixels. So tile at (46, 46) will begin at // (368, 368) and extend to the end of 1500 * 0.25 = 375 edge of the // tiling. - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 0.25f, raster_source, &client, settings); @@ -1112,8 +1108,8 @@ TEST_F(PictureLayerTilingIteratorTest, LayerTreeSettings settings; settings.tiling_interest_area_padding = 1; - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, 1.f, raster_source, &client_, settings); tiling_->set_resolution(HIGH_RESOLUTION); @@ -1148,8 +1144,8 @@ TEST(ComputeTilePriorityRectsTest, VisibleTiles) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(current_layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(current_layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); @@ -1203,8 +1199,8 @@ TEST(ComputeTilePriorityRectsTest, OffscreenTiles) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(current_layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(current_layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); @@ -1268,8 +1264,8 @@ TEST(ComputeTilePriorityRectsTest, PartiallyOffscreenLayer) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(current_layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(current_layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); @@ -1327,8 +1323,8 @@ TEST(ComputeTilePriorityRectsTest, PartiallyOffscreenRotatedLayer) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(current_layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(current_layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); @@ -1411,8 +1407,8 @@ TEST(ComputeTilePriorityRectsTest, PerspectiveLayer) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(current_layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(current_layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); @@ -1505,8 +1501,8 @@ TEST(ComputeTilePriorityRectsTest, PerspectiveLayerClippedByW) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(current_layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(current_layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); @@ -1569,8 +1565,8 @@ TEST(ComputeTilePriorityRectsTest, BasicMotion) { client.SetTileSize(gfx::Size(100, 100)); LayerTreeSettings settings; - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(current_layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(current_layer_bounds); scoped_ptr tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, settings); @@ -1647,8 +1643,8 @@ TEST(ComputeTilePriorityRectsTest, RotationMotion) { client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(current_layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(current_layer_bounds); tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &client, LayerTreeSettings()); tiling->set_resolution(HIGH_RESOLUTION); @@ -1698,8 +1694,8 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) { active_client.SetTileSize(gfx::Size(100, 100)); LayerTreeSettings settings; - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(gfx::Size(10000, 10000)); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(gfx::Size(10000, 10000)); scoped_ptr active_tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &active_client, settings); @@ -1712,8 +1708,7 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) { recycle_client.SetTileSize(gfx::Size(100, 100)); recycle_client.set_twin_tiling(active_tiling.get()); - raster_source = - FakeDisplayListRasterSource::CreateFilled(gfx::Size(10000, 10000)); + raster_source = FakeRasterSource::CreateFilled(gfx::Size(10000, 10000)); scoped_ptr recycle_tiling = TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, &recycle_client, settings); @@ -1750,8 +1745,8 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { FakePictureLayerTilingClient active_client; active_client.SetTileSize(gfx::Size(100, 100)); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(gfx::Size(100, 100)); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(gfx::Size(100, 100)); scoped_ptr active_tiling = TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source, &active_client, LayerTreeSettings()); @@ -1766,8 +1761,7 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { LayerTreeSettings settings; - raster_source = - FakeDisplayListRasterSource::CreateFilled(gfx::Size(100, 100)); + raster_source = FakeRasterSource::CreateFilled(gfx::Size(100, 100)); scoped_ptr recycle_tiling = TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source, &recycle_client, settings); @@ -1805,8 +1799,8 @@ TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) { EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height()); // The layer's size isn't changed, but the tile size was. - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(gfx::Size(250, 150)); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(gfx::Size(250, 150)); tiling_->SetRasterSourceAndResize(raster_source); // Tile size in the tiling should be resized to 250x200. @@ -1822,8 +1816,8 @@ TEST_F(PictureLayerTilingIteratorTest, GiantRect) { float contents_scale = 1.f; client_.SetTileSize(tile_size); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateEmpty(layer_size); + scoped_refptr raster_source = + FakeRasterSource::CreateEmpty(layer_size); tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale, raster_source, &client_, LayerTreeSettings()); diff --git a/cc/tiles/prioritized_tile.cc b/cc/tiles/prioritized_tile.cc index e1408322f6886f..9fded2a7218639 100644 --- a/cc/tiles/prioritized_tile.cc +++ b/cc/tiles/prioritized_tile.cc @@ -11,11 +11,10 @@ namespace cc { PrioritizedTile::PrioritizedTile() : tile_(nullptr), is_occluded_(false) {} -PrioritizedTile::PrioritizedTile( - Tile* tile, - scoped_refptr raster_source, - const TilePriority priority, - bool is_occluded) +PrioritizedTile::PrioritizedTile(Tile* tile, + scoped_refptr raster_source, + const TilePriority priority, + bool is_occluded) : tile_(tile), raster_source_(std::move(raster_source)), priority_(priority), diff --git a/cc/tiles/prioritized_tile.h b/cc/tiles/prioritized_tile.h index de3abbb7d01b43..5fda4909f15031 100644 --- a/cc/tiles/prioritized_tile.h +++ b/cc/tiles/prioritized_tile.h @@ -6,12 +6,12 @@ #define CC_TILES_PRIORITIZED_TILE_H_ #include "cc/base/cc_export.h" -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/tiles/tile.h" #include "cc/tiles/tile_priority.h" namespace cc { -class DisplayListRasterSource; +class RasterSource; class PictureLayerTiling; class CC_EXPORT PrioritizedTile { @@ -23,7 +23,7 @@ class CC_EXPORT PrioritizedTile { ~PrioritizedTile(); Tile* tile() const { return tile_; } - const scoped_refptr& raster_source() const { + const scoped_refptr& raster_source() const { return raster_source_; } const TilePriority& priority() const { return priority_; } @@ -35,12 +35,12 @@ class CC_EXPORT PrioritizedTile { friend class PictureLayerTiling; PrioritizedTile(Tile* tile, - scoped_refptr raster_source, + scoped_refptr raster_source, const TilePriority priority, bool is_occluded); Tile* tile_; - scoped_refptr raster_source_; + scoped_refptr raster_source_; TilePriority priority_; bool is_occluded_; }; diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc index fa93c3d249fb53..6df710bfd49dfe 100644 --- a/cc/tiles/tile_manager.cc +++ b/cc/tiles/tile_manager.cc @@ -44,7 +44,7 @@ DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER( class RasterTaskImpl : public RasterTask { public: RasterTaskImpl(const Resource* resource, - scoped_refptr raster_source, + scoped_refptr raster_source, const gfx::Rect& content_rect, const gfx::Rect& invalid_content_rect, float contents_scale, @@ -112,7 +112,7 @@ class RasterTaskImpl : public RasterTask { private: const Resource* resource_; - scoped_refptr raster_source_; + scoped_refptr raster_source_; gfx::Rect content_rect_; gfx::Rect invalid_content_rect_; float contents_scale_; diff --git a/cc/tiles/tile_manager.h b/cc/tiles/tile_manager.h index 75f1b2dfd62b4a..6b5745ea638562 100644 --- a/cc/tiles/tile_manager.h +++ b/cc/tiles/tile_manager.h @@ -17,7 +17,7 @@ #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "cc/base/unique_notifier.h" -#include "cc/playback/display_list_raster_source.h" +#include "cc/playback/raster_source.h" #include "cc/raster/tile_task_runner.h" #include "cc/resources/memory_history.h" #include "cc/resources/resource_pool.h" diff --git a/cc/tiles/tile_manager_perftest.cc b/cc/tiles/tile_manager_perftest.cc index 7529e36e45f3bc..cc0a41497e9ce8 100644 --- a/cc/tiles/tile_manager_perftest.cc +++ b/cc/tiles/tile_manager_perftest.cc @@ -12,12 +12,12 @@ #include "cc/debug/lap_timer.h" #include "cc/raster/raster_buffer.h" #include "cc/test/begin_frame_args_test.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_impl_task_runner_provider.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_picture_layer_impl.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/fake_tile_manager.h" #include "cc/test/fake_tile_manager_client.h" #include "cc/test/test_shared_bitmap_manager.h" @@ -130,10 +130,10 @@ class TileManagerPerfTest : public testing::Test { } void SetupDefaultTrees(const gfx::Size& layer_bounds) { - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTrees(pending_raster_source, active_raster_source); } @@ -153,14 +153,14 @@ class TileManagerPerfTest : public testing::Test { active_root_layer_->set_fixed_tile_size(tile_size); } - void SetupTrees(scoped_refptr pending_raster_source, - scoped_refptr active_raster_source) { + void SetupTrees(scoped_refptr pending_raster_source, + scoped_refptr active_raster_source) { SetupPendingTree(active_raster_source); ActivateTree(); SetupPendingTree(pending_raster_source); } - void SetupPendingTree(scoped_refptr raster_source) { + void SetupPendingTree(scoped_refptr raster_source) { host_impl_.CreatePendingTree(); LayerTreeImpl* pending_tree = host_impl_.pending_tree(); // Clear recycled tree. @@ -347,8 +347,8 @@ class TileManagerPerfTest : public testing::Test { int next_id = id_ + 1; // Create the rest of the layers as children of the root layer. - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); while (static_cast(layers.size()) < layer_count) { scoped_ptr layer = FakePictureLayerImpl::CreateWithRasterSource( diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc index 531708102abe2b..a9b09f6886b7b7 100644 --- a/cc/tiles/tile_manager_unittest.cc +++ b/cc/tiles/tile_manager_unittest.cc @@ -7,12 +7,11 @@ #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" -#include "cc/playback/display_list_raster_source.h" #include "cc/playback/display_list_recording_source.h" +#include "cc/playback/raster_source.h" #include "cc/raster/raster_buffer.h" #include "cc/resources/resource_pool.h" #include "cc/test/begin_frame_args_test.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_display_list_recording_source.h" #include "cc/test/fake_impl_task_runner_provider.h" #include "cc/test/fake_layer_tree_host_impl.h" @@ -20,6 +19,7 @@ #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_picture_layer_impl.h" #include "cc/test/fake_picture_layer_tiling_client.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/fake_tile_manager.h" #include "cc/test/test_gpu_memory_buffer_manager.h" #include "cc/test/test_shared_bitmap_manager.h" @@ -88,10 +88,10 @@ class TileManagerTilePriorityQueueTest : public testing::Test { } void SetupDefaultTrees(const gfx::Size& layer_bounds) { - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTrees(pending_raster_source, active_raster_source); } @@ -114,14 +114,14 @@ class TileManagerTilePriorityQueueTest : public testing::Test { active_layer_->set_fixed_tile_size(tile_size); } - void SetupTrees(scoped_refptr pending_raster_source, - scoped_refptr active_raster_source) { + void SetupTrees(scoped_refptr pending_raster_source, + scoped_refptr active_raster_source) { SetupPendingTree(active_raster_source); ActivateTree(); SetupPendingTree(pending_raster_source); } - void SetupPendingTree(scoped_refptr raster_source) { + void SetupPendingTree(scoped_refptr raster_source) { host_impl_.CreatePendingTree(); LayerTreeImpl* pending_tree = host_impl_.pending_tree(); @@ -677,8 +677,8 @@ TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) { SetupDefaultTrees(layer_bounds); // Create a pending child layer. - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); scoped_ptr pending_child = FakePictureLayerImpl::CreateWithRasterSource( host_impl_.pending_tree(), id_ + 1, pending_raster_source); @@ -898,8 +898,8 @@ TEST_F(TileManagerTilePriorityQueueTest, host_impl_.SetViewportSize(layer_bounds); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source); scoped_ptr pending_child = @@ -1014,8 +1014,8 @@ TEST_F(TileManagerTilePriorityQueueTest, gfx::Size layer_bounds(1000, 1000); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupPendingTree(pending_raster_source); scoped_ptr pending_child = @@ -1208,8 +1208,8 @@ TEST_F(TileManagerTilePriorityQueueTest, settings.skewport_target_time_in_seconds, settings.skewport_extrapolation_limit_in_content_pixels); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); tiling->set_resolution(HIGH_RESOLUTION); @@ -1317,8 +1317,8 @@ TEST_F(TileManagerTilePriorityQueueTest, settings.skewport_target_time_in_seconds, settings.skewport_extrapolation_limit_in_content_pixels); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); tiling->set_resolution(HIGH_RESOLUTION); @@ -1465,8 +1465,8 @@ TEST_F(TileManagerTilePriorityQueueTest, RasterQueueAllUsesCorrectTileBounds) { // tile iteration. gfx::Size layer_bounds(1, 1); - scoped_refptr raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr raster_source = + FakeRasterSource::CreateFilled(layer_bounds); FakePictureLayerTilingClient pending_client; pending_client.SetTileSize(gfx::Size(64, 64)); @@ -1540,9 +1540,9 @@ TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { non_solid_paint); recording_source->Rerecord(); - scoped_refptr raster_source = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( - recording_source.get(), false); + scoped_refptr raster_source = + RasterSource::CreateFromDisplayListRecordingSource(recording_source.get(), + false); FakePictureLayerTilingClient tiling_client; tiling_client.SetTileSize(size); @@ -1595,10 +1595,10 @@ class TileManagerTest : public testing::Test { } void SetupDefaultTrees(const gfx::Size& layer_bounds) { - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); - scoped_refptr active_raster_source = - FakeDisplayListRasterSource::CreateFilled(layer_bounds); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); + scoped_refptr active_raster_source = + FakeRasterSource::CreateFilled(layer_bounds); SetupTrees(pending_raster_source, active_raster_source); } @@ -1611,14 +1611,14 @@ class TileManagerTest : public testing::Test { host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); } - void SetupTrees(scoped_refptr pending_raster_source, - scoped_refptr active_raster_source) { + void SetupTrees(scoped_refptr pending_raster_source, + scoped_refptr active_raster_source) { SetupPendingTree(active_raster_source); ActivateTree(); SetupPendingTree(pending_raster_source); } - void SetupPendingTree(scoped_refptr raster_source) { + void SetupPendingTree(scoped_refptr raster_source) { host_impl_->CreatePendingTree(); LayerTreeImpl* pending_tree = host_impl_->pending_tree(); @@ -1743,7 +1743,7 @@ TEST_F(TileManagerTest, LowResHasNoImage) { for (size_t i = 0; i < arraysize(resolutions); ++i) { SCOPED_TRACE(resolutions[i]); - // Make a DisplayListRasterSource that will draw a blue bitmap image. + // Make a RasterSource that will draw a blue bitmap image. skia::RefPtr surface = skia::AdoptRef( SkSurface::NewRasterN32Premul(size.width(), size.height())); ASSERT_NE(surface, nullptr); @@ -1761,8 +1761,8 @@ TEST_F(TileManagerTest, LowResHasNoImage) { recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); recording_source->add_draw_image(blue_image.get(), gfx::Point()); recording_source->Rerecord(); - scoped_refptr raster = - DisplayListRasterSource::CreateFromDisplayListRecordingSource( + scoped_refptr raster = + RasterSource::CreateFromDisplayListRecordingSource( recording_source.get(), false); FakePictureLayerTilingClient tiling_client; @@ -1885,8 +1885,8 @@ TEST_F(PartialRasterTileManagerTest, CancelledTasksHaveNoContentId) { const uint64_t kInvalidatedId = 43; const gfx::Size kTileSize(128, 128); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(kTileSize); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(kTileSize); host_impl_->CreatePendingTree(); LayerTreeImpl* pending_tree = host_impl_->pending_tree(); @@ -1978,8 +1978,8 @@ void RunPartialRasterCheck(scoped_ptr host_impl, kInvalidatedId); host_impl->resource_pool()->CheckBusyResources(); - scoped_refptr pending_raster_source = - FakeDisplayListRasterSource::CreateFilled(kTileSize); + scoped_refptr pending_raster_source = + FakeRasterSource::CreateFilled(kTileSize); host_impl->CreatePendingTree(); LayerTreeImpl* pending_tree = host_impl->pending_tree(); diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 04d65929d60cd6..f96c743a1bc8ce 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -47,12 +47,12 @@ #include "cc/quads/tile_draw_quad.h" #include "cc/test/animation_test_common.h" #include "cc/test/begin_frame_args_test.h" -#include "cc/test/fake_display_list_raster_source.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_mask_layer_impl.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_picture_layer_impl.h" +#include "cc/test/fake_raster_source.h" #include "cc/test/fake_video_frame_provider.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/gpu_rasterization_enabled_settings.h" @@ -7290,8 +7290,8 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { root->AddChild(std::move(scoped_scrolling_layer)); gfx::Size content_layer_bounds(100000, 100); - scoped_refptr raster_source( - FakeDisplayListRasterSource::CreateFilled(content_layer_bounds)); + scoped_refptr raster_source( + FakeRasterSource::CreateFilled(content_layer_bounds)); scoped_ptr scoped_content_layer = FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(), @@ -9248,8 +9248,8 @@ TEST_F(ResourcelessSoftwareLayerTreeHostImplTest, host_impl_->SetViewportSize(viewport_size); host_impl_->CreatePendingTree(); - scoped_refptr raster_source( - FakeDisplayListRasterSource::CreateFilled(viewport_size)); + scoped_refptr raster_source( + FakeRasterSource::CreateFilled(viewport_size)); scoped_ptr layer( FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(), 11, raster_source)); @@ -9779,8 +9779,8 @@ TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) { host_impl_->CreatePendingTree(); Region empty_invalidation; - scoped_refptr raster_source_with_tiles( - FakeDisplayListRasterSource::CreateFilled(gfx::Size(10, 10))); + scoped_refptr raster_source_with_tiles( + FakeRasterSource::CreateFilled(gfx::Size(10, 10))); scoped_ptr layer = FakePictureLayerImpl::Create(host_impl_->pending_tree(), 11);