Chromium Code Reviews| Index: media/base/cdm_promise.h |
| diff --git a/media/base/cdm_promise.h b/media/base/cdm_promise.h |
| index 0c44f80c8fa19a19fcec0a1e79ba670ee4826478..6aeda5b7f4a8e9977717b31690a40c435b55037d 100644 |
| --- a/media/base/cdm_promise.h |
| +++ b/media/base/cdm_promise.h |
| @@ -99,6 +99,8 @@ class MEDIA_EXPORT CdmPromiseTemplate : public CdmPromise { |
| } |
| protected: |
| + bool IsPromiseSettled() const { return is_settled_; } |
| + |
| // All implementations must call this method in resolve() and reject() methods |
| // to indicate that the promise has been settled. |
| void MarkPromiseSettled() { |
| @@ -107,6 +109,15 @@ class MEDIA_EXPORT CdmPromiseTemplate : public CdmPromise { |
| is_settled_ = true; |
| } |
| + void RejectPromiseOnDestruction() { |
|
ddorwin
2016/02/26 17:29:28
// Must be called by the concrete destructor if !I
xhwang
2016/02/26 20:52:21
Done.
|
| + DCHECK(!is_settled_); |
| + std::string message = |
| + "Unfulfilled promise rejected automatically during destruction."; |
| + DVLOG(1) << message; |
| + reject(MediaKeys::INVALID_STATE_ERROR, 0, message); |
| + DCHECK(is_settled_); |
| + } |
| + |
| private: |
| // Keep track of whether the promise has been resolved or rejected yet. |
| bool is_settled_; |