summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authortomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 08:31:29 +0000
committertomfinegan@chromium.org <tomfinegan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-06 08:31:29 +0000
commite2e1780fdad1e978712607ac987748ab1ddfd616 (patch)
tree413483e818a19d721dfed5c25505d6367920a433 /webkit/plugins
parente4f159014d36bb7ec346118ffd9f6c2447433801 (diff)
downloadchromium_src-e2e1780fdad1e978712607ac987748ab1ddfd616.zip
chromium_src-e2e1780fdad1e978712607ac987748ab1ddfd616.tar.gz
chromium_src-e2e1780fdad1e978712607ac987748ab1ddfd616.tar.bz2
Fix resource leaks in CDM implementation.
Two fixes: 1) Add a PassRef constructor to pp::Buffer_Dev to deal with reference counting issues related to passing PP_Resources across the IPC proxy, and use it to avoid adding unnecessary references on PP_Resources. 2) Use the PassRef ScopedPPResource contructor in PluginInstance::Decrypt to avoid added an unnecessary reference on the buffer resource before it's passed to the plugin interface code. BUG=146200 TEST=PPB_Testing_Dev::GetLiveObjectsForInstance shows a stable live object count. Review URL: https://chromiumcodereview.appspot.com/10909068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155145 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 30dc9379..b80f0ff 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -1506,6 +1506,7 @@ bool PluginInstance::Decrypt(
return false;
ScopedPPResource encrypted_resource(
+ ScopedPPResource::PassRef(),
MakeBufferResource(pp_instance(),
encrypted_buffer->GetData(),
encrypted_buffer->GetDataSize()));
@@ -2235,10 +2236,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;
@@ -2252,8 +2251,8 @@ void PluginInstance::DeliverBlock(PP_Instance instance,
decrypt_cb.Run(media::Decryptor::kError, NULL);
return;
}
- EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true);
+ EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true);
if (!enter.succeeded()) {
decrypt_cb.Run(media::Decryptor::kError, NULL);
return;
@@ -2264,6 +2263,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()));