Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h" | 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h" |
| 6 | 6 |
| 7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
| 8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/ppb_core.h" | 9 #include "ppapi/c/ppb_core.h" |
| 10 #include "ppapi/proxy/content_decryptor_private_serializer.h" | 10 #include "ppapi/proxy/content_decryptor_private_serializer.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 NOTREACHED(); | 133 NOTREACHED(); |
| 134 return PP_FALSE; | 134 return PP_FALSE; |
| 135 } | 135 } |
| 136 const PPB_Core* core = static_cast<const PPB_Core*>( | 136 const PPB_Core* core = static_cast<const PPB_Core*>( |
| 137 dispatcher->local_get_interface()(PPB_CORE_INTERFACE)); | 137 dispatcher->local_get_interface()(PPB_CORE_INTERFACE)); |
| 138 if (!core) { | 138 if (!core) { |
| 139 NOTREACHED(); | 139 NOTREACHED(); |
| 140 return PP_FALSE; | 140 return PP_FALSE; |
| 141 } | 141 } |
| 142 | 142 |
| 143 // We need to take a ref on the resource now. The browser may drop | |
| 144 // references once we return from here, but we're sending an asynchronous | |
| 145 // message. The plugin side takes ownership of that reference. | |
| 146 core->AddRefResource(encrypted_block); | |
|
dmichael (off chromium)
2012/09/05 17:13:06
tl;dr: Keep this. What you're missing is the corre
Tom Finegan
2012/09/05 19:21:43
Done.
| |
| 147 | |
| 148 HostResource host_resource; | 143 HostResource host_resource; |
| 149 host_resource.SetHostResource(instance, encrypted_block); | 144 host_resource.SetHostResource(instance, encrypted_block); |
| 150 | 145 |
| 151 uint32_t size = 0; | 146 uint32_t size = 0; |
| 152 if (DescribeHostBufferResource(encrypted_block, &size) == PP_FALSE) | 147 if (DescribeHostBufferResource(encrypted_block, &size) == PP_FALSE) |
| 153 return PP_FALSE; | 148 return PP_FALSE; |
| 154 | 149 |
| 155 base::SharedMemoryHandle handle; | 150 base::SharedMemoryHandle handle; |
| 156 if (ShareHostBufferResourceToPlugin(dispatcher, | 151 if (ShareHostBufferResourceToPlugin(dispatcher, |
| 157 encrypted_block, | 152 encrypted_block, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, | 308 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, |
| 314 encrypted_buffer.handle, | 309 encrypted_buffer.handle, |
| 315 encrypted_buffer.size); | 310 encrypted_buffer.size); |
| 316 PP_EncryptedBlockInfo block_info; | 311 PP_EncryptedBlockInfo block_info; |
| 317 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) | 312 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 318 return; | 313 return; |
| 319 CallWhileUnlocked(ppp_decryptor_impl_->Decrypt, | 314 CallWhileUnlocked(ppp_decryptor_impl_->Decrypt, |
| 320 instance, | 315 instance, |
| 321 plugin_resource, | 316 plugin_resource, |
| 322 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); | 317 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); |
| 323 } | 318 } |
|
dmichael (off chromium)
2012/09/05 17:13:06
At this point, you need to tell the renderer to dr
Tom Finegan
2012/09/05 19:21:43
Done.
| |
| 324 } | 319 } |
| 325 | 320 |
| 326 void PPP_ContentDecryptor_Private_Proxy::OnMsgDecryptAndDecode( | 321 void PPP_ContentDecryptor_Private_Proxy::OnMsgDecryptAndDecode( |
| 327 PP_Instance instance, | 322 PP_Instance instance, |
| 328 const PPPDecryptor_Buffer& encrypted_buffer, | 323 const PPPDecryptor_Buffer& encrypted_buffer, |
| 329 const std::string& serialized_block_info) { | 324 const std::string& serialized_block_info) { |
| 330 if (ppp_decryptor_impl_) { | 325 if (ppp_decryptor_impl_) { |
| 331 PP_Resource plugin_resource = | 326 PP_Resource plugin_resource = |
| 332 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, | 327 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, |
| 333 encrypted_buffer.handle, | 328 encrypted_buffer.handle, |
| 334 encrypted_buffer.size); | 329 encrypted_buffer.size); |
| 335 PP_EncryptedBlockInfo block_info; | 330 PP_EncryptedBlockInfo block_info; |
| 336 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) | 331 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 337 return; | 332 return; |
| 338 CallWhileUnlocked(ppp_decryptor_impl_->DecryptAndDecode, | 333 CallWhileUnlocked(ppp_decryptor_impl_->DecryptAndDecode, |
| 339 instance, | 334 instance, |
| 340 plugin_resource, | 335 plugin_resource, |
| 341 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); | 336 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); |
| 342 } | 337 } |
| 343 } | 338 } |
| 344 | 339 |
| 345 } // namespace proxy | 340 } // namespace proxy |
| 346 } // namespace ppapi | 341 } // namespace ppapi |
| OLD | NEW |