OLD | NEW |
1 /* | 1 /* |
2 This file is part of the Blink open source project. | 2 This file is part of the Blink open source project. |
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! | 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! |
4 | 4 |
5 This library is free software; you can redistribute it and/or | 5 This library is free software; you can redistribute it and/or |
6 modify it under the terms of the GNU Library General Public | 6 modify it under the terms of the GNU Library General Public |
7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
8 version 2 of the License, or (at your option) any later version. | 8 version 2 of the License, or (at your option) any later version. |
9 | 9 |
10 This library is distributed in the hope that it will be useful, | 10 This library is distributed in the hope that it will be useful, |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/dom/ContextFeatures.h" | 35 #include "core/dom/ContextFeatures.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "platform/TraceEvent.h" | 37 #include "platform/TraceEvent.h" |
38 #include "wtf/UnusedParam.h" | 38 #include "wtf/UnusedParam.h" |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 static void initializeScriptWrappableForInterface(TestOverloadedConstructors* ob
ject) | 42 static void initializeScriptWrappableForInterface(TestOverloadedConstructors* ob
ject) |
43 { | 43 { |
44 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 44 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
45 ScriptWrappable::setTypeInfoInObject(object, &V8TestOverloadedConstructo
rs::info); | 45 ScriptWrappable::setTypeInfoInObject(object, &V8TestOverloadedConstructo
rs::wrapperTypeInfo); |
46 else | 46 else |
47 ASSERT_NOT_REACHED(); | 47 ASSERT_NOT_REACHED(); |
48 } | 48 } |
49 | 49 |
50 } // namespace WebCore | 50 } // namespace WebCore |
51 | 51 |
52 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 52 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
53 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 53 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
54 // in the global namespace. | 54 // in the global namespace. |
55 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 55 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
56 void webCoreInitializeScriptWrappableForInterface(WebCore::TestOverloadedConstru
ctors* object) | 56 void webCoreInitializeScriptWrappableForInterface(WebCore::TestOverloadedConstru
ctors* object) |
57 { | 57 { |
58 WebCore::initializeScriptWrappableForInterface(object); | 58 WebCore::initializeScriptWrappableForInterface(object); |
59 } | 59 } |
60 | 60 |
61 namespace WebCore { | 61 namespace WebCore { |
62 WrapperTypeInfo V8TestOverloadedConstructors::info = { V8TestOverloadedConstruct
ors::GetTemplate, V8TestOverloadedConstructors::derefObject, 0, 0, 0, V8TestOver
loadedConstructors::installPerContextEnabledPrototypeProperties, 0, WrapperTypeO
bjectPrototype }; | 62 WrapperTypeInfo V8TestOverloadedConstructors::wrapperTypeInfo = { V8TestOverload
edConstructors::GetTemplate, V8TestOverloadedConstructors::derefObject, 0, 0, 0,
V8TestOverloadedConstructors::installPerContextEnabledPrototypeProperties, 0, W
rapperTypeObjectPrototype }; |
63 | 63 |
64 namespace TestOverloadedConstructorsV8Internal { | 64 namespace TestOverloadedConstructorsV8Internal { |
65 | 65 |
66 template <typename T> void V8_USE(T) { } | 66 template <typename T> void V8_USE(T) { } |
67 | 67 |
68 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& args) | 68 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& args) |
69 { | 69 { |
70 V8TRYCATCH_VOID(ArrayBuffer*, arrayBuffer, args[0]->IsArrayBuffer() ? V8Arra
yBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast(args[0])) : 0); | 70 V8TRYCATCH_VOID(ArrayBuffer*, arrayBuffer, args[0]->IsArrayBuffer() ? V8Arra
yBuffer::toNative(v8::Handle<v8::ArrayBuffer>::Cast(args[0])) : 0); |
71 | 71 |
72 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(arrayBuffer); | 72 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(arrayBuffer); |
73 v8::Handle<v8::Object> wrapper = args.Holder(); | 73 v8::Handle<v8::Object> wrapper = args.Holder(); |
74 | 74 |
75 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), Wrap
perConfiguration::Dependent); | 75 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, args.GetIsol
ate(), WrapperConfiguration::Dependent); |
76 args.GetReturnValue().Set(wrapper); | 76 args.GetReturnValue().Set(wrapper); |
77 } | 77 } |
78 | 78 |
79 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& args) | 79 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& args) |
80 { | 80 { |
81 V8TRYCATCH_VOID(ArrayBufferView*, arrayBufferView, args[0]->IsArrayBufferVie
w() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(args[0])
) : 0); | 81 V8TRYCATCH_VOID(ArrayBufferView*, arrayBufferView, args[0]->IsArrayBufferVie
w() ? V8ArrayBufferView::toNative(v8::Handle<v8::ArrayBufferView>::Cast(args[0])
) : 0); |
82 | 82 |
83 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(arrayBufferView); | 83 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(arrayBufferView); |
84 v8::Handle<v8::Object> wrapper = args.Holder(); | 84 v8::Handle<v8::Object> wrapper = args.Holder(); |
85 | 85 |
86 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), Wrap
perConfiguration::Dependent); | 86 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, args.GetIsol
ate(), WrapperConfiguration::Dependent); |
87 args.GetReturnValue().Set(wrapper); | 87 args.GetReturnValue().Set(wrapper); |
88 } | 88 } |
89 | 89 |
90 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& args) | 90 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& args) |
91 { | 91 { |
92 V8TRYCATCH_VOID(Blob*, blob, V8Blob::HasInstance(args[0], args.GetIsolate(),
worldType(args.GetIsolate())) ? V8Blob::toNative(v8::Handle<v8::Object>::Cast(a
rgs[0])) : 0); | 92 V8TRYCATCH_VOID(Blob*, blob, V8Blob::HasInstance(args[0], args.GetIsolate(),
worldType(args.GetIsolate())) ? V8Blob::toNative(v8::Handle<v8::Object>::Cast(a
rgs[0])) : 0); |
93 | 93 |
94 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(blob); | 94 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(blob); |
95 v8::Handle<v8::Object> wrapper = args.Holder(); | 95 v8::Handle<v8::Object> wrapper = args.Holder(); |
96 | 96 |
97 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), Wrap
perConfiguration::Dependent); | 97 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, args.GetIsol
ate(), WrapperConfiguration::Dependent); |
98 args.GetReturnValue().Set(wrapper); | 98 args.GetReturnValue().Set(wrapper); |
99 } | 99 } |
100 | 100 |
101 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& args) | 101 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& args) |
102 { | 102 { |
103 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, string, args[0]); | 103 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, string, args[0]); |
104 | 104 |
105 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(string); | 105 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create
(string); |
106 v8::Handle<v8::Object> wrapper = args.Holder(); | 106 v8::Handle<v8::Object> wrapper = args.Holder(); |
107 | 107 |
108 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::info, wrapper, args.GetIsolate(), Wrap
perConfiguration::Dependent); | 108 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl.
release(), &V8TestOverloadedConstructors::wrapperTypeInfo, wrapper, args.GetIsol
ate(), WrapperConfiguration::Dependent); |
109 args.GetReturnValue().Set(wrapper); | 109 args.GetReturnValue().Set(wrapper); |
110 } | 110 } |
111 | 111 |
112 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args) | 112 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args) |
113 { | 113 { |
114 if ((args.Length() == 1 && (V8ArrayBuffer::HasInstance(args[0], args.GetIsol
ate(), worldType(args.GetIsolate()))))) { | 114 if ((args.Length() == 1 && (V8ArrayBuffer::HasInstance(args[0], args.GetIsol
ate(), worldType(args.GetIsolate()))))) { |
115 TestOverloadedConstructorsV8Internal::constructor1(args); | 115 TestOverloadedConstructorsV8Internal::constructor1(args); |
116 return; | 116 return; |
117 } | 117 } |
118 if ((args.Length() == 1 && (V8ArrayBufferView::HasInstance(args[0], args.Get
Isolate(), worldType(args.GetIsolate()))))) { | 118 if ((args.Length() == 1 && (V8ArrayBufferView::HasInstance(args[0], args.Get
Isolate(), worldType(args.GetIsolate()))))) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 desc->SetLength(1); | 166 desc->SetLength(1); |
167 | 167 |
168 // Custom toString template | 168 // Custom toString template |
169 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 169 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
170 return desc; | 170 return desc; |
171 } | 171 } |
172 | 172 |
173 v8::Handle<v8::FunctionTemplate> V8TestOverloadedConstructors::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) | 173 v8::Handle<v8::FunctionTemplate> V8TestOverloadedConstructors::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) |
174 { | 174 { |
175 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 175 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
176 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); | 176 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
177 if (result != data->templateMap(currentWorldType).end()) | 177 if (result != data->templateMap(currentWorldType).end()) |
178 return result->value.newLocal(isolate); | 178 return result->value.newLocal(isolate); |
179 | 179 |
180 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 180 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
181 v8::HandleScope handleScope(isolate); | 181 v8::HandleScope handleScope(isolate); |
182 v8::Handle<v8::FunctionTemplate> templ = | 182 v8::Handle<v8::FunctionTemplate> templ = |
183 ConfigureV8TestOverloadedConstructorsTemplate(data->rawTemplate(&info, c
urrentWorldType), isolate, currentWorldType); | 183 ConfigureV8TestOverloadedConstructorsTemplate(data->rawTemplate(&wrapper
TypeInfo, currentWorldType), isolate, currentWorldType); |
184 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); | 184 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
185 return handleScope.Close(templ); | 185 return handleScope.Close(templ); |
186 } | 186 } |
187 | 187 |
188 bool V8TestOverloadedConstructors::HasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 188 bool V8TestOverloadedConstructors::HasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) |
189 { | 189 { |
190 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, currentW
orldType); | 190 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
191 } | 191 } |
192 | 192 |
193 bool V8TestOverloadedConstructors::HasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) | 193 bool V8TestOverloadedConstructors::HasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) |
194 { | 194 { |
195 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, MainWorl
d) | 195 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
196 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, Isolated
World) | 196 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
197 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, WorkerWo
rld); | 197 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
198 } | 198 } |
199 | 199 |
200 v8::Handle<v8::Object> V8TestOverloadedConstructors::createWrapper(PassRefPtr<Te
stOverloadedConstructors> impl, v8::Handle<v8::Object> creationContext, v8::Isol
ate* isolate) | 200 v8::Handle<v8::Object> V8TestOverloadedConstructors::createWrapper(PassRefPtr<Te
stOverloadedConstructors> impl, v8::Handle<v8::Object> creationContext, v8::Isol
ate* isolate) |
201 { | 201 { |
202 ASSERT(impl); | 202 ASSERT(impl); |
203 ASSERT(!DOMDataStore::containsWrapper<V8TestOverloadedConstructors>(impl.get
(), isolate)); | 203 ASSERT(!DOMDataStore::containsWrapper<V8TestOverloadedConstructors>(impl.get
(), isolate)); |
204 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 204 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
205 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 205 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
206 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 206 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
207 // the same object de-ref functions, though, so use that as the basis of
the check. | 207 // the same object de-ref functions, though, so use that as the basis of
the check. |
208 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); | 208 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
209 } | 209 } |
210 | 210 |
211 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); | 211 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
212 if (UNLIKELY(wrapper.IsEmpty())) | 212 if (UNLIKELY(wrapper.IsEmpty())) |
213 return wrapper; | 213 return wrapper; |
214 | 214 |
215 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 215 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
216 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl,
&info, wrapper, isolate, WrapperConfiguration::Independent); | 216 V8DOMWrapper::associateObjectWithWrapper<V8TestOverloadedConstructors>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
217 return wrapper; | 217 return wrapper; |
218 } | 218 } |
219 | 219 |
220 void V8TestOverloadedConstructors::derefObject(void* object) | 220 void V8TestOverloadedConstructors::derefObject(void* object) |
221 { | 221 { |
222 fromInternalPointer(object)->deref(); | 222 fromInternalPointer(object)->deref(); |
223 } | 223 } |
224 | 224 |
225 } // namespace WebCore | 225 } // namespace WebCore |
OLD | NEW |