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

Unified Diff: ppapi/shared_impl/tracked_callback.h

Issue 9015009: Use the new callback tracker and delete the old one (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years 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
Index: ppapi/shared_impl/tracked_callback.h
diff --git a/ppapi/shared_impl/tracked_callback.h b/ppapi/shared_impl/tracked_callback.h
index ed42a5954ca65a1634d9727de00b029f7d517c0c..b085b77c0dd0e1db8c8e06c887a80a0a3281a84c 100644
--- a/ppapi/shared_impl/tracked_callback.h
+++ b/ppapi/shared_impl/tracked_callback.h
@@ -63,6 +63,8 @@ class PPAPI_SHARED_EXPORT TrackedCallback
// Run the callback with the given result. If the callback had previously been
// marked as to be aborted (by |PostAbort()|), |result| will be ignored and
// the callback will be run with result |PP_ERROR_ABORTED|.
+ //
+ // See also ClearAndRun().
void Run(int32_t result);
// Returns the ID of the resource which "owns" the callback, or 0 if the
@@ -77,6 +79,17 @@ class PPAPI_SHARED_EXPORT TrackedCallback
// completion.
bool aborted() const { return aborted_; }
+ // Runs the given callback, clearing the given scoped_refptr before execution.
+ // This is useful for cases where there can be only one pending callback, and
+ // the presence of the callback indicates is one is pending. Such code would
+ // normally want to clear it before execution so the plugin can issue a new
+ // request.
+ static void ClearAndRun(scoped_refptr<TrackedCallback>* callback,
+ int32_t result);
+
+ // Same as RunAndClear except it calls Abort().
viettrungluu 2012/01/03 22:10:14 ClearAndRun, not RunAndClear.
+ static void ClearAndAbort(scoped_refptr<TrackedCallback>* callback);
+
private:
// This class is ref counted.
friend class base::RefCountedThreadSafe<TrackedCallback>;

Powered by Google App Engine
This is Rietveld 408576698