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

Side by Side Diff: ppapi/shared_impl/var.cc

Issue 15806016: Update ppapi/ 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
« no previous file with comments | « ppapi/shared_impl/tracked_callback.cc ('k') | ppapi/shared_impl/var_tracker.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/shared_impl/var.h" 5 #include "ppapi/shared_impl/var.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 151
152 // static 152 // static
153 PP_Var StringVar::StringToPPVar(const std::string& var) { 153 PP_Var StringVar::StringToPPVar(const std::string& var) {
154 return StringToPPVar(var.c_str(), static_cast<uint32>(var.size())); 154 return StringToPPVar(var.c_str(), static_cast<uint32>(var.size()));
155 } 155 }
156 156
157 // static 157 // static
158 PP_Var StringVar::StringToPPVar(const char* data, uint32 len) { 158 PP_Var StringVar::StringToPPVar(const char* data, uint32 len) {
159 scoped_refptr<StringVar> str(new StringVar(data, len)); 159 scoped_refptr<StringVar> str(new StringVar(data, len));
160 if (!str || !IsStringUTF8(str->value())) 160 if (!str.get() || !IsStringUTF8(str->value()))
161 return PP_MakeNull(); 161 return PP_MakeNull();
162 return str->GetPPVar(); 162 return str->GetPPVar();
163 } 163 }
164 164
165 // static 165 // static
166 StringVar* StringVar::FromPPVar(PP_Var var) { 166 StringVar* StringVar::FromPPVar(PP_Var var) {
167 if (var.type != PP_VARTYPE_STRING) 167 if (var.type != PP_VARTYPE_STRING)
168 return NULL; 168 return NULL;
169 scoped_refptr<Var> var_object( 169 scoped_refptr<Var> var_object(
170 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 170 PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
171 if (!var_object) 171 if (!var_object.get())
172 return NULL; 172 return NULL;
173 return var_object->AsStringVar(); 173 return var_object->AsStringVar();
174 } 174 }
175 175
176 // static 176 // static
177 PP_Var StringVar::SwapValidatedUTF8StringIntoPPVar(std::string* src) { 177 PP_Var StringVar::SwapValidatedUTF8StringIntoPPVar(std::string* src) {
178 scoped_refptr<StringVar> str(new StringVar); 178 scoped_refptr<StringVar> str(new StringVar);
179 str->value_.swap(*src); 179 str->value_.swap(*src);
180 return str->GetPPVar(); 180 return str->GetPPVar();
181 } 181 }
(...skipping 13 matching lines...) Expand all
195 PP_VarType ArrayBufferVar::GetType() const { 195 PP_VarType ArrayBufferVar::GetType() const {
196 return PP_VARTYPE_ARRAY_BUFFER; 196 return PP_VARTYPE_ARRAY_BUFFER;
197 } 197 }
198 198
199 // static 199 // static
200 ArrayBufferVar* ArrayBufferVar::FromPPVar(PP_Var var) { 200 ArrayBufferVar* ArrayBufferVar::FromPPVar(PP_Var var) {
201 if (var.type != PP_VARTYPE_ARRAY_BUFFER) 201 if (var.type != PP_VARTYPE_ARRAY_BUFFER)
202 return NULL; 202 return NULL;
203 scoped_refptr<Var> var_object( 203 scoped_refptr<Var> var_object(
204 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); 204 PpapiGlobals::Get()->GetVarTracker()->GetVar(var));
205 if (!var_object) 205 if (!var_object.get())
206 return NULL; 206 return NULL;
207 return var_object->AsArrayBufferVar(); 207 return var_object->AsArrayBufferVar();
208 } 208 }
209 209
210 } // namespace ppapi 210 } // namespace ppapi
211 211
OLDNEW
« no previous file with comments | « ppapi/shared_impl/tracked_callback.cc ('k') | ppapi/shared_impl/var_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698