Chromium Code Reviews| 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..501243cd47f7cfe5df65d63b40f76a1f57e28b70 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,13 @@ |
| namespace cc { |
| -FakePicturePileImpl::FakePicturePileImpl() {} |
| +FakePicturePileImpl::FakePicturePileImpl() : raster_thread_blocker_(nullptr) { |
| +} |
| -FakePicturePileImpl::FakePicturePileImpl(const PicturePile* other) |
| +FakePicturePileImpl::FakePicturePileImpl(const PicturePile* other, |
| + base::WaitableEvent* blocker) |
| : PicturePileImpl(other), |
| + raster_thread_blocker_(blocker), |
| tile_grid_info_(other->GetTileGridInfoForTesting()) { |
| } |
| @@ -34,7 +38,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 +55,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 +69,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 +83,25 @@ 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* blocker) { |
| + return make_scoped_refptr(new FakePicturePileImpl(other, blocker)); |
| +} |
| + |
| +void FakePicturePileImpl::PlaybackToCanvas(SkCanvas* canvas, |
| + const gfx::Rect& canvas_rect, |
| + float contents_scale) const { |
| + PicturePileImpl::PlaybackToCanvas(canvas, canvas_rect, contents_scale); |
|
reveman
2014/11/13 20:50:58
Move the Wait() call above this line if you use my
danakj
2014/11/13 21:24:40
Right it doesn't matter, it's just blocking this f
|
| + if (raster_thread_blocker_) |
| + raster_thread_blocker_->Wait(); |
| +} |
| + |
| void FakePicturePileImpl::AddRecordingAt(int x, int y) { |
| EXPECT_GE(x, 0); |
| EXPECT_GE(y, 0); |