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

Unified Diff: cc/test/pixel_test.cc

Issue 14273026: cc: Make async readback path use async glRreadPixels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months 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/pixel_test.cc
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 5976ae350db3ecc0af2c04beec660f975b531050..8f9489cf11b7c943d414529e263c9e0e9c4eaa8c 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -5,6 +5,7 @@
#include "cc/test/pixel_test.h"
#include "base/path_service.h"
+#include "base/run_loop.h"
#include "cc/output/compositor_frame_metadata.h"
#include "cc/output/gl_renderer.h"
#include "cc/output/output_surface.h"
@@ -80,19 +81,27 @@ void PixelTest::SetUp() {
bool PixelTest::RunPixelTest(RenderPassList* pass_list,
const base::FilePath& ref_file,
const PixelComparator& comparator) {
+ base::RunLoop run_loop;
+
pass_list->back()->copy_callbacks.push_back(
- base::Bind(&PixelTest::ReadbackResult, base::Unretained(this)));
+ base::Bind(&PixelTest::ReadbackResult,
+ base::Unretained(this),
+ run_loop.QuitClosure()));
renderer_->DecideRenderPassAllocationsForFrame(*pass_list);
renderer_->DrawFrame(pass_list);
- // TODO(danakj): When the glReadPixels is async, wait for it to finish.
+ // Wait for the readback to complete.
+ output_surface_->context3d()->finish();
+ run_loop.Run();
return PixelsMatchReference(ref_file, comparator);
}
-void PixelTest::ReadbackResult(scoped_ptr<SkBitmap> bitmap) {
+void PixelTest::ReadbackResult(base::Closure quit_run_loop,
+ scoped_ptr<SkBitmap> bitmap) {
result_bitmap_ = bitmap.Pass();
+ quit_run_loop.Run();
}
bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file,

Powered by Google App Engine
This is Rietveld 408576698