Index: media/base/cdm_promise_adapter.h |
diff --git a/media/base/cdm_promise_adapter.h b/media/base/cdm_promise_adapter.h |
index dacd6b576c3b28f9f96b6eab6304f7e0bee40813..d4e43814a6d47f9f8bcdee070e6b9b1e06e4db76 100644 |
--- a/media/base/cdm_promise_adapter.h |
+++ b/media/base/cdm_promise_adapter.h |
@@ -25,9 +25,17 @@ class MEDIA_EXPORT CdmPromiseAdapter { |
// Takes ownership of |promise| and returns an integer promise ID. |
uint32_t SavePromise(scoped_ptr<media::CdmPromise> promise); |
- // Finds, takes the ownership of and returns the promise for |promise_id|. |
- // Returns null if no promise can be found. |
- scoped_ptr<CdmPromise> TakePromise(uint32_t promise_id); |
+ // Takes the promise for |promise_id|, sanity checks its |type|, and resolves |
+ // it with |result|. |
+ template <typename... T> |
+ void ResolvePromise(uint32_t promise_id, const T&... result); |
+ |
+ // Takes the promise for |promise_id| and rejects it with |exception_code|, |
+ // |system_code| and |error_message|. |
+ void RejectPromise(uint32_t promise_id, |
+ MediaKeys::Exception exception_code, |
+ uint32 system_code, |
+ const std::string& error_message); |
// Rejects and clears all |promises_|. |
void Clear(); |
@@ -36,6 +44,10 @@ class MEDIA_EXPORT CdmPromiseAdapter { |
// A map between promise IDs and CdmPromises. It owns the CdmPromises. |
typedef base::ScopedPtrHashMap<uint32_t, CdmPromise> PromiseMap; |
+ // Finds, takes the ownership of and returns the promise for |promise_id|. |
+ // Returns null if no promise can be found. |
+ scoped_ptr<CdmPromise> TakePromise(uint32_t promise_id); |
+ |
uint32_t next_promise_id_; |
PromiseMap promises_; |