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

Side by Side Diff: ppapi/cpp/private/content_decryptor_private.cc

Issue 10909068: Fix resource leaks in CDM implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updates per last set of 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
« no previous file with comments | « ppapi/cpp/dev/buffer_dev.cc ('k') | ppapi/proxy/ppp_content_decryptor_private_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/cpp/private/content_decryptor_private.h" 5 #include "ppapi/cpp/private/content_decryptor_private.h"
6 6
7 #include <cstring> // memcpy 7 #include <cstring> // memcpy
8 8
9 #include "ppapi/c/ppb_var.h" 9 #include "ppapi/c/ppb_var.h"
10 #include "ppapi/c/private/ppb_content_decryptor_private.h" 10 #include "ppapi/c/private/ppb_content_decryptor_private.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 95
96 PP_Bool Decrypt(PP_Instance instance, 96 PP_Bool Decrypt(PP_Instance instance,
97 PP_Resource encrypted_resource, 97 PP_Resource encrypted_resource,
98 const PP_EncryptedBlockInfo* encrypted_block_info) { 98 const PP_EncryptedBlockInfo* encrypted_block_info) {
99 void* object = 99 void* object =
100 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); 100 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
101 if (!object) 101 if (!object)
102 return PP_FALSE; 102 return PP_FALSE;
103 103
104 pp::Buffer_Dev encrypted_block(encrypted_resource); 104 pp::Buffer_Dev encrypted_block(pp::PassRef(), encrypted_resource);
105 105
106 return PP_FromBool( 106 return PP_FromBool(
107 static_cast<ContentDecryptor_Private*>(object)->Decrypt( 107 static_cast<ContentDecryptor_Private*>(object)->Decrypt(
108 encrypted_block, 108 encrypted_block,
109 *encrypted_block_info)); 109 *encrypted_block_info));
110 } 110 }
111 111
112 PP_Bool DecryptAndDecode(PP_Instance instance, 112 PP_Bool DecryptAndDecode(PP_Instance instance,
113 PP_Resource encrypted_resource, 113 PP_Resource encrypted_resource,
114 const PP_EncryptedBlockInfo* encrypted_block_info) { 114 const PP_EncryptedBlockInfo* encrypted_block_info) {
115 void* object = 115 void* object =
116 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); 116 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
117 if (!object) 117 if (!object)
118 return PP_FALSE; 118 return PP_FALSE;
119 119
120 pp::Buffer_Dev encrypted_block(encrypted_resource); 120 pp::Buffer_Dev encrypted_block(pp::PassRef(), encrypted_resource);
121 121
122 return PP_FromBool( 122 return PP_FromBool(
123 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode( 123 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode(
124 encrypted_block, 124 encrypted_block,
125 *encrypted_block_info)); 125 *encrypted_block_info));
126 } 126 }
127 127
128 const PPP_ContentDecryptor_Private ppp_content_decryptor = { 128 const PPP_ContentDecryptor_Private ppp_content_decryptor = {
129 &GenerateKeyRequest, 129 &GenerateKeyRequest,
130 &AddKey, 130 &AddKey,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const PP_DecryptedBlockInfo& decrypted_block_info) { 240 const PP_DecryptedBlockInfo& decrypted_block_info) {
241 if (has_interface<PPB_ContentDecryptor_Private>()) { 241 if (has_interface<PPB_ContentDecryptor_Private>()) {
242 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( 242 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples(
243 associated_instance_.pp_instance(), 243 associated_instance_.pp_instance(),
244 decrypted_samples.pp_resource(), 244 decrypted_samples.pp_resource(),
245 &decrypted_block_info); 245 &decrypted_block_info);
246 } 246 }
247 } 247 }
248 248
249 } // namespace pp 249 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/buffer_dev.cc ('k') | ppapi/proxy/ppp_content_decryptor_private_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698