OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 ToV8ForModules_h | 5 #ifndef ToV8ForModules_h |
6 #define ToV8ForModules_h | 6 #define ToV8ForModules_h |
7 | 7 |
8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 #include "modules/webdatabase/sqlite/SQLValue.h" | 10 #include "modules/webdatabase/sqlite/SQLValue.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class IDBAny; | 14 class IDBAny; |
15 class IDBKey; | 15 class IDBKey; |
16 class IDBKeyPath; | 16 class IDBKeyPath; |
17 | 17 |
18 inline v8::Local<v8::Value> ToV8(const SQLValue& sql_value, | 18 inline v8::Local<v8::Value> ToV8(const SQLValue& sql_value, |
19 v8::Local<v8::Object> creation_context, | 19 v8::Local<v8::Object> creation_context, |
20 v8::Isolate* isolate) { | 20 v8::Isolate* isolate) { |
21 switch (sql_value.GetType()) { | 21 switch (sql_value.GetType()) { |
22 case SQLValue::kNullValue: | 22 case SQLValue::kNullValue: |
23 return v8::Null(isolate); | 23 return v8::Null(isolate); |
24 case SQLValue::kNumberValue: | 24 case SQLValue::kNumberValue: |
25 return v8::Number::New(isolate, sql_value.Number()); | 25 return v8::Number::New(isolate, sql_value.Number()); |
26 case SQLValue::kStringValue: | 26 case SQLValue::kStringValue: |
27 return V8String(isolate, sql_value.GetString()); | 27 return V8String(isolate, sql_value.GetString()); |
28 } | 28 } |
29 ASSERT_NOT_REACHED(); | 29 NOTREACHED(); |
30 return v8::Local<v8::Value>(); | 30 return v8::Local<v8::Value>(); |
31 } | 31 } |
32 | 32 |
33 v8::Local<v8::Value> ToV8(const IDBKeyPath&, | 33 v8::Local<v8::Value> ToV8(const IDBKeyPath&, |
34 v8::Local<v8::Object> creation_context, | 34 v8::Local<v8::Object> creation_context, |
35 v8::Isolate*); | 35 v8::Isolate*); |
36 MODULES_EXPORT v8::Local<v8::Value> ToV8(const IDBKey*, | 36 MODULES_EXPORT v8::Local<v8::Value> ToV8(const IDBKey*, |
37 v8::Local<v8::Object> creation_context, | 37 v8::Local<v8::Object> creation_context, |
38 v8::Isolate*); | 38 v8::Isolate*); |
39 v8::Local<v8::Value> ToV8(const IDBAny*, | 39 v8::Local<v8::Value> ToV8(const IDBAny*, |
40 v8::Local<v8::Object> creation_context, | 40 v8::Local<v8::Object> creation_context, |
41 v8::Isolate*); | 41 v8::Isolate*); |
42 | 42 |
43 } // namespace blink | 43 } // namespace blink |
44 | 44 |
45 #endif // ToV8ForModules_h | 45 #endif // ToV8ForModules_h |
OLD | NEW |