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 22 matching lines...) Expand all Loading... |
33 #include "core/dom/ContextFeatures.h" | 33 #include "core/dom/ContextFeatures.h" |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "platform/TraceEvent.h" | 35 #include "platform/TraceEvent.h" |
36 #include "wtf/UnusedParam.h" | 36 #include "wtf/UnusedParam.h" |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 static void initializeScriptWrappableForInterface(TestNamedConstructor* object) | 40 static void initializeScriptWrappableForInterface(TestNamedConstructor* object) |
41 { | 41 { |
42 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 42 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
43 ScriptWrappable::setTypeInfoInObject(object, &V8TestNamedConstructor::in
fo); | 43 ScriptWrappable::setTypeInfoInObject(object, &V8TestNamedConstructor::wr
apperTypeInfo); |
44 else | 44 else |
45 ASSERT_NOT_REACHED(); | 45 ASSERT_NOT_REACHED(); |
46 } | 46 } |
47 | 47 |
48 } // namespace WebCore | 48 } // namespace WebCore |
49 | 49 |
50 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 50 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
51 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 51 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
52 // in the global namespace. | 52 // in the global namespace. |
53 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 53 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
54 void webCoreInitializeScriptWrappableForInterface(WebCore::TestNamedConstructor*
object) | 54 void webCoreInitializeScriptWrappableForInterface(WebCore::TestNamedConstructor*
object) |
55 { | 55 { |
56 WebCore::initializeScriptWrappableForInterface(object); | 56 WebCore::initializeScriptWrappableForInterface(object); |
57 } | 57 } |
58 | 58 |
59 namespace WebCore { | 59 namespace WebCore { |
60 WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemp
late, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMOb
ject, 0, 0, V8TestNamedConstructor::installPerContextEnabledPrototypeProperties,
0, WrapperTypeObjectPrototype }; | 60 WrapperTypeInfo V8TestNamedConstructor::wrapperTypeInfo = { V8TestNamedConstruct
or::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::to
ActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextEnabledPrototype
Properties, 0, WrapperTypeObjectPrototype }; |
61 | 61 |
62 namespace TestNamedConstructorV8Internal { | 62 namespace TestNamedConstructorV8Internal { |
63 | 63 |
64 template <typename T> void V8_USE(T) { } | 64 template <typename T> void V8_USE(T) { } |
65 | 65 |
66 } // namespace TestNamedConstructorV8Internal | 66 } // namespace TestNamedConstructorV8Internal |
67 | 67 |
68 WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstruct
orConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedCons
tructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextEnabl
edPrototypeProperties, 0, WrapperTypeObjectPrototype }; | 68 WrapperTypeInfo V8TestNamedConstructorConstructor::wrapperTypeInfo = { V8TestNam
edConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8Te
stNamedConstructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerC
ontextEnabledPrototypeProperties, 0, WrapperTypeObjectPrototype }; |
69 | 69 |
70 static void V8TestNamedConstructorConstructorCallback(const v8::FunctionCallback
Info<v8::Value>& args) | 70 static void V8TestNamedConstructorConstructorCallback(const v8::FunctionCallback
Info<v8::Value>& args) |
71 { | 71 { |
72 if (!args.IsConstructCall()) { | 72 if (!args.IsConstructCall()) { |
73 throwTypeError(ExceptionMessages::failedToConstruct("TestNamedConstructo
r", "Please use the 'new' operator, this DOM object constructor cannot be called
as a function."), args.GetIsolate()); | 73 throwTypeError(ExceptionMessages::failedToConstruct("TestNamedConstructo
r", "Please use the 'new' operator, this DOM object constructor cannot be called
as a function."), args.GetIsolate()); |
74 return; | 74 return; |
75 } | 75 } |
76 | 76 |
77 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 77 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
78 args.GetReturnValue().Set(args.Holder()); | 78 args.GetReturnValue().Set(args.Holder()); |
(...skipping 14 matching lines...) Expand all Loading... |
93 ExceptionState es(args.GetIsolate()); | 93 ExceptionState es(args.GetIsolate()); |
94 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, args[0]); | 94 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, args[0]); |
95 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, args[1]); | 95 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, args[1]); |
96 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str3, argumentOrNul
l(args, 2)); | 96 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str3, argumentOrNul
l(args, 2)); |
97 | 97 |
98 RefPtr<TestNamedConstructor> impl = TestNamedConstructor::createForJSConstru
ctor(*document, str1, str2, str3, es); | 98 RefPtr<TestNamedConstructor> impl = TestNamedConstructor::createForJSConstru
ctor(*document, str1, str2, str3, es); |
99 v8::Handle<v8::Object> wrapper = args.Holder(); | 99 v8::Handle<v8::Object> wrapper = args.Holder(); |
100 if (es.throwIfNeeded()) | 100 if (es.throwIfNeeded()) |
101 return; | 101 return; |
102 | 102 |
103 V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl.releas
e(), &V8TestNamedConstructorConstructor::info, wrapper, args.GetIsolate(), Wrapp
erConfiguration::Dependent); | 103 V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl.releas
e(), &V8TestNamedConstructorConstructor::wrapperTypeInfo, wrapper, args.GetIsola
te(), WrapperConfiguration::Dependent); |
104 args.GetReturnValue().Set(wrapper); | 104 args.GetReturnValue().Set(wrapper); |
105 } | 105 } |
106 | 106 |
107 v8::Handle<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTemplate(
v8::Isolate* isolate, WrapperWorldType currentWorldType) | 107 v8::Handle<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTemplate(
v8::Isolate* isolate, WrapperWorldType currentWorldType) |
108 { | 108 { |
109 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 109 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
110 static const char* privateTemplateUniqueKey = "V8TestNamedConstructorConstru
ctor::GetTemplatePrivateTemplate"; | 110 static const char* privateTemplateUniqueKey = "V8TestNamedConstructorConstru
ctor::GetTemplatePrivateTemplate"; |
111 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 111 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
112 v8::Handle<v8::FunctionTemplate> result = data->privateTemplateIfExists(curr
entWorldType, &privateTemplateUniqueKey); | 112 v8::Handle<v8::FunctionTemplate> result = data->privateTemplateIfExists(curr
entWorldType, &privateTemplateUniqueKey); |
113 if (!result.IsEmpty()) | 113 if (!result.IsEmpty()) |
(...skipping 23 matching lines...) Expand all Loading... |
137 UNUSED_PARAM(defaultSignature); | 137 UNUSED_PARAM(defaultSignature); |
138 | 138 |
139 // Custom toString template | 139 // Custom toString template |
140 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 140 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
141 return desc; | 141 return desc; |
142 } | 142 } |
143 | 143 |
144 v8::Handle<v8::FunctionTemplate> V8TestNamedConstructor::GetTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 144 v8::Handle<v8::FunctionTemplate> V8TestNamedConstructor::GetTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) |
145 { | 145 { |
146 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 146 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
147 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); | 147 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
148 if (result != data->templateMap(currentWorldType).end()) | 148 if (result != data->templateMap(currentWorldType).end()) |
149 return result->value.newLocal(isolate); | 149 return result->value.newLocal(isolate); |
150 | 150 |
151 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 151 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
152 v8::HandleScope handleScope(isolate); | 152 v8::HandleScope handleScope(isolate); |
153 v8::Handle<v8::FunctionTemplate> templ = | 153 v8::Handle<v8::FunctionTemplate> templ = |
154 ConfigureV8TestNamedConstructorTemplate(data->rawTemplate(&info, current
WorldType), isolate, currentWorldType); | 154 ConfigureV8TestNamedConstructorTemplate(data->rawTemplate(&wrapperTypeIn
fo, currentWorldType), isolate, currentWorldType); |
155 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); | 155 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
156 return handleScope.Close(templ); | 156 return handleScope.Close(templ); |
157 } | 157 } |
158 | 158 |
159 bool V8TestNamedConstructor::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate, WrapperWorldType currentWorldType) | 159 bool V8TestNamedConstructor::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate, WrapperWorldType currentWorldType) |
160 { | 160 { |
161 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, currentW
orldType); | 161 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
162 } | 162 } |
163 | 163 |
164 bool V8TestNamedConstructor::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) | 164 bool V8TestNamedConstructor::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) |
165 { | 165 { |
166 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, MainWorl
d) | 166 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
167 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, Isolated
World) | 167 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
168 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, WorkerWo
rld); | 168 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
169 } | 169 } |
170 | 170 |
171 ActiveDOMObject* V8TestNamedConstructor::toActiveDOMObject(v8::Handle<v8::Object
> object) | 171 ActiveDOMObject* V8TestNamedConstructor::toActiveDOMObject(v8::Handle<v8::Object
> object) |
172 { | 172 { |
173 return toNative(object); | 173 return toNative(object); |
174 } | 174 } |
175 | 175 |
176 v8::Handle<v8::Object> V8TestNamedConstructor::createWrapper(PassRefPtr<TestName
dConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) | 176 v8::Handle<v8::Object> V8TestNamedConstructor::createWrapper(PassRefPtr<TestName
dConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) |
177 { | 177 { |
178 ASSERT(impl); | 178 ASSERT(impl); |
179 ASSERT(!DOMDataStore::containsWrapper<V8TestNamedConstructor>(impl.get(), is
olate)); | 179 ASSERT(!DOMDataStore::containsWrapper<V8TestNamedConstructor>(impl.get(), is
olate)); |
180 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 180 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
181 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 181 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
182 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 182 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
183 // the same object de-ref functions, though, so use that as the basis of
the check. | 183 // the same object de-ref functions, though, so use that as the basis of
the check. |
184 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); | 184 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
185 } | 185 } |
186 | 186 |
187 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); | 187 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
188 if (UNLIKELY(wrapper.IsEmpty())) | 188 if (UNLIKELY(wrapper.IsEmpty())) |
189 return wrapper; | 189 return wrapper; |
190 | 190 |
191 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 191 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
192 V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl, &info
, wrapper, isolate, WrapperConfiguration::Dependent); | 192 V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); |
193 return wrapper; | 193 return wrapper; |
194 } | 194 } |
195 | 195 |
196 void V8TestNamedConstructor::derefObject(void* object) | 196 void V8TestNamedConstructor::derefObject(void* object) |
197 { | 197 { |
198 fromInternalPointer(object)->deref(); | 198 fromInternalPointer(object)->deref(); |
199 } | 199 } |
200 | 200 |
201 } // namespace WebCore | 201 } // namespace WebCore |
OLD | NEW |