| 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 |
| 11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 12 #include "v8/include/v8.h" | 12 #include "v8/include/v8.h" |
| 13 | 13 |
| 14 namespace gin { | 14 namespace gin { |
| 15 | 15 |
| 16 template<typename T> | 16 template<typename T, typename Enable = void> |
| 17 struct Converter {}; | 17 struct Converter {}; |
| 18 | 18 |
| 19 template<> | 19 template<> |
| 20 struct Converter<bool> { | 20 struct Converter<bool> { |
| 21 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, | 21 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, |
| 22 bool val); | 22 bool val); |
| 23 static bool FromV8(v8::Isolate* isolate, | 23 static bool FromV8(v8::Isolate* isolate, |
| 24 v8::Handle<v8::Value> val, | 24 v8::Handle<v8::Value> val, |
| 25 bool* out); | 25 bool* out); |
| 26 }; | 26 }; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 bool ConvertFromV8(v8::Isolate* isolate, v8::Handle<v8::Value> input, | 183 bool ConvertFromV8(v8::Isolate* isolate, v8::Handle<v8::Value> input, |
| 184 T* result) { | 184 T* result) { |
| 185 return Converter<T>::FromV8(isolate, input, result); | 185 return Converter<T>::FromV8(isolate, input, result); |
| 186 } | 186 } |
| 187 | 187 |
| 188 std::string V8ToString(v8::Handle<v8::Value> value); | 188 std::string V8ToString(v8::Handle<v8::Value> value); |
| 189 | 189 |
| 190 } // namespace gin | 190 } // namespace gin |
| 191 | 191 |
| 192 #endif // GIN_CONVERTER_H_ | 192 #endif // GIN_CONVERTER_H_ |
| OLD | NEW |