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

Side by Side Diff: gin/converter.h

Issue 179803007: Refactors parts of gin: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix gin_shell Created 6 years, 9 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 | « no previous file | gin/gin.gyp » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef GIN_CONVERTER_H_ 5 #ifndef GIN_CONVERTER_H_
6 #define GIN_CONVERTER_H_ 6 #define GIN_CONVERTER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 result.push_back(item); 169 result.push_back(item);
170 } 170 }
171 171
172 out->swap(result); 172 out->swap(result);
173 return true; 173 return true;
174 } 174 }
175 }; 175 };
176 176
177 // Convenience functions that deduce T. 177 // Convenience functions that deduce T.
178 template<typename T> 178 template<typename T>
179 v8::Handle<v8::Value> ConvertToV8(v8::Isolate* isolate, 179 v8::Handle<v8::Value> ConvertToV8(v8::Isolate* isolate, T input) {
180 T input) {
181 return Converter<T>::ToV8(isolate, input); 180 return Converter<T>::ToV8(isolate, input);
182 } 181 }
183 182
184 GIN_EXPORT inline v8::Handle<v8::String> StringToV8( 183 GIN_EXPORT inline v8::Handle<v8::String> StringToV8(
185 v8::Isolate* isolate, 184 v8::Isolate* isolate,
186 const base::StringPiece& input) { 185 const base::StringPiece& input) {
187 return ConvertToV8(isolate, input).As<v8::String>(); 186 return ConvertToV8(isolate, input).As<v8::String>();
188 } 187 }
189 188
190 GIN_EXPORT v8::Handle<v8::String> StringToSymbol(v8::Isolate* isolate, 189 GIN_EXPORT v8::Handle<v8::String> StringToSymbol(v8::Isolate* isolate,
191 const base::StringPiece& val); 190 const base::StringPiece& val);
192 191
193 template<typename T> 192 template<typename T>
194 bool ConvertFromV8(v8::Isolate* isolate, v8::Handle<v8::Value> input, 193 bool ConvertFromV8(v8::Isolate* isolate, v8::Handle<v8::Value> input,
195 T* result) { 194 T* result) {
196 return Converter<T>::FromV8(isolate, input, result); 195 return Converter<T>::FromV8(isolate, input, result);
197 } 196 }
198 197
199 GIN_EXPORT std::string V8ToString(v8::Handle<v8::Value> value); 198 GIN_EXPORT std::string V8ToString(v8::Handle<v8::Value> value);
200 199
201 } // namespace gin 200 } // namespace gin
202 201
203 #endif // GIN_CONVERTER_H_ 202 #endif // GIN_CONVERTER_H_
OLDNEW
« no previous file with comments | « no previous file | gin/gin.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698