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

Side by Side Diff: ppapi/proxy/ppp_content_decryptor_private_proxy.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h" 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h"
6 6
7 #include "base/platform_file.h" 7 #include "base/platform_file.h"
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/ppb_core.h" 9 #include "ppapi/c/ppb_core.h"
10 #include "ppapi/proxy/content_decryptor_private_serializer.h" 10 #include "ppapi/proxy/content_decryptor_private_serializer.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 NOTREACHED(); 133 NOTREACHED();
134 return PP_FALSE; 134 return PP_FALSE;
135 } 135 }
136 const PPB_Core* core = static_cast<const PPB_Core*>( 136 const PPB_Core* core = static_cast<const PPB_Core*>(
137 dispatcher->local_get_interface()(PPB_CORE_INTERFACE)); 137 dispatcher->local_get_interface()(PPB_CORE_INTERFACE));
138 if (!core) { 138 if (!core) {
139 NOTREACHED(); 139 NOTREACHED();
140 return PP_FALSE; 140 return PP_FALSE;
141 } 141 }
142 142
143 // We need to take a ref on the resource now. The browser may drop
144 // references once we return from here, but we're sending an asynchronous
145 // message. The plugin side takes ownership of that reference.
146 core->AddRefResource(encrypted_block);
dmichael (off chromium) 2012/09/05 18:08:37 Okay, I think I had it wrong before. I was right t
Tom Finegan 2012/09/05 19:21:43 Done.
147
148 HostResource host_resource; 143 HostResource host_resource;
149 host_resource.SetHostResource(instance, encrypted_block); 144 host_resource.SetHostResource(instance, encrypted_block);
150 145
151 uint32_t size = 0; 146 uint32_t size = 0;
152 if (DescribeHostBufferResource(encrypted_block, &size) == PP_FALSE) 147 if (DescribeHostBufferResource(encrypted_block, &size) == PP_FALSE)
153 return PP_FALSE; 148 return PP_FALSE;
154 149
155 base::SharedMemoryHandle handle; 150 base::SharedMemoryHandle handle;
156 if (ShareHostBufferResourceToPlugin(dispatcher, 151 if (ShareHostBufferResourceToPlugin(dispatcher,
157 encrypted_block, 152 encrypted_block,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return; 332 return;
338 CallWhileUnlocked(ppp_decryptor_impl_->DecryptAndDecode, 333 CallWhileUnlocked(ppp_decryptor_impl_->DecryptAndDecode,
339 instance, 334 instance,
340 plugin_resource, 335 plugin_resource,
341 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); 336 const_cast<const PP_EncryptedBlockInfo*>(&block_info));
342 } 337 }
343 } 338 }
344 339
345 } // namespace proxy 340 } // namespace proxy
346 } // namespace ppapi 341 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | webkit/media/crypto/ppapi/cdm_wrapper.cc » ('j') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698