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

Unified Diff: media/base/cdm_promise_adapter.h

Issue 836783004: media: Handle promise resolve/rejection in CdmPromiseAdapter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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_;

Powered by Google App Engine
This is Rietveld 408576698