OLD | NEW |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 struct GIN_EXPORT Converter<uint64_t> { | 58 struct GIN_EXPORT Converter<uint64_t> { |
59 // Warning: JavaScript cannot represent 64 integers precisely. | 59 // Warning: JavaScript cannot represent 64 integers precisely. |
60 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, | 60 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, |
61 uint64_t val); | 61 uint64_t val); |
62 static bool FromV8(v8::Isolate* isolate, | 62 static bool FromV8(v8::Isolate* isolate, |
63 v8::Handle<v8::Value> val, | 63 v8::Handle<v8::Value> val, |
64 uint64_t* out); | 64 uint64_t* out); |
65 }; | 65 }; |
66 | 66 |
67 template<> | 67 template<> |
| 68 struct GIN_EXPORT Converter<float> { |
| 69 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, |
| 70 float val); |
| 71 static bool FromV8(v8::Isolate* isolate, |
| 72 v8::Handle<v8::Value> val, |
| 73 float* out); |
| 74 }; |
| 75 |
| 76 template<> |
68 struct GIN_EXPORT Converter<double> { | 77 struct GIN_EXPORT Converter<double> { |
69 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, | 78 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, |
70 double val); | 79 double val); |
71 static bool FromV8(v8::Isolate* isolate, | 80 static bool FromV8(v8::Isolate* isolate, |
72 v8::Handle<v8::Value> val, | 81 v8::Handle<v8::Value> val, |
73 double* out); | 82 double* out); |
74 }; | 83 }; |
75 | 84 |
76 template<> | 85 template<> |
77 struct GIN_EXPORT Converter<base::StringPiece> { | 86 struct GIN_EXPORT Converter<base::StringPiece> { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 bool ConvertFromV8(v8::Isolate* isolate, v8::Handle<v8::Value> input, | 194 bool ConvertFromV8(v8::Isolate* isolate, v8::Handle<v8::Value> input, |
186 T* result) { | 195 T* result) { |
187 return Converter<T>::FromV8(isolate, input, result); | 196 return Converter<T>::FromV8(isolate, input, result); |
188 } | 197 } |
189 | 198 |
190 GIN_EXPORT std::string V8ToString(v8::Handle<v8::Value> value); | 199 GIN_EXPORT std::string V8ToString(v8::Handle<v8::Value> value); |
191 | 200 |
192 } // namespace gin | 201 } // namespace gin |
193 | 202 |
194 #endif // GIN_CONVERTER_H_ | 203 #endif // GIN_CONVERTER_H_ |
OLD | NEW |