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

Unified Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 518523002: Handle incorrect promise resolving (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: equals Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/content_decryptor_delegate.cc
diff --git a/content/renderer/pepper/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc
index 840efa42e90f2c40cacfd959689c4eef324ae8d0..5a9e527d9d389e32cc6e4f48c0b4df57916fde11 100644
--- a/content/renderer/pepper/content_decryptor_delegate.cc
+++ b/content/renderer/pepper/content_decryptor_delegate.cc
@@ -625,14 +625,27 @@ bool ContentDecryptorDelegate::DecryptAndDecodeVideo(
void ContentDecryptorDelegate::OnPromiseResolved(uint32 promise_id) {
scoped_ptr<CdmPromise> promise = TakePromise(promise_id);
+
+ // Special case due to http://crbug.com/408330. CDM is resolving LoadSession()
+ // with this method when the session is not found. Instead it should call
+ // PromiseResolvedWithSession(""), so emulate that here until 408330 is fixed.
+ // TODO(jrummell): Remove this code when the CDM is updated.
+ if (promise &&
+ promise->GetResolveParameterType() == media::CdmPromise::STRING_TYPE) {
+ NewSessionCdmPromise* session_promise =
+ static_cast<NewSessionCdmPromise*>(promise.get());
+ session_promise->resolve(std::string());
+ return;
+ }
+
if (!promise ||
promise->GetResolveParameterType() != media::CdmPromise::VOID_TYPE) {
NOTREACHED();
return;
}
- SimpleCdmPromise* simple_promise(
- static_cast<SimpleCdmPromise*>(promise.get()));
+ SimpleCdmPromise* simple_promise =
+ static_cast<SimpleCdmPromise*>(promise.get());
simple_promise->resolve();
}
@@ -649,8 +662,8 @@ void ContentDecryptorDelegate::OnPromiseResolvedWithSession(
StringVar* web_session_id_string = StringVar::FromPPVar(web_session_id);
DCHECK(web_session_id_string);
- NewSessionCdmPromise* session_promise(
- static_cast<NewSessionCdmPromise*>(promise.get()));
+ NewSessionCdmPromise* session_promise =
+ static_cast<NewSessionCdmPromise*>(promise.get());
session_promise->resolve(web_session_id_string->value());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698