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

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10909068: Fix resource leaks in CDM implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work done per dmichael's 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
Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 66940e831b73866c0cdccee620dd2e5427b20599..751f78c5b22f4203e0e1da62863de8568cd50678 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -2178,10 +2178,8 @@ void PluginInstance::DeliverBlock(PP_Instance instance,
PP_Resource decrypted_block,
const PP_DecryptedBlockInfo* block_info) {
DCHECK(block_info);
-
DecryptionCBMap::iterator found = pending_decryption_cbs_.find(
block_info->tracking_info.request_id);
-
if (found == pending_decryption_cbs_.end())
return;
media::Decryptor::DecryptCB decrypt_cb = found->second;
@@ -2195,8 +2193,10 @@ void PluginInstance::DeliverBlock(PP_Instance instance,
decrypt_cb.Run(media::Decryptor::kError, NULL);
return;
}
- EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true);
+ ScopedPPResource decrypted_block_scoped(ScopedPPResource::PassRef(),
+ decrypted_block);
+ EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true);
if (!enter.succeeded()) {
decrypt_cb.Run(media::Decryptor::kError, NULL);
return;
@@ -2207,6 +2207,8 @@ void PluginInstance::DeliverBlock(PP_Instance instance,
return;
}
+ // TODO(tomfinegan): Find a way to take ownership of the shared memory
+ // managed by the PPB_Buffer_Dev, and avoid the extra copy.
scoped_refptr<media::DecoderBuffer> decrypted_buffer(
media::DecoderBuffer::CopyFrom(
reinterpret_cast<const uint8*>(mapper.data()), mapper.size()));

Powered by Google App Engine
This is Rietveld 408576698