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

Unified Diff: media/blink/cdm_result_promise.h

Issue 1729063003: media: Reject pending CDM promise during destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/blink/cdm_result_promise.h
diff --git a/media/blink/cdm_result_promise.h b/media/blink/cdm_result_promise.h
index 179654eae88a36ef7228b1f08c495bbc11f25cb4..c59d2c3990c16cc667ae3ba4ca4b4b77ba80f3af 100644
--- a/media/blink/cdm_result_promise.h
+++ b/media/blink/cdm_result_promise.h
@@ -56,6 +56,13 @@ CdmResultPromise<T...>::CdmResultPromise(
template <typename... T>
CdmResultPromise<T...>::~CdmResultPromise() {
+ if (web_cdm_result_.isCompleted())
+ return;
+
+ std::string message =
+ "Unfulfilled promise rejected automatically during destruction.";
+ DVLOG(1) << message;
+ reject(MediaKeys::INVALID_STATE_ERROR, 0, message);
}
// "inline" is needed to prevent multiple definition error.

Powered by Google App Engine
This is Rietveld 408576698