OLD | NEW |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 StringVar* StringVar::AsStringVar() { | 130 StringVar* StringVar::AsStringVar() { |
131 return this; | 131 return this; |
132 } | 132 } |
133 | 133 |
134 PP_VarType StringVar::GetType() const { | 134 PP_VarType StringVar::GetType() const { |
135 return PP_VARTYPE_STRING; | 135 return PP_VARTYPE_STRING; |
136 } | 136 } |
137 | 137 |
138 // static | 138 // static |
139 PP_Var StringVar::StringToPPVar(const std::string& var) { | 139 PP_Var StringVar::StringToPPVar(const std::string& var) { |
140 return StringToPPVar(var.c_str(), var.size()); | 140 return StringToPPVar(var.c_str(), static_cast<uint32>(var.size())); |
141 } | 141 } |
142 | 142 |
143 // static | 143 // static |
144 PP_Var StringVar::StringToPPVar(const char* data, uint32 len) { | 144 PP_Var StringVar::StringToPPVar(const char* data, uint32 len) { |
145 scoped_refptr<StringVar> str(new StringVar(data, len)); | 145 scoped_refptr<StringVar> str(new StringVar(data, len)); |
146 if (!str || !IsStringUTF8(str->value())) | 146 if (!str || !IsStringUTF8(str->value())) |
147 return PP_MakeNull(); | 147 return PP_MakeNull(); |
148 return str->GetPPVar(); | 148 return str->GetPPVar(); |
149 } | 149 } |
150 | 150 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 return NULL; | 188 return NULL; |
189 scoped_refptr<Var> var_object( | 189 scoped_refptr<Var> var_object( |
190 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); | 190 PpapiGlobals::Get()->GetVarTracker()->GetVar(var)); |
191 if (!var_object) | 191 if (!var_object) |
192 return NULL; | 192 return NULL; |
193 return var_object->AsArrayBufferVar(); | 193 return var_object->AsArrayBufferVar(); |
194 } | 194 } |
195 | 195 |
196 } // namespace ppapi | 196 } // namespace ppapi |
197 | 197 |
OLD | NEW |