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); | |
| 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 12 matching lines...) Expand all Loading... | |
| 170 return PP_FromBool(dispatcher->Send( | 165 return PP_FromBool(dispatcher->Send( |
| 171 new PpapiMsg_PPPContentDecryptor_Decrypt( | 166 new PpapiMsg_PPPContentDecryptor_Decrypt( |
| 172 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, | 167 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, |
| 173 instance, | 168 instance, |
| 174 buffer, | 169 buffer, |
| 175 serialized_block_info))); | 170 serialized_block_info))); |
| 176 } | 171 } |
| 177 | 172 |
| 178 PP_Bool DecryptAndDecode(PP_Instance instance, | 173 PP_Bool DecryptAndDecode(PP_Instance instance, |
| 179 PP_Resource encrypted_block, | 174 PP_Resource encrypted_block, |
| 180 const PP_EncryptedBlockInfo* encrypted_block_info) { | 175 const PP_EncryptedBlockInfo* encrypted_block_info) { |
|
dmichael (off chromium)
2012/09/05 17:13:06
You'll have to do the same here (and other places
Tom Finegan
2012/09/05 19:21:43
Done.
| |
| 181 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 176 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 182 if (!dispatcher) { | 177 if (!dispatcher) { |
| 183 NOTREACHED(); | 178 NOTREACHED(); |
| 184 return PP_FALSE; | 179 return PP_FALSE; |
| 185 } | 180 } |
| 186 | 181 |
| 187 HostResource host_resource; | 182 HostResource host_resource; |
| 188 host_resource.SetHostResource(instance, encrypted_block); | 183 host_resource.SetHostResource(instance, encrypted_block); |
| 189 | 184 |
| 190 uint32_t size = 0; | 185 uint32_t size = 0; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |