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

Side by Side Diff: webkit/plugins/ppapi/npapi_glue.cc

Issue 16155009: Update webkit/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/npapi_glue.h" 5 #include "webkit/plugins/ppapi/npapi_glue.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "webkit/plugins/ppapi/host_array_buffer_var.h" 10 #include "webkit/plugins/ppapi/host_array_buffer_var.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return false; 60 return false;
61 } 61 }
62 const std::string& value = string->value(); 62 const std::string& value = string->value();
63 char* c_string = static_cast<char*>(malloc(value.size())); 63 char* c_string = static_cast<char*>(malloc(value.size()));
64 memcpy(c_string, value.data(), value.size()); 64 memcpy(c_string, value.data(), value.size());
65 STRINGN_TO_NPVARIANT(c_string, value.size(), *result); 65 STRINGN_TO_NPVARIANT(c_string, value.size(), *result);
66 break; 66 break;
67 } 67 }
68 case PP_VARTYPE_OBJECT: { 68 case PP_VARTYPE_OBJECT: {
69 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(var)); 69 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(var));
70 if (!object) { 70 if (!object.get()) {
71 VOID_TO_NPVARIANT(*result); 71 VOID_TO_NPVARIANT(*result);
72 return false; 72 return false;
73 } 73 }
74 OBJECT_TO_NPVARIANT(WebBindings::retainObject(object->np_object()), 74 OBJECT_TO_NPVARIANT(WebBindings::retainObject(object->np_object()),
75 *result); 75 *result);
76 break; 76 break;
77 } 77 }
78 // The following types are not supported for use with PPB_Var_Deprecated, 78 // The following types are not supported for use with PPB_Var_Deprecated,
79 // because PPB_Var_Deprecated is only for trusted plugins, and the trusted 79 // because PPB_Var_Deprecated is only for trusted plugins, and the trusted
80 // plugins we have don't need these types. We can add support in the future 80 // plugins we have don't need these types. We can add support in the future
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // same array buffer? It's probably not worth the trouble, since it will only 144 // same array buffer? It's probably not worth the trouble, since it will only
145 // affect in-process plugins. 145 // affect in-process plugins.
146 if (WebBindings::getArrayBuffer(object, &buffer)) { 146 if (WebBindings::getArrayBuffer(object, &buffer)) {
147 scoped_refptr<HostArrayBufferVar> buffer_var( 147 scoped_refptr<HostArrayBufferVar> buffer_var(
148 new HostArrayBufferVar(buffer)); 148 new HostArrayBufferVar(buffer));
149 return buffer_var->GetPPVar(); 149 return buffer_var->GetPPVar();
150 } 150 }
151 scoped_refptr<NPObjectVar> object_var( 151 scoped_refptr<NPObjectVar> object_var(
152 HostGlobals::Get()->host_var_tracker()->NPObjectVarForNPObject( 152 HostGlobals::Get()->host_var_tracker()->NPObjectVarForNPObject(
153 instance->pp_instance(), object)); 153 instance->pp_instance(), object));
154 if (!object_var) { // No object for this module yet, make a new one. 154 if (!object_var.get()) { // No object for this module yet, make a new one.
155 object_var = new NPObjectVar(instance->pp_instance(), object); 155 object_var = new NPObjectVar(instance->pp_instance(), object);
156 } 156 }
157 return object_var->GetPPVar(); 157 return object_var->GetPPVar();
158 } 158 }
159 159
160 // PPResultAndExceptionToNPResult ---------------------------------------------- 160 // PPResultAndExceptionToNPResult ----------------------------------------------
161 161
162 PPResultAndExceptionToNPResult::PPResultAndExceptionToNPResult( 162 PPResultAndExceptionToNPResult::PPResultAndExceptionToNPResult(
163 NPObject* object_var, 163 NPObject* object_var,
164 NPVariant* np_result) 164 NPVariant* np_result)
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 } 308 }
309 309
310 // static 310 // static
311 void TryCatch::Catch(void* self, const char* message) { 311 void TryCatch::Catch(void* self, const char* message) {
312 static_cast<TryCatch*>(self)->SetException(message); 312 static_cast<TryCatch*>(self)->SetException(message);
313 } 313 }
314 314
315 } // namespace ppapi 315 } // namespace ppapi
316 } // namespace webkit 316 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/content_decryptor_delegate.cc ('k') | webkit/plugins/ppapi/npobject_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698