OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 ToV8ForCore_h | 5 #ifndef ToV8ForCore_h |
6 #define ToV8ForCore_h | 6 #define ToV8ForCore_h |
7 | 7 |
8 // ToV8() provides C++ -> V8 conversion. Note that ToV8() can return an empty | 8 // ToV8() provides C++ -> V8 conversion. Note that ToV8() can return an empty |
9 // handle. Call sites must check IsEmpty() before using return value. | 9 // handle. Call sites must check IsEmpty() before using return value. |
10 | 10 |
11 #include "bindings/core/v8/ToV8.h" | 11 #include "bindings/core/v8/ToV8.h" |
12 #include "core/dom/ArrayBufferViewHelpers.h" | 12 #include "core/dom/ArrayBufferViewHelpers.h" |
| 13 #include "core/dom/Node.h" |
13 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 class Dictionary; | 18 class Dictionary; |
| 19 class DOMWindow; |
| 20 class EventTarget; |
| 21 |
| 22 CORE_EXPORT v8::Local<v8::Value> ToV8(DOMWindow*, |
| 23 v8::Local<v8::Object> creation_context, |
| 24 v8::Isolate*); |
| 25 CORE_EXPORT v8::Local<v8::Value> ToV8(EventTarget*, |
| 26 v8::Local<v8::Object> creation_context, |
| 27 v8::Isolate*); |
| 28 inline v8::Local<v8::Value> ToV8(Node* node, |
| 29 v8::Local<v8::Object> creation_context, |
| 30 v8::Isolate* isolate) { |
| 31 return ToV8(static_cast<ScriptWrappable*>(node), creation_context, isolate); |
| 32 } |
18 | 33 |
19 inline v8::Local<v8::Value> ToV8(const Dictionary& value, | 34 inline v8::Local<v8::Value> ToV8(const Dictionary& value, |
20 v8::Local<v8::Object> creation_context, | 35 v8::Local<v8::Object> creation_context, |
21 v8::Isolate* isolate) { | 36 v8::Isolate* isolate) { |
22 NOTREACHED(); | 37 NOTREACHED(); |
23 return v8::Undefined(isolate); | 38 return v8::Undefined(isolate); |
24 } | 39 } |
25 | 40 |
26 template <typename T> | 41 template <typename T> |
27 inline v8::Local<v8::Value> ToV8(NotShared<T> value, | 42 inline v8::Local<v8::Value> ToV8(NotShared<T> value, |
28 v8::Local<v8::Object> creation_context, | 43 v8::Local<v8::Object> creation_context, |
29 v8::Isolate* isolate) { | 44 v8::Isolate* isolate) { |
30 return ToV8(value.View(), creation_context, isolate); | 45 return ToV8(value.View(), creation_context, isolate); |
31 } | 46 } |
32 | 47 |
33 } // namespace blink | 48 } // namespace blink |
34 | 49 |
35 #endif // ToV8ForCore_h | 50 #endif // ToV8ForCore_h |
OLD | NEW |