OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
6 | 6 |
7 #ifndef V8TestInterface_h | 7 #ifndef V8TestInterface_h |
8 #define V8TestInterface_h | 8 #define V8TestInterface_h |
9 | 9 |
10 #if ENABLE(CONDITION) | 10 #if ENABLE(Condition1) || ENABLE(Condition2) |
11 #include "V8TestInterfaceEmpty.h" | 11 #include "bindings/tests/idls/TestInterface.h" |
12 #include "bindings/tests/idls/TestInterfaceImplementation.h" | |
13 #include "bindings/v8/V8Binding.h" | 12 #include "bindings/v8/V8Binding.h" |
14 #include "bindings/v8/V8DOMWrapper.h" | 13 #include "bindings/v8/V8DOMWrapper.h" |
15 #include "bindings/v8/WrapperTypeInfo.h" | 14 #include "bindings/v8/WrapperTypeInfo.h" |
16 #include "heap/Handle.h" | 15 #include "heap/Handle.h" |
17 | 16 |
18 namespace WebCore { | 17 namespace WebCore { |
19 | 18 |
20 class V8TestInterface { | 19 class V8TestInterface { |
21 public: | 20 public: |
22 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); | 21 static bool hasInstance(v8::Handle<v8::Value>, v8::Isolate*); |
23 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va
lue>, v8::Isolate*); | 22 static v8::Handle<v8::Object> findInstanceInPrototypeChain(v8::Handle<v8::Va
lue>, v8::Isolate*); |
24 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); | 23 static v8::Handle<v8::FunctionTemplate> domTemplate(v8::Isolate*); |
25 static TestInterfaceImplementation* toNative(v8::Handle<v8::Object> object) | 24 static TestInterface* toNative(v8::Handle<v8::Object> object) |
26 { | 25 { |
27 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); | 26 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8
DOMWrapperObjectIndex)); |
28 } | 27 } |
29 static TestInterfaceImplementation* toNativeWithTypeCheck(v8::Isolate*, v8::
Handle<v8::Value>); | 28 static TestInterface* toNativeWithTypeCheck(v8::Isolate*, v8::Handle<v8::Val
ue>); |
30 static const WrapperTypeInfo wrapperTypeInfo; | 29 static const WrapperTypeInfo wrapperTypeInfo; |
31 static void derefObject(void*); | 30 static void derefObject(void*); |
32 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Is
olate*); | 31 static void visitDOMWrapper(void*, const v8::Persistent<v8::Object>&, v8::Is
olate*); |
33 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); | 32 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); |
34 static void implementsCustomVoidMethodMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>&); | 33 static void implementsCustomVoidMethodMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>&); |
35 static void legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>&); | 34 #if ENABLE(CONDITION_PARTIAL) |
| 35 static void supplementalMethod3MethodCustom(const v8::FunctionCallbackInfo<v
8::Value>&); |
| 36 #endif // ENABLE(CONDITION_PARTIAL) |
| 37 static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&); |
| 38 static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::V
alue>, const v8::PropertyCallbackInfo<v8::Value>&); |
36 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; | 39 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0
; |
37 static inline void* toInternalPointer(TestInterfaceImplementation* impl) | 40 static inline void* toInternalPointer(TestInterface* impl) |
38 { | 41 { |
39 return V8TestInterfaceEmpty::toInternalPointer(impl); | 42 return impl; |
40 } | 43 } |
41 | 44 |
42 static inline TestInterfaceImplementation* fromInternalPointer(void* object) | 45 static inline TestInterface* fromInternalPointer(void* object) |
43 { | 46 { |
44 return static_cast<TestInterfaceImplementation*>(V8TestInterfaceEmpty::f
romInternalPointer(object)); | 47 return static_cast<TestInterface*>(object); |
45 } | 48 } |
46 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestI
nterfaceImplementation*, v8::Isolate*); | 49 static void installPerContextEnabledProperties(v8::Handle<v8::Object>, TestI
nterface*, v8::Isolate*); |
47 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isol
ate*); | 50 static void installPerContextEnabledMethods(v8::Handle<v8::Object>, v8::Isol
ate*) { } |
48 | 51 |
49 private: | 52 private: |
| 53 friend v8::Handle<v8::Object> wrap(TestInterface*, v8::Handle<v8::Object> cr
eationContext, v8::Isolate*); |
| 54 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestInterface>, v8::H
andle<v8::Object> creationContext, v8::Isolate*); |
50 }; | 55 }; |
51 | 56 |
52 class TestInterfaceImplementation; | 57 inline v8::Handle<v8::Object> wrap(TestInterface* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
53 v8::Handle<v8::Value> toV8(TestInterfaceImplementation*, v8::Handle<v8::Object>
creationContext, v8::Isolate*); | |
54 | |
55 template<class CallbackInfo> | |
56 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceImpl
ementation* impl) | |
57 { | 58 { |
58 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); | 59 ASSERT(impl); |
| 60 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface>(impl, isolate)); |
| 61 return V8TestInterface::createWrapper(impl, creationContext, isolate); |
59 } | 62 } |
60 | 63 |
61 template<class CallbackInfo> | 64 inline v8::Handle<v8::Value> toV8(TestInterface* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
62 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestI
nterfaceImplementation* impl) | |
63 { | 65 { |
64 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); | 66 if (UNLIKELY(!impl)) |
| 67 return v8::Null(isolate); |
| 68 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestInterface>(im
pl, isolate); |
| 69 if (!wrapper.IsEmpty()) |
| 70 return wrapper; |
| 71 return wrap(impl, creationContext, isolate); |
| 72 } |
| 73 |
| 74 template<typename CallbackInfo> |
| 75 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterface* im
pl) |
| 76 { |
| 77 if (UNLIKELY(!impl)) { |
| 78 v8SetReturnValueNull(callbackInfo); |
| 79 return; |
| 80 } |
| 81 if (DOMDataStore::setReturnValueFromWrapper<V8TestInterface>(callbackInfo.Ge
tReturnValue(), impl)) |
| 82 return; |
| 83 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); |
| 84 v8SetReturnValue(callbackInfo, wrapper); |
| 85 } |
| 86 |
| 87 template<typename CallbackInfo> |
| 88 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, TestI
nterface* impl) |
| 89 { |
| 90 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate())->isMainWorld()); |
| 91 if (UNLIKELY(!impl)) { |
| 92 v8SetReturnValueNull(callbackInfo); |
| 93 return; |
| 94 } |
| 95 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8TestInterface>(cal
lbackInfo.GetReturnValue(), impl)) |
| 96 return; |
| 97 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate()); |
| 98 v8SetReturnValue(callbackInfo, wrapper); |
65 } | 99 } |
66 | 100 |
67 template<class CallbackInfo, class Wrappable> | 101 template<class CallbackInfo, class Wrappable> |
68 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterface
Implementation* impl, Wrappable*) | 102 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, TestInterface
* impl, Wrappable* wrappable) |
69 { | 103 { |
70 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate())); | 104 if (UNLIKELY(!impl)) { |
| 105 v8SetReturnValueNull(callbackInfo); |
| 106 return; |
| 107 } |
| 108 if (DOMDataStore::setReturnValueFromWrapperFast<V8TestInterface>(callbackInf
o.GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) |
| 109 return; |
| 110 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); |
| 111 v8SetReturnValue(callbackInfo, wrapper); |
71 } | 112 } |
72 | 113 |
73 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterfaceImplementation> impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 114 inline v8::Handle<v8::Value> toV8(PassRefPtr<TestInterface> impl, v8::Handle<v8:
:Object> creationContext, v8::Isolate* isolate) |
74 { | 115 { |
75 return toV8(impl.get(), creationContext, isolate); | 116 return toV8(impl.get(), creationContext, isolate); |
76 } | 117 } |
77 | 118 |
78 template<class CallbackInfo> | 119 template<class CallbackInfo> |
79 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestIn
terfaceImplementation> impl) | 120 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr<TestIn
terface> impl) |
80 { | 121 { |
81 v8SetReturnValue(callbackInfo, impl.get()); | 122 v8SetReturnValue(callbackInfo, impl.get()); |
82 } | 123 } |
83 | 124 |
84 template<class CallbackInfo> | 125 template<class CallbackInfo> |
85 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassR
efPtr<TestInterfaceImplementation> impl) | 126 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassR
efPtr<TestInterface> impl) |
86 { | 127 { |
87 v8SetReturnValueForMainWorld(callbackInfo, impl.get()); | 128 v8SetReturnValueForMainWorld(callbackInfo, impl.get()); |
88 } | 129 } |
89 | 130 |
90 template<class CallbackInfo, class Wrappable> | 131 template<class CallbackInfo, class Wrappable> |
91 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<Te
stInterfaceImplementation> impl, Wrappable* wrappable) | 132 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr<Te
stInterface> impl, Wrappable* wrappable) |
92 { | 133 { |
93 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); | 134 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); |
94 } | 135 } |
95 | 136 |
96 } | 137 } |
97 #endif // ENABLE(CONDITION) | 138 #endif // ENABLE(Condition1) || ENABLE(Condition2) |
98 #endif // V8TestInterface_h | 139 #endif // V8TestInterface_h |
OLD | NEW |