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

Unified Diff: ppapi/shared_impl/tracked_callback.h

Issue 10910099: PPAPI: Make CompletionCallbacks work right on background threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 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
« no previous file with comments | « ppapi/shared_impl/test_globals.cc ('k') | ppapi/shared_impl/tracked_callback.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/tracked_callback.h
diff --git a/ppapi/shared_impl/tracked_callback.h b/ppapi/shared_impl/tracked_callback.h
index 1fa7b1bce88a1bf688e61891ded618638c614864..03bf1626e30882cf09b986c8f7f61f28388cce3c 100644
--- a/ppapi/shared_impl/tracked_callback.h
+++ b/ppapi/shared_impl/tracked_callback.h
@@ -16,10 +16,12 @@
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
+#include "ppapi/shared_impl/ppb_message_loop_shared.h"
namespace ppapi {
class CallbackTracker;
+class MessageLoopShared;
class Resource;
namespace thunk {
@@ -76,7 +78,6 @@ class PPAPI_SHARED_EXPORT TrackedCallback
// Run() will invoke the call immediately, if invoked from the target thread
// (as determined by target_loop_). If invoked on a different thread, the
// callback will be scheduled to run later on target_loop_.
- // TODO(dmichael): Make the above part about different threads actually true.
void Run(int32_t result);
// PostRun is like Run(), except it guarantees that the callback will be run
// later. In particular, if you invoke PostRun on the same thread on which the
@@ -116,6 +117,9 @@ class PPAPI_SHARED_EXPORT TrackedCallback
return (callback_.func &&
(callback_.flags & PP_COMPLETIONCALLBACK_FLAG_OPTIONAL));
}
+ bool has_null_target_loop() const {
+ return target_loop_ == NULL;
+ }
private:
// TrackedCallback and EnterBase manage dealing with how to invoke callbacks
@@ -146,6 +150,10 @@ class PPAPI_SHARED_EXPORT TrackedCallback
bool aborted_;
PP_CompletionCallback callback_;
+ // The MessageLoopShared on which this callback should be run. This will be
+ // NULL if we're in-process.
+ scoped_refptr<MessageLoopShared> target_loop_;
+
int32_t result_for_blocked_callback_;
// Used for pausing/waking the blocked thread if this is a blocking completion
// callback. Note that in-process, there is no lock, blocking callbacks are
« no previous file with comments | « ppapi/shared_impl/test_globals.cc ('k') | ppapi/shared_impl/tracked_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698