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

Unified Diff: webkit/media/crypto/ppapi/cdm_wrapper.cc

Issue 10909068: Fix resource leaks in CDM implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates per last set of comments. Created 8 years, 3 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 | « ppapi/proxy/ppp_content_decryptor_private_proxy.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/crypto/ppapi/cdm_wrapper.cc
diff --git a/webkit/media/crypto/ppapi/cdm_wrapper.cc b/webkit/media/crypto/ppapi/cdm_wrapper.cc
index 88baa44062b74920ed0ee272db53ec8c29824e7b..6abe3e9b1046361a55986724037bd8daf219b75f 100644
--- a/webkit/media/crypto/ppapi/cdm_wrapper.cc
+++ b/webkit/media/crypto/ppapi/cdm_wrapper.cc
@@ -90,7 +90,7 @@ class CdmWrapper : public pp::Instance,
// buffer resource, and returns it. Returns a an invalid PP_Resource with an
// ID of 0 on failure. Upon success, the returned Buffer resource has a
// reference count of 1.
- PP_Resource MakeBufferResource(const uint8_t* data, uint32_t data_size);
+ pp::Buffer_Dev MakeBufferResource(const uint8_t* data, uint32_t data_size);
// <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to
// <code>callback_factory_</code> to ensure that calls into
@@ -233,7 +233,6 @@ bool CdmWrapper::Decrypt(pp::Buffer_Dev encrypted_buffer,
status,
output_buffer,
encrypted_block_info.tracking_info));
-
return true;
}
@@ -243,18 +242,17 @@ bool CdmWrapper::DecryptAndDecode(
return false;
}
-PP_Resource CdmWrapper::MakeBufferResource(const uint8_t* data,
- uint32_t data_size) {
+pp::Buffer_Dev CdmWrapper::MakeBufferResource(const uint8_t* data,
+ uint32_t data_size) {
if (!data || !data_size)
- return 0;
+ return pp::Buffer_Dev();
pp::Buffer_Dev buffer(this, data_size);
if (!buffer.data())
- return 0;
+ return pp::Buffer_Dev();
memcpy(buffer.data(), data, data_size);
-
- return buffer.detach();
+ return buffer;
}
void CdmWrapper::KeyAdded(int32_t result, const std::string& session_id) {
@@ -296,7 +294,6 @@ void CdmWrapper::DeliverBlock(int32_t result,
const PP_DecryptTrackingInfo& tracking_info) {
pp::Buffer_Dev decrypted_buffer(MakeBufferResource(output_buffer.data,
output_buffer.data_size));
-
PP_DecryptedBlockInfo decrypted_block_info;
decrypted_block_info.tracking_info.request_id = tracking_info.request_id;
decrypted_block_info.tracking_info.timestamp = output_buffer.timestamp;
« no previous file with comments | « ppapi/proxy/ppp_content_decryptor_private_proxy.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698