| Index: cc/test/fake_picture_pile_impl.cc
|
| diff --git a/cc/test/fake_picture_pile_impl.cc b/cc/test/fake_picture_pile_impl.cc
|
| index 3d31c12a0f65864e7f748d0cac6bb971de05051a..cb68e87bfc8367fe5351ea91a6ae74384234d0f5 100644
|
| --- a/cc/test/fake_picture_pile_impl.cc
|
| +++ b/cc/test/fake_picture_pile_impl.cc
|
| @@ -8,6 +8,7 @@
|
| #include <limits>
|
| #include <utility>
|
|
|
| +#include "base/synchronization/waitable_event.h"
|
| #include "cc/resources/picture_pile.h"
|
| #include "cc/test/fake_picture_pile.h"
|
| #include "cc/test/impl_side_painting_settings.h"
|
| @@ -15,10 +16,14 @@
|
|
|
| namespace cc {
|
|
|
| -FakePicturePileImpl::FakePicturePileImpl() {}
|
| +FakePicturePileImpl::FakePicturePileImpl() : playback_allowed_event_(nullptr) {
|
| +}
|
|
|
| -FakePicturePileImpl::FakePicturePileImpl(const PicturePile* other)
|
| +FakePicturePileImpl::FakePicturePileImpl(
|
| + const PicturePile* other,
|
| + base::WaitableEvent* playback_allowed_event)
|
| : PicturePileImpl(other),
|
| + playback_allowed_event_(playback_allowed_event),
|
| tile_grid_info_(other->GetTileGridInfoForTesting()) {
|
| }
|
|
|
| @@ -34,7 +39,7 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile(
|
| pile.SetRecordedViewport(gfx::Rect(layer_bounds));
|
| pile.SetHasAnyRecordings(true);
|
|
|
| - auto pile_impl = make_scoped_refptr(new FakePicturePileImpl(&pile));
|
| + auto pile_impl = make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr));
|
| for (int x = 0; x < pile_impl->tiling().num_tiles_x(); ++x) {
|
| for (int y = 0; y < pile_impl->tiling().num_tiles_y(); ++y)
|
| pile_impl->AddRecordingAt(x, y);
|
| @@ -51,7 +56,7 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile(
|
| pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size);
|
| pile.SetRecordedViewport(gfx::Rect());
|
| pile.SetHasAnyRecordings(false);
|
| - return make_scoped_refptr(new FakePicturePileImpl(&pile));
|
| + return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr));
|
| }
|
|
|
| scoped_refptr<FakePicturePileImpl>
|
| @@ -65,7 +70,7 @@ FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
|
| // This simulates a false positive for this flag.
|
| pile.SetRecordedViewport(gfx::Rect());
|
| pile.SetHasAnyRecordings(true);
|
| - return make_scoped_refptr(new FakePicturePileImpl(&pile));
|
| + return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr));
|
| }
|
|
|
| scoped_refptr<FakePicturePileImpl>
|
| @@ -79,11 +84,26 @@ FakePicturePileImpl::CreateInfiniteFilledPile() {
|
| pile.SetRecordedViewport(gfx::Rect(size));
|
| pile.SetHasAnyRecordings(true);
|
|
|
| - auto pile_impl = make_scoped_refptr(new FakePicturePileImpl(&pile));
|
| + auto pile_impl = make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr));
|
| pile_impl->AddRecordingAt(0, 0);
|
| return pile_impl;
|
| }
|
|
|
| +scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFromPile(
|
| + const PicturePile* other,
|
| + base::WaitableEvent* playback_allowed_event) {
|
| + return make_scoped_refptr(
|
| + new FakePicturePileImpl(other, playback_allowed_event));
|
| +}
|
| +
|
| +void FakePicturePileImpl::PlaybackToCanvas(SkCanvas* canvas,
|
| + const gfx::Rect& canvas_rect,
|
| + float contents_scale) const {
|
| + if (playback_allowed_event_)
|
| + playback_allowed_event_->Wait();
|
| + PicturePileImpl::PlaybackToCanvas(canvas, canvas_rect, contents_scale);
|
| +}
|
| +
|
| void FakePicturePileImpl::AddRecordingAt(int x, int y) {
|
| EXPECT_GE(x, 0);
|
| EXPECT_GE(y, 0);
|
|
|