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

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: Address ddorwin'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..962851ff43c8d3c9f990508d532a8f2b83c54373 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -2178,25 +2178,27 @@ 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;
pending_decryption_cbs_.erase(found);
if (block_info->result == PP_DECRYPTRESULT_DECRYPT_NOKEY) {
+ DCHECK(decrypted_block == 0);
dmichael (off chromium) 2012/09/05 17:13:06 Don't we get here via a call from the CDM plugin?
Tom Finegan 2012/09/05 19:21:43 Done.
ddorwin 2012/09/06 08:39:01 I suggested this. My concern was that we might lea
decrypt_cb.Run(media::Decryptor::kNoKey, NULL);
return;
}
if (block_info->result != PP_DECRYPTRESULT_SUCCESS) {
+ DCHECK(decrypted_block == 0);
decrypt_cb.Run(media::Decryptor::kError, NULL);
return;
}
- EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true);
+ ScopedPPResource decrypted_block_scoped(ScopedPPResource::PassRef(),
+ decrypted_block);
dmichael (off chromium) 2012/09/05 17:13:06 Why is this necessary? The plugin isn't passing us
Tom Finegan 2012/09/05 19:21:43 The resource passed back from the plugin has a ref
+ EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true);
if (!enter.succeeded()) {
decrypt_cb.Run(media::Decryptor::kError, NULL);
return;
@@ -2207,6 +2209,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