Chromium Code Reviews| 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>; |