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

Unified Diff: ppapi/tests/test_utils.cc

Issue 6899055: PPAPI: Force async callback invocation option. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 | « ppapi/tests/test_utils.h ('k') | ppapi/thunk/common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_utils.cc
===================================================================
--- ppapi/tests/test_utils.cc (revision 91178)
+++ ppapi/tests/test_utils.cc (working copy)
@@ -29,11 +29,22 @@
TestCompletionCallback::TestCompletionCallback(PP_Instance instance)
: have_result_(false),
result_(PP_OK_COMPLETIONPENDING),
+ force_async_(false),
post_quit_task_(false),
run_count_(0),
instance_(instance) {
}
+TestCompletionCallback::TestCompletionCallback(PP_Instance instance,
+ bool force_async)
+ : have_result_(false),
+ result_(PP_OK_COMPLETIONPENDING),
+ force_async_(force_async),
+ post_quit_task_(false),
+ run_count_(0),
+ instance_(instance) {
+}
+
int32_t TestCompletionCallback::WaitForResult() {
if (!have_result_) {
result_ = PP_OK_COMPLETIONPENDING; // Reset
@@ -45,8 +56,10 @@
}
TestCompletionCallback::operator pp::CompletionCallback() const {
+ int32_t flags = (force_async_ ? 0 : PP_COMPLETIONCALLBACK_FLAG_OPTIONAL);
return pp::CompletionCallback(&TestCompletionCallback::Handler,
- const_cast<TestCompletionCallback*>(this));
+ const_cast<TestCompletionCallback*>(this),
+ flags);
}
// static
« no previous file with comments | « ppapi/tests/test_utils.h ('k') | ppapi/thunk/common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698