diff options
author | jbroman <jbroman@chromium.org> | 2015-05-29 13:11:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-29 20:12:24 +0000 |
commit | 16d628c67c862bf12797dc98a4a4110cf7b3229b (patch) | |
tree | c58b1c8f1d37497fda5cbc507b1954f8597a39fe /cc/test | |
parent | dca49897b2a0938dab1811f1072a1196bbba2854 (diff) | |
download | chromium_src-16d628c67c862bf12797dc98a4a4110cf7b3229b.zip chromium_src-16d628c67c862bf12797dc98a4a4110cf7b3229b.tar.gz chromium_src-16d628c67c862bf12797dc98a4a4110cf7b3229b.tar.bz2 |
cc: Make ContentLayerClient subclasses create the DisplayItemList.
The clients are now expected to return a cc::DisplayItemList which is
suitably "finalized" (in particular, ProcessAppendedItems and
CreateAndCacheSkPicture should have been called, as appropriate for the
settings used to create the display list).
This avoids plumbing constructor parameters for DisplayItemList, which I'm
about to add more of.
BUG=484943
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1152283010
Cr-Commit-Position: refs/heads/master@{#332034}
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/fake_content_layer_client.cc | 12 | ||||
-rw-r--r-- | cc/test/fake_content_layer_client.h | 3 | ||||
-rw-r--r-- | cc/test/fake_display_list_recording_source.h | 17 | ||||
-rw-r--r-- | cc/test/solid_color_content_layer_client.cc | 5 | ||||
-rw-r--r-- | cc/test/solid_color_content_layer_client.h | 3 |
5 files changed, 20 insertions, 20 deletions
diff --git a/cc/test/fake_content_layer_client.cc b/cc/test/fake_content_layer_client.cc index 5d949bf..b0dacb3 100644 --- a/cc/test/fake_content_layer_client.cc +++ b/cc/test/fake_content_layer_client.cc @@ -71,10 +71,15 @@ void FakeContentLayerClient::PaintContents( } } -void FakeContentLayerClient::PaintContentsToDisplayList( - DisplayItemList* display_list, +scoped_refptr<DisplayItemList> +FakeContentLayerClient::PaintContentsToDisplayList( const gfx::Rect& clip, PaintingControlSetting painting_control) { + // Cached picture is used because unit tests expect to be able to + // use GatherPixelRefs. + const bool use_cached_picture = true; + scoped_refptr<DisplayItemList> display_list = + DisplayItemList::Create(clip, use_cached_picture); SkPictureRecorder recorder; skia::RefPtr<SkCanvas> canvas; skia::RefPtr<SkPicture> picture; @@ -128,6 +133,9 @@ void FakeContentLayerClient::PaintContentsToDisplayList( } display_list->CreateAndAppendItem<EndClipDisplayItem>(); + + display_list->Finalize(); + return display_list; } bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } diff --git a/cc/test/fake_content_layer_client.h b/cc/test/fake_content_layer_client.h index d01bbd1..a4ecc59 100644 --- a/cc/test/fake_content_layer_client.h +++ b/cc/test/fake_content_layer_client.h @@ -40,8 +40,7 @@ class FakeContentLayerClient : public ContentLayerClient { void PaintContents(SkCanvas* canvas, const gfx::Rect& rect, PaintingControlSetting painting_control) override; - void PaintContentsToDisplayList( - DisplayItemList* display_list, + scoped_refptr<DisplayItemList> PaintContentsToDisplayList( const gfx::Rect& clip, PaintingControlSetting painting_control) override; bool FillsBoundsCompletely() const override; diff --git a/cc/test/fake_display_list_recording_source.h b/cc/test/fake_display_list_recording_source.h index d4506ad..bb55a66 100644 --- a/cc/test/fake_display_list_recording_source.h +++ b/cc/test/fake_display_list_recording_source.h @@ -16,17 +16,15 @@ namespace cc { // display list. class FakeDisplayListRecordingSource : public DisplayListRecordingSource { public: - FakeDisplayListRecordingSource(const gfx::Size& grid_cell_size, - bool use_cached_picture) - : DisplayListRecordingSource(grid_cell_size, use_cached_picture) {} + explicit FakeDisplayListRecordingSource(const gfx::Size& grid_cell_size) + : DisplayListRecordingSource(grid_cell_size) {} ~FakeDisplayListRecordingSource() override {} static scoped_ptr<FakeDisplayListRecordingSource> CreateRecordingSource( const gfx::Rect& recorded_viewport) { scoped_ptr<FakeDisplayListRecordingSource> recording_source( new FakeDisplayListRecordingSource( - ImplSidePaintingSettings().default_tile_grid_size, - ImplSidePaintingSettings().use_cached_picture_in_display_list)); + ImplSidePaintingSettings().default_tile_grid_size)); recording_source->SetRecordedViewport(recorded_viewport); return recording_source; } @@ -42,13 +40,8 @@ class FakeDisplayListRecordingSource : public DisplayListRecordingSource { void Rerecord() { ContentLayerClient::PaintingControlSetting painting_control = ContentLayerClient::PAINTING_BEHAVIOR_NORMAL; - bool use_cached_picture = true; - display_list_ = - DisplayItemList::Create(recorded_viewport_, use_cached_picture); - client_.PaintContentsToDisplayList(display_list_.get(), recorded_viewport_, - painting_control); - display_list_->ProcessAppendedItems(); - display_list_->CreateAndCacheSkPicture(); + display_list_ = client_.PaintContentsToDisplayList(recorded_viewport_, + painting_control); if (gather_pixel_refs_) display_list_->GatherPixelRefs(grid_cell_size_); } diff --git a/cc/test/solid_color_content_layer_client.cc b/cc/test/solid_color_content_layer_client.cc index fe13526..a80f4a8 100644 --- a/cc/test/solid_color_content_layer_client.cc +++ b/cc/test/solid_color_content_layer_client.cc @@ -25,11 +25,12 @@ void SolidColorContentLayerClient::PaintContents( paint); } -void SolidColorContentLayerClient::PaintContentsToDisplayList( - DisplayItemList* display_list, +scoped_refptr<DisplayItemList> +SolidColorContentLayerClient::PaintContentsToDisplayList( const gfx::Rect& clip, PaintingControlSetting painting_control) { NOTIMPLEMENTED(); + return nullptr; } bool SolidColorContentLayerClient::FillsBoundsCompletely() const { diff --git a/cc/test/solid_color_content_layer_client.h b/cc/test/solid_color_content_layer_client.h index 3068f9ae..1ab4c4d 100644 --- a/cc/test/solid_color_content_layer_client.h +++ b/cc/test/solid_color_content_layer_client.h @@ -19,8 +19,7 @@ class SolidColorContentLayerClient : public ContentLayerClient { void PaintContents(SkCanvas* canvas, const gfx::Rect& rect, PaintingControlSetting painting_control) override; - void PaintContentsToDisplayList( - DisplayItemList* display_list, + scoped_refptr<DisplayItemList> PaintContentsToDisplayList( const gfx::Rect& clip, PaintingControlSetting painting_control) override; bool FillsBoundsCompletely() const override; |