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 #include "config.h" | 7 #include "config.h" |
8 #include "V8TestInterfaceConstructor3.h" | 8 #include "V8TestInterfacePython2.h" |
9 | 9 |
10 #include "RuntimeEnabledFeatures.h" | 10 #include "RuntimeEnabledFeatures.h" |
| 11 #include "V8Interface1.h" |
| 12 #include "V8Interface2.h" |
11 #include "bindings/v8/ExceptionState.h" | 13 #include "bindings/v8/ExceptionState.h" |
12 #include "bindings/v8/V8DOMConfiguration.h" | 14 #include "bindings/v8/V8DOMConfiguration.h" |
| 15 #include "bindings/v8/V8GCController.h" |
13 #include "bindings/v8/V8HiddenValue.h" | 16 #include "bindings/v8/V8HiddenValue.h" |
14 #include "bindings/v8/V8ObjectConstructor.h" | 17 #include "bindings/v8/V8ObjectConstructor.h" |
15 #include "core/dom/ContextFeatures.h" | 18 #include "core/dom/ContextFeatures.h" |
16 #include "core/dom/Document.h" | 19 #include "core/dom/Document.h" |
| 20 #include "core/dom/Element.h" |
17 #include "core/frame/DOMWindow.h" | 21 #include "core/frame/DOMWindow.h" |
18 #include "platform/TraceEvent.h" | 22 #include "platform/TraceEvent.h" |
19 #include "wtf/GetPtr.h" | 23 #include "wtf/GetPtr.h" |
20 #include "wtf/RefPtr.h" | 24 #include "wtf/RefPtr.h" |
21 | 25 |
22 namespace WebCore { | 26 namespace WebCore { |
23 | 27 |
24 static void initializeScriptWrappableForInterface(TestInterfaceConstructor3* obj
ect) | 28 static void initializeScriptWrappableForInterface(TestInterfacePython2* object) |
25 { | 29 { |
26 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 30 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
27 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceConstructor
3::wrapperTypeInfo); | 31 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython2::wr
apperTypeInfo); |
28 else | 32 else |
29 ASSERT_NOT_REACHED(); | 33 ASSERT_NOT_REACHED(); |
30 } | 34 } |
31 | 35 |
32 } // namespace WebCore | 36 } // namespace WebCore |
33 | 37 |
34 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceConstruc
tor3* object) | 38 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython2*
object) |
35 { | 39 { |
36 WebCore::initializeScriptWrappableForInterface(object); | 40 WebCore::initializeScriptWrappableForInterface(object); |
37 } | 41 } |
38 | 42 |
39 namespace WebCore { | 43 namespace WebCore { |
40 const WrapperTypeInfo V8TestInterfaceConstructor3::wrapperTypeInfo = { gin::kEmb
edderBlink, V8TestInterfaceConstructor3::domTemplate, V8TestInterfaceConstructor
3::derefObject, 0, 0, 0, V8TestInterfaceConstructor3::installPerContextEnabledMe
thods, 0, WrapperTypeObjectPrototype, false }; | 44 const WrapperTypeInfo V8TestInterfacePython2::wrapperTypeInfo = { gin::kEmbedder
Blink, V8TestInterfacePython2::domTemplate, V8TestInterfacePython2::derefObject,
0, 0, V8TestInterfacePython2::visitDOMWrapper, V8TestInterfacePython2::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; |
41 | 45 |
42 namespace TestInterfaceConstructor3V8Internal { | 46 namespace TestInterfacePython2V8Internal { |
43 | 47 |
44 template <typename T> void V8_USE(T) { } | 48 template <typename T> void V8_USE(T) { } |
45 | 49 |
46 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 50 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
47 { | 51 { |
48 v8::Isolate* isolate = info.GetIsolate(); | 52 v8::Isolate* isolate = info.GetIsolate(); |
49 if (UNLIKELY(info.Length() < 1)) { | 53 RefPtr<TestInterfacePython2> impl = TestInterfacePython2::create(); |
50 throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstr
uctor3", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsola
te()); | |
51 return; | |
52 } | |
53 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0])
; | |
54 RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(s
tringArg); | |
55 | 54 |
56 v8::Handle<v8::Object> wrapper = info.Holder(); | 55 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate); |
57 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl.r
elease(), &V8TestInterfaceConstructor3::wrapperTypeInfo, wrapper, isolate, Wrapp
erConfiguration::Independent); | |
58 v8SetReturnValue(info, wrapper); | 56 v8SetReturnValue(info, wrapper); |
59 } | 57 } |
60 | 58 |
61 } // namespace TestInterfaceConstructor3V8Internal | 59 } // namespace TestInterfacePython2V8Internal |
62 | 60 |
63 void V8TestInterfaceConstructor3::constructorCallback(const v8::FunctionCallback
Info<v8::Value>& info) | 61 void V8TestInterfacePython2::visitDOMWrapper(void* object, const v8::Persistent<
v8::Object>& wrapper, v8::Isolate* isolate) |
| 62 { |
| 63 TestInterfacePython2* impl = fromInternalPointer(object); |
| 64 // The ownerNode() method may return a reference or a pointer. |
| 65 if (Node* owner = WTF::getPtr(impl->ownerNode())) { |
| 66 Node* root = V8GCController::opaqueRootForGC(owner, isolate); |
| 67 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r
oot)), wrapper); |
| 68 return; |
| 69 } |
| 70 setObjectGroup(object, wrapper, isolate); |
| 71 } |
| 72 |
| 73 void V8TestInterfacePython2::constructorCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) |
64 { | 74 { |
65 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); | 75 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); |
66 if (!info.IsConstructCall()) { | 76 if (!info.IsConstructCall()) { |
67 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Test
InterfaceConstructor3"), info.GetIsolate()); | 77 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Test
InterfacePython2"), info.GetIsolate()); |
68 return; | 78 return; |
69 } | 79 } |
70 | 80 |
71 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 81 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
72 v8SetReturnValue(info, info.Holder()); | 82 v8SetReturnValue(info, info.Holder()); |
73 return; | 83 return; |
74 } | 84 } |
75 | 85 |
76 TestInterfaceConstructor3V8Internal::constructor(info); | 86 TestInterfacePython2V8Internal::constructor(info); |
77 } | 87 } |
78 | 88 |
79 static void configureV8TestInterfaceConstructor3Template(v8::Handle<v8::Function
Template> functionTemplate, v8::Isolate* isolate) | 89 static void configureV8TestInterfacePython2Template(v8::Handle<v8::FunctionTempl
ate> functionTemplate, v8::Isolate* isolate) |
80 { | 90 { |
81 functionTemplate->ReadOnlyPrototype(); | 91 functionTemplate->ReadOnlyPrototype(); |
82 | 92 |
83 v8::Local<v8::Signature> defaultSignature; | 93 v8::Local<v8::Signature> defaultSignature; |
84 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceConstructor3", v8::Local<v8::FunctionTemplate>(), V8TestInter
faceConstructor3::internalFieldCount, | 94 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython2::internalFieldCount, |
85 0, 0, | 95 0, 0, |
86 0, 0, | 96 0, 0, |
87 0, 0, | 97 0, 0, |
88 isolate); | 98 isolate); |
89 functionTemplate->SetCallHandler(V8TestInterfaceConstructor3::constructorCal
lback); | 99 functionTemplate->SetCallHandler(V8TestInterfacePython2::constructorCallback
); |
90 functionTemplate->SetLength(1); | 100 functionTemplate->SetLength(0); |
91 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 101 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
92 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 102 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
93 | 103 |
94 // Custom toString template | 104 // Custom toString template |
95 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 105 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
96 } | 106 } |
97 | 107 |
98 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor3::domTemplate(v8::Is
olate* isolate) | 108 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate
* isolate) |
99 { | 109 { |
100 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 110 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
101 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); | 111 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); |
102 if (!result.IsEmpty()) | 112 if (!result.IsEmpty()) |
103 return result; | 113 return result; |
104 | 114 |
105 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 115 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
106 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 116 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
107 configureV8TestInterfaceConstructor3Template(result, isolate); | 117 configureV8TestInterfacePython2Template(result, isolate); |
108 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; | 118 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; |
109 return result; | 119 return result; |
110 } | 120 } |
111 | 121 |
112 bool V8TestInterfaceConstructor3::hasInstance(v8::Handle<v8::Value> v8Value, v8:
:Isolate* isolate) | 122 bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isol
ate* isolate) |
113 { | 123 { |
114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | 124 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); |
115 } | 125 } |
116 | 126 |
117 v8::Handle<v8::Object> V8TestInterfaceConstructor3::findInstanceInPrototypeChain
(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | 127 v8::Handle<v8::Object> V8TestInterfacePython2::findInstanceInPrototypeChain(v8::
Handle<v8::Value> v8Value, v8::Isolate* isolate) |
118 { | 128 { |
119 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | 129 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); |
120 } | 130 } |
121 | 131 |
122 TestInterfaceConstructor3* V8TestInterfaceConstructor3::toNativeWithTypeCheck(v8
::Isolate* isolate, v8::Handle<v8::Value> value) | 132 TestInterfacePython2* V8TestInterfacePython2::toNativeWithTypeCheck(v8::Isolate*
isolate, v8::Handle<v8::Value> value) |
123 { | 133 { |
124 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | 134 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
125 } | 135 } |
126 | 136 |
127 v8::Handle<v8::Object> V8TestInterfaceConstructor3::createWrapper(PassRefPtr<Tes
tInterfaceConstructor3> impl, v8::Handle<v8::Object> creationContext, v8::Isolat
e* isolate) | 137 v8::Handle<v8::Object> wrap(TestInterfacePython2* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
128 { | 138 { |
129 ASSERT(impl); | 139 ASSERT(impl); |
130 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor3>(impl.get(
), isolate)); | 140 if (impl->isInterface1()) |
| 141 return wrap(toInterface1(impl), creationContext, isolate); |
| 142 if (impl->isInterface2()) |
| 143 return wrap(toInterface2(impl), creationContext, isolate); |
| 144 v8::Handle<v8::Object> wrapper = V8TestInterfacePython2::createWrapper(impl,
creationContext, isolate); |
| 145 return wrapper; |
| 146 } |
| 147 |
| 148 v8::Handle<v8::Object> V8TestInterfacePython2::createWrapper(PassRefPtr<TestInte
rfacePython2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) |
| 149 { |
| 150 ASSERT(impl); |
| 151 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython2>(impl.get(), is
olate)); |
131 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 152 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
132 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 153 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
133 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 154 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
134 // the same object de-ref functions, though, so use that as the basis of
the check. | 155 // the same object de-ref functions, though, so use that as the basis of
the check. |
135 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 156 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
136 } | 157 } |
137 | 158 |
138 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 159 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
139 if (UNLIKELY(wrapper.IsEmpty())) | 160 if (UNLIKELY(wrapper.IsEmpty())) |
140 return wrapper; | 161 return wrapper; |
141 | 162 |
142 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 163 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
143 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 164 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython2>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); |
144 return wrapper; | 165 return wrapper; |
145 } | 166 } |
146 | 167 |
147 void V8TestInterfaceConstructor3::derefObject(void* object) | 168 void V8TestInterfacePython2::derefObject(void* object) |
148 { | 169 { |
149 fromInternalPointer(object)->deref(); | 170 fromInternalPointer(object)->deref(); |
150 } | 171 } |
151 | 172 |
152 template<> | 173 template<> |
153 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor3* impl, v8::Handle<v
8::Object> creationContext, v8::Isolate* isolate) | 174 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
154 { | 175 { |
155 return toV8(impl, creationContext, isolate); | 176 return toV8(impl, creationContext, isolate); |
156 } | 177 } |
157 | 178 |
158 } // namespace WebCore | 179 } // namespace WebCore |
OLD | NEW |