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

Unified Diff: ppapi/shared_impl/tracked_callback.h

Issue 22606005: Add CompletionTask to PPAPI TrackedCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | « no previous file | ppapi/shared_impl/tracked_callback.cc » ('j') | ppapi/shared_impl/tracked_callback.cc » ('J')
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 4917990e3cfeafa31ebb70623bc4538c1685b3a9..04ffc1ce8f653816212c641af6da9205b1769879 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,12 @@ class PPAPI_SHARED_EXPORT TrackedCallback
// callback is targeted to run, it will *not* be run immediately.
void PostRun(int32_t result);
- void BlockUntilRun();
+ // Task to perform any cleanup or output before calling back into the plugin.
bbudge 2013/08/07 21:01:54 I should add more comments here: // Task to perfor
teravest 2013/08/08 16:49:52 Sounds good.
+ typedef base::Callback<int32_t(int32_t /* result */)> CompletionTask;
+
+ // Sets a task that is run just before calling back into the plugin. This can
+ // only be called once.
+ void SetCompletionTask(const CompletionTask& completion_task);
yzshen1 2013/08/07 21:09:10 nit: I think it should be named set_completion_tas
bbudge 2013/08/08 18:34:00 Done.
// Returns the ID of the resource which "owns" the callback, or 0 if the
// callback is not associated with any resource.
@@ -142,6 +148,8 @@ class PPAPI_SHARED_EXPORT TrackedCallback
// deleted (so keep a reference if it'll still be needed).
void MarkAsCompleted();
+ int32_t RunCompletionTask(int32_t result);
+
// This class is ref counted.
friend class base::RefCountedThreadSafe<TrackedCallback>;
virtual ~TrackedCallback();
@@ -156,6 +164,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_;
« no previous file with comments | « no previous file | ppapi/shared_impl/tracked_callback.cc » ('j') | ppapi/shared_impl/tracked_callback.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698