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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 request_id); | 478 request_id); |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| 482 void PPP_ContentDecryptor_Private_Proxy::OnMsgDecryptAndDecode( | 482 void PPP_ContentDecryptor_Private_Proxy::OnMsgDecryptAndDecode( |
| 483 PP_Instance instance, | 483 PP_Instance instance, |
| 484 PP_DecryptorStreamType decoder_type, | 484 PP_DecryptorStreamType decoder_type, |
| 485 const PPPDecryptor_Buffer& encrypted_buffer, | 485 const PPPDecryptor_Buffer& encrypted_buffer, |
| 486 const std::string& serialized_block_info) { | 486 const std::string& serialized_block_info) { |
| 487 if (ppp_decryptor_impl_) { | 487 if (ppp_decryptor_impl_) { |
| 488 PP_Resource plugin_resource = | 488 PP_Resource plugin_resource = 0; |
|
xhwang
2012/10/19 07:12:40
Since PP_Resource of 0 can happen if error happens
Tom Finegan
2012/10/20 00:57:17
Discussion in progress offline, but I don't think
| |
| 489 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, | 489 if (encrypted_buffer.size > 0) { |
| 490 encrypted_buffer.handle, | 490 plugin_resource = |
| 491 encrypted_buffer.size); | 491 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, |
|
brettw
2012/10/19 23:03:54
If you don't hit this line I believe encrypted_buf
Tom Finegan
2012/10/20 00:57:17
Changed this and the usage above to occur only whe
| |
| 492 encrypted_buffer.handle, | |
| 493 encrypted_buffer.size); | |
| 494 } | |
| 495 | |
| 492 PP_EncryptedBlockInfo block_info; | 496 PP_EncryptedBlockInfo block_info; |
| 493 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) | 497 if (!DeserializeBlockInfo(serialized_block_info, &block_info)) |
| 494 return; | 498 return; |
|
brettw
2012/10/19 23:03:54
If you hit this the plugin_resource will leak
Tom Finegan
2012/10/20 00:57:17
Done. Thanks! This part now happens before we do a
| |
| 495 CallWhileUnlocked( | 499 CallWhileUnlocked( |
| 496 ppp_decryptor_impl_->DecryptAndDecode, | 500 ppp_decryptor_impl_->DecryptAndDecode, |
| 497 instance, | 501 instance, |
| 498 decoder_type, | 502 decoder_type, |
| 499 plugin_resource, | 503 plugin_resource, |
| 500 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); | 504 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); |
| 501 } | 505 } |
| 502 } | 506 } |
| 503 | 507 |
| 504 } // namespace proxy | 508 } // namespace proxy |
| 505 } // namespace ppapi | 509 } // namespace ppapi |
| OLD | NEW |