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

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: forlanding 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
« no previous file with comments | « cc/test/pixel_test.h ('k') | cc/test/test_web_graphics_context_3d.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/pixel_test.cc
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 297f542820dbfec14d6a2f51f9264aa43ac555f5..5d28d59a1456d0257a7ea5afcce5a909fc2f5d78 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"
@@ -60,19 +61,27 @@ PixelTest::~PixelTest() {}
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.
+ resource_provider_->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,
« no previous file with comments | « cc/test/pixel_test.h ('k') | cc/test/test_web_graphics_context_3d.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698