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

Unified Diff: media/base/cdm_promise.h

Issue 1729063003: media: Reject pending CDM promise during destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 10 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.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_;

Powered by Google App Engine
This is Rietveld 408576698