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

Unified Diff: media/mojo/services/mojo_cdm_promise.cc

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/mojo/services/mojo_cdm_promise.cc
diff --git a/media/mojo/services/mojo_cdm_promise.cc b/media/mojo/services/mojo_cdm_promise.cc
index 25131b2115a3bcb27f4baca3cdcb21c1fcb86e52..242fad70f2fe3ee8a173af9dee0809e43d2e8554 100644
--- a/media/mojo/services/mojo_cdm_promise.cc
+++ b/media/mojo/services/mojo_cdm_promise.cc
@@ -37,8 +37,13 @@ MojoCdmPromise<T...>::MojoCdmPromise(const CallbackType& callback)
template <typename... T>
MojoCdmPromise<T...>::~MojoCdmPromise() {
- if (!callback_.is_null())
- DVLOG(1) << "Promise not resolved before destruction.";
+ if (callback_.is_null())
+ return;
+
+ std::string message =
ddorwin 2016/02/25 19:14:12 We have the same code in 4 places. Does it make se
xhwang 2016/02/25 19:53:11 reject() is virtual and we have to call the reject
+ "Unfulfilled promise rejected automatically during destruction.";
+ DVLOG(1) << message;
+ reject(MediaKeys::INVALID_STATE_ERROR, 0, message);
}
template <typename... T>

Powered by Google App Engine
This is Rietveld 408576698