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

Side by Side Diff: webkit/plugins/ppapi/ppb_var_deprecated_impl.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) 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 "webkit/plugins/ppapi/ppb_var_deprecated_impl.h" 5 #include "webkit/plugins/ppapi/ppb_var_deprecated_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ppapi/c/dev/ppb_var_deprecated.h" 9 #include "ppapi/c/dev/ppb_var_deprecated.h"
10 #include "ppapi/c/ppb_var.h" 10 #include "ppapi/c/ppb_var.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (!string) { 74 if (!string) {
75 VOID_TO_NPVARIANT(*result); 75 VOID_TO_NPVARIANT(*result);
76 return false; 76 return false;
77 } 77 }
78 const std::string& value = string->value(); 78 const std::string& value = string->value();
79 STRINGN_TO_NPVARIANT(value.c_str(), value.size(), *result); 79 STRINGN_TO_NPVARIANT(value.c_str(), value.size(), *result);
80 break; 80 break;
81 } 81 }
82 case PP_VARTYPE_OBJECT: { 82 case PP_VARTYPE_OBJECT: {
83 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(var)); 83 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(var));
84 if (!object) { 84 if (!object.get()) {
85 VOID_TO_NPVARIANT(*result); 85 VOID_TO_NPVARIANT(*result);
86 return false; 86 return false;
87 } 87 }
88 OBJECT_TO_NPVARIANT(object->np_object(), *result); 88 OBJECT_TO_NPVARIANT(object->np_object(), *result);
89 break; 89 break;
90 } 90 }
91 default: 91 default:
92 VOID_TO_NPVARIANT(*result); 92 VOID_TO_NPVARIANT(*result);
93 return false; 93 return false;
94 } 94 }
(...skipping 10 matching lines...) Expand all
105 // an exception if it's invalid. At the end of construction, if there is no 105 // an exception if it's invalid. At the end of construction, if there is no
106 // exception, you know that there is no previously set exception, that the 106 // exception, you know that there is no previously set exception, that the
107 // object passed in is valid and ready to use (via the object() getter), and 107 // object passed in is valid and ready to use (via the object() getter), and
108 // that the TryCatch's pp_module() getter is also set up properly and ready to 108 // that the TryCatch's pp_module() getter is also set up properly and ready to
109 // use. 109 // use.
110 class ObjectAccessorTryCatch : public TryCatch { 110 class ObjectAccessorTryCatch : public TryCatch {
111 public: 111 public:
112 ObjectAccessorTryCatch(PP_Var object, PP_Var* exception) 112 ObjectAccessorTryCatch(PP_Var object, PP_Var* exception)
113 : TryCatch(exception), 113 : TryCatch(exception),
114 object_(NPObjectVar::FromPPVar(object)) { 114 object_(NPObjectVar::FromPPVar(object)) {
115 if (!object_) { 115 if (!object_.get()) {
116 SetException(kInvalidObjectException); 116 SetException(kInvalidObjectException);
117 } 117 }
118 } 118 }
119 119
120 NPObjectVar* object() { return object_.get(); } 120 NPObjectVar* object() { return object_.get(); }
121 121
122 PluginInstance* GetPluginInstance() { 122 PluginInstance* GetPluginInstance() {
123 return HostGlobals::Get()->GetInstance(object()->pp_instance()); 123 return HostGlobals::Get()->GetInstance(object()->pp_instance());
124 } 124 }
125 125
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 372
373 PP_Var ret = NPVariantToPPVar(accessor.GetPluginInstance(), &result); 373 PP_Var ret = NPVariantToPPVar(accessor.GetPluginInstance(), &result);
374 WebBindings::releaseVariantValue(&result); 374 WebBindings::releaseVariantValue(&result);
375 return ret; 375 return ret;
376 } 376 }
377 377
378 bool IsInstanceOfDeprecated(PP_Var var, 378 bool IsInstanceOfDeprecated(PP_Var var,
379 const PPP_Class_Deprecated* ppp_class, 379 const PPP_Class_Deprecated* ppp_class,
380 void** ppp_class_data) { 380 void** ppp_class_data) {
381 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(var)); 381 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(var));
382 if (!object) 382 if (!object.get())
383 return false; // Not an object at all. 383 return false; // Not an object at all.
384 384
385 return PluginObject::IsInstanceOf(object->np_object(), 385 return PluginObject::IsInstanceOf(object->np_object(),
386 ppp_class, ppp_class_data); 386 ppp_class, ppp_class_data);
387 } 387 }
388 388
389 PP_Var CreateObjectDeprecated(PP_Instance pp_instance, 389 PP_Var CreateObjectDeprecated(PP_Instance pp_instance,
390 const PPP_Class_Deprecated* ppp_class, 390 const PPP_Class_Deprecated* ppp_class,
391 void* ppp_class_data) { 391 void* ppp_class_data) {
392 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance); 392 PluginInstance* instance = HostGlobals::Get()->GetInstance(pp_instance);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 &CreateObjectDeprecated, 428 &CreateObjectDeprecated,
429 &CreateObjectWithModuleDeprecated, 429 &CreateObjectWithModuleDeprecated,
430 }; 430 };
431 431
432 return &var_deprecated_interface; 432 return &var_deprecated_interface;
433 } 433 }
434 434
435 } // namespace ppapi 435 } // namespace ppapi
436 } // namespace webkit 436 } // namespace webkit
437 437
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_file_ref_impl.cc ('k') | webkit/plugins/ppapi/url_request_info_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698