diff options
author | tomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-12 05:25:00 +0000 |
---|---|---|
committer | tomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-12 05:25:00 +0000 |
commit | a6e4fbfd6c6848be53e04bcd11b097df8399064d (patch) | |
tree | 5d2b2b23e3546d06a84aaf05a77492c469a00a6e /webkit | |
parent | 0d2bd8b4c40f047a5c7e8163efd5ca87a9c34094 (diff) | |
download | chromium_src-a6e4fbfd6c6848be53e04bcd11b097df8399064d.zip chromium_src-a6e4fbfd6c6848be53e04bcd11b097df8399064d.tar.gz chromium_src-a6e4fbfd6c6848be53e04bcd11b097df8399064d.tar.bz2 |
Change PPB_ContentDecryptor_Private::KeyMessage to pass the message as a PP_Var instead of a PP_Resource.
BUG=164498
TEST=EME decrypt and decode continues to work.
Review URL: https://chromiumcodereview.appspot.com/11442029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/media/crypto/ppapi/cdm_wrapper.cc | 11 | ||||
-rw-r--r-- | webkit/plugins/ppapi/content_decryptor_delegate.cc | 38 | ||||
-rw-r--r-- | webkit/plugins/ppapi/content_decryptor_delegate.h | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.h | 2 |
5 files changed, 20 insertions, 37 deletions
diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc index 9c2afa2..9ebba03 100644 --- a/webkit/media/crypto/ppapi/cdm_wrapper.cc +++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc @@ -877,16 +877,13 @@ void CdmWrapper::KeyMessage(int32_t result, const std::string& default_url) { PP_DCHECK(result == PP_OK); - pp::Buffer_Dev message_buffer; - - if (!message.empty()) { - message_buffer = pp::Buffer_Dev(this, message.size()); - PP_DCHECK(message_buffer.size() == message.size()); - memcpy(message_buffer.data(), message.data(), message.size()); + pp::VarArrayBuffer message_array_buffer(message.size()); + if (message.size() > 0) { + memcpy(message_array_buffer.Map(), message.data(), message.size()); } pp::ContentDecryptor_Private::KeyMessage( - key_system_, session_id, message_buffer, default_url); + key_system_, session_id, message_array_buffer, default_url); } // TODO(xhwang): Support MediaKeyError (see spec: http://goo.gl/rbdnR) in CDM diff --git a/webkit/plugins/ppapi/content_decryptor_delegate.cc b/webkit/plugins/ppapi/content_decryptor_delegate.cc index 8b75102..900e11b 100644 --- a/webkit/plugins/ppapi/content_decryptor_delegate.cc +++ b/webkit/plugins/ppapi/content_decryptor_delegate.cc @@ -23,6 +23,7 @@ #include "ui/gfx/rect.h" #include "webkit/plugins/ppapi/ppb_buffer_impl.h" +using ppapi::ArrayBufferVar; using ppapi::PpapiGlobals; using ppapi::ScopedPPResource; using ppapi::StringVar; @@ -641,43 +642,28 @@ void ContentDecryptorDelegate::KeyAdded(PP_Var key_system_var, void ContentDecryptorDelegate::KeyMessage(PP_Var key_system_var, PP_Var session_id_var, - PP_Resource message_resource, + PP_Var message_var, PP_Var default_url_var) { if (!decryptor_client_) return; StringVar* key_system_string = StringVar::FromPPVar(key_system_var); StringVar* session_id_string = StringVar::FromPPVar(session_id_var); - StringVar* default_url_string = StringVar::FromPPVar(default_url_var); - if (!key_system_string || !session_id_string || !default_url_string) { - decryptor_client_->KeyError("", "", media::Decryptor::kUnknownError, 0); - return; - } + ArrayBufferVar* message_array_buffer = + ArrayBufferVar::FromPPVar(message_var); std::string message; + if (message_array_buffer) { + const char* data = static_cast<const char*>(message_array_buffer->Map()); + message.assign(data, message_array_buffer->ByteLength()); + } - if (message_resource) { - EnterResourceNoLock<PPB_Buffer_API> enter(message_resource, true); - if (!enter.succeeded()) { - decryptor_client_->KeyError(key_system_string->value(), - session_id_string->value(), - media::Decryptor::kUnknownError, - 0); - return; - } - - BufferAutoMapper mapper(enter.object()); - if (!mapper.data() || !mapper.size()) { - decryptor_client_->KeyError(key_system_string->value(), - session_id_string->value(), - media::Decryptor::kUnknownError, - 0); - return; - } + StringVar* default_url_string = StringVar::FromPPVar(default_url_var); - message = std::string(reinterpret_cast<const char*>(mapper.data()), - mapper.size()); + if (!key_system_string || !session_id_string || !default_url_string) { + decryptor_client_->KeyError("", "", media::Decryptor::kUnknownError, 0); + return; } decryptor_client_->KeyMessage(key_system_string->value(), diff --git a/webkit/plugins/ppapi/content_decryptor_delegate.h b/webkit/plugins/ppapi/content_decryptor_delegate.h index 61c389d..2179068 100644 --- a/webkit/plugins/ppapi/content_decryptor_delegate.h +++ b/webkit/plugins/ppapi/content_decryptor_delegate.h @@ -77,7 +77,7 @@ class WEBKIT_PLUGINS_EXPORT ContentDecryptorDelegate { void KeyAdded(PP_Var key_system, PP_Var session_id); void KeyMessage(PP_Var key_system, PP_Var session_id, - PP_Resource message, + PP_Var message, PP_Var default_url); void KeyError(PP_Var key_system, PP_Var session_id, diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 1bc0477..44bab5d 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -2053,10 +2053,10 @@ void PluginInstance::KeyAdded(PP_Instance instance, void PluginInstance::KeyMessage(PP_Instance instance, PP_Var key_system_var, PP_Var session_id_var, - PP_Resource message_resource, + PP_Var message_var, PP_Var default_url_var) { content_decryptor_delegate_->KeyMessage( - key_system_var, session_id_var, message_resource, default_url_var); + key_system_var, session_id_var, message_var, default_url_var); } void PluginInstance::KeyError(PP_Instance instance, diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index 1d0aff5..79dea73 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -424,7 +424,7 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : virtual void KeyMessage(PP_Instance instance, PP_Var key_system, PP_Var session_id, - PP_Resource message, + PP_Var message, PP_Var default_url) OVERRIDE; virtual void KeyError(PP_Instance instance, PP_Var key_system, |