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

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: Remove includes from my debug runs... 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..66357b2af5623698ba7186a47b755ff1951bdf03 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -2195,24 +2195,27 @@ void PluginInstance::DeliverBlock(PP_Instance instance,
decrypt_cb.Run(media::Decryptor::kError, NULL);
return;
}
+
EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true);
+ if (enter.succeeded()) {
+ BufferAutoMapper mapper(enter.object());
+ if (!mapper.data() || !mapper.size()) {
+ decrypt_cb.Run(media::Decryptor::kError, NULL);
+ return;
+ }
- if (!enter.succeeded()) {
- decrypt_cb.Run(media::Decryptor::kError, NULL);
- return;
- }
- BufferAutoMapper mapper(enter.object());
- if (!mapper.data() || !mapper.size()) {
+ scoped_refptr<media::DecoderBuffer> decrypted_buffer(
+ media::DecoderBuffer::CopyFrom(
+ reinterpret_cast<const uint8*>(mapper.data()), mapper.size()));
+ decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds(
+ block_info->tracking_info.timestamp));
+ decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer);
+ } else {
decrypt_cb.Run(media::Decryptor::kError, NULL);
ddorwin 2012/09/05 08:44:44 Why aren't you returning early (if(!succeeded)) an
return;
}
- scoped_refptr<media::DecoderBuffer> decrypted_buffer(
- media::DecoderBuffer::CopyFrom(
- reinterpret_cast<const uint8*>(mapper.data()), mapper.size()));
- decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds(
- block_info->tracking_info.timestamp));
- decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer);
+ PluginModule::GetCore()->ReleaseResource(decrypted_block);
ddorwin 2012/09/05 08:44:44 Does the browser not always take ownership? What h
xhwang 2012/09/05 09:26:55 Agreed. Is there something like scoped_resource we
}
void PluginInstance::DeliverFrame(PP_Instance instance,
« webkit/media/crypto/ppapi/cdm_wrapper.cc ('K') | « webkit/media/crypto/ppapi/cdm_wrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698