Index: ppapi/shared_impl/tracked_callback.h |
diff --git a/ppapi/shared_impl/tracked_callback.h b/ppapi/shared_impl/tracked_callback.h |
index c4bf5cfd279d3c23fe134835301c94a5001584a3..6f8e9fe37555ee6a331b334390a0eab03e040c8d 100644 |
--- a/ppapi/shared_impl/tracked_callback.h |
+++ b/ppapi/shared_impl/tracked_callback.h |
@@ -9,6 +9,7 @@ |
#include <set> |
#include "base/basictypes.h" |
+#include "base/callback.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/synchronization/condition_variable.h" |
@@ -84,7 +85,16 @@ class PPAPI_SHARED_EXPORT TrackedCallback |
// callback is targeted to run, it will *not* be run immediately. |
void PostRun(int32_t result); |
- void BlockUntilRun(); |
+ // A task to perform cleanup actions or write output params before calling |
+ // back to the plugin. The |result| parameter has the current status, e.g. |
+ // whether the operation has been aborted. The return value of the task |
+ // becomes the final callback result. The task is always called on the same |
+ // thread as the callback to the plugin. |
+ typedef base::Callback<int32_t(int32_t /* result */)> CompletionTask; |
+ |
+ // Sets a task that is run just before calling back into the plugin. This |
+ // should only be called once. |
+ void set_completion_task(const CompletionTask& completion_task); |
// Returns the ID of the resource which "owns" the callback, or 0 if the |
// callback is not associated with any resource. |
@@ -157,6 +167,9 @@ class PPAPI_SHARED_EXPORT TrackedCallback |
bool aborted_; |
PP_CompletionCallback callback_; |
+ // Task to run just before calling back into the plugin. |
+ CompletionTask completion_task_; |
+ |
// The MessageLoopShared on which this callback should be run. This will be |
// NULL if we're in-process. |
scoped_refptr<MessageLoopShared> target_loop_; |