Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1272)

Unified Diff: cc/test/fake_picture_pile_impl.cc

Issue 671653005: SetNeedsRedraw directly when updating a visible tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pinchblurmerge-test: testfix Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 e688d22020b985488a69b913dfaca0a1e9811e51..f0c0d2b0fde8fa10b9d2c9183c5d7ce2b6f6eb99 100644
--- a/cc/test/fake_picture_pile_impl.cc
+++ b/cc/test/fake_picture_pile_impl.cc
@@ -10,14 +10,18 @@
#include "cc/resources/picture_pile.h"
#include "cc/test/impl_side_painting_settings.h"
+#include "cc/test/thread_blocker.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cc {
-FakePicturePileImpl::FakePicturePileImpl() {}
+FakePicturePileImpl::FakePicturePileImpl() : raster_thread_blocker_(nullptr) {
+}
-FakePicturePileImpl::FakePicturePileImpl(const PicturePileBase* other)
+FakePicturePileImpl::FakePicturePileImpl(const PicturePileBase* other,
+ ThreadBlocker* blocker)
: PicturePileImpl(other),
+ raster_thread_blocker_(blocker),
tile_grid_info_(other->GetTileGridInfoForTesting()) {
}
@@ -33,7 +37,7 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateFilledPile(
pile.SetRecordedViewportForTesting(gfx::Rect(layer_bounds));
pile.SetHasAnyRecordingsForTesting(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);
@@ -50,7 +54,7 @@ scoped_refptr<FakePicturePileImpl> FakePicturePileImpl::CreateEmptyPile(
pile.SetTileGridSize(ImplSidePaintingSettings().default_tile_grid_size);
pile.SetRecordedViewportForTesting(gfx::Rect());
pile.SetHasAnyRecordingsForTesting(false);
- return make_scoped_refptr(new FakePicturePileImpl(&pile));
+ return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr));
}
scoped_refptr<FakePicturePileImpl>
@@ -64,7 +68,7 @@ FakePicturePileImpl::CreateEmptyPileThatThinksItHasRecordings(
// This simulates a false positive for this flag.
pile.SetRecordedViewportForTesting(gfx::Rect());
pile.SetHasAnyRecordingsForTesting(true);
- return make_scoped_refptr(new FakePicturePileImpl(&pile));
+ return make_scoped_refptr(new FakePicturePileImpl(&pile, nullptr));
}
scoped_refptr<FakePicturePileImpl>
@@ -78,11 +82,25 @@ FakePicturePileImpl::CreateInfiniteFilledPile() {
pile.SetRecordedViewportForTesting(gfx::Rect(size));
pile.SetHasAnyRecordingsForTesting(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 PicturePileBase* other,
+ ThreadBlocker* 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);
+ if (raster_thread_blocker_)
+ raster_thread_blocker_->Wait();
+}
+
void FakePicturePileImpl::AddRecordingAt(int x, int y) {
EXPECT_GE(x, 0);
EXPECT_GE(y, 0);

Powered by Google App Engine
This is Rietveld 408576698