| 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/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/page/UseCounter.h" | 36 #include "core/page/UseCounter.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(Event* object) | 42 static void initializeScriptWrappableForInterface(Event* object) |
| 43 { | 43 { |
| 44 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 44 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 45 ScriptWrappable::setTypeInfoInObject(object, &V8TestExtendedEvent::info)
; | 45 ScriptWrappable::setTypeInfoInObject(object, &V8TestExtendedEvent::wrapp
erTypeInfo); |
| 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::Event* object) | 56 void webCoreInitializeScriptWrappableForInterface(WebCore::Event* object) |
| 57 { | 57 { |
| 58 WebCore::initializeScriptWrappableForInterface(object); | 58 WebCore::initializeScriptWrappableForInterface(object); |
| 59 } | 59 } |
| 60 | 60 |
| 61 namespace WebCore { | 61 namespace WebCore { |
| 62 WrapperTypeInfo V8TestExtendedEvent::info = { V8TestExtendedEvent::GetTemplate,
V8TestExtendedEvent::derefObject, 0, 0, 0, V8TestExtendedEvent::installPerContex
tEnabledPrototypeProperties, &V8TestEvent::info, WrapperTypeObjectPrototype }; | 62 WrapperTypeInfo V8TestExtendedEvent::wrapperTypeInfo = { V8TestExtendedEvent::Ge
tTemplate, V8TestExtendedEvent::derefObject, 0, 0, 0, V8TestExtendedEvent::insta
llPerContextEnabledPrototypeProperties, &V8TestEvent::wrapperTypeInfo, WrapperTy
peObjectPrototype }; |
| 63 | 63 |
| 64 namespace EventV8Internal { | 64 namespace EventV8Internal { |
| 65 | 65 |
| 66 template <typename T> void V8_USE(T) { } | 66 template <typename T> void V8_USE(T) { } |
| 67 | 67 |
| 68 static void locationAttributeGetter(v8::Local<v8::String> name, const v8::Proper
tyCallbackInfo<v8::Value>& info) | 68 static void locationAttributeGetter(v8::Local<v8::String> name, const v8::Proper
tyCallbackInfo<v8::Value>& info) |
| 69 { | 69 { |
| 70 Event* imp = V8TestExtendedEvent::toNative(info.Holder()); | 70 Event* imp = V8TestExtendedEvent::toNative(info.Holder()); |
| 71 v8SetReturnValueUnsigned(info, imp->location()); | 71 v8SetReturnValueUnsigned(info, imp->location()); |
| 72 } | 72 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 102 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]); | 102 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, args[0]); |
| 103 EventInit eventInit; | 103 EventInit eventInit; |
| 104 if (args.Length() >= 2) { | 104 if (args.Length() >= 2) { |
| 105 V8TRYCATCH_VOID(Dictionary, options, Dictionary(args[1], args.GetIsolate
())); | 105 V8TRYCATCH_VOID(Dictionary, options, Dictionary(args[1], args.GetIsolate
())); |
| 106 if (!fillEventInit(eventInit, options)) | 106 if (!fillEventInit(eventInit, options)) |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 | 109 |
| 110 RefPtr<Event> event = Event::create(type, eventInit); | 110 RefPtr<Event> event = Event::create(type, eventInit); |
| 111 v8::Handle<v8::Object> wrapper = args.Holder(); | 111 v8::Handle<v8::Object> wrapper = args.Holder(); |
| 112 V8DOMWrapper::associateObjectWithWrapper<V8TestExtendedEvent>(event.release(
), &V8TestExtendedEvent::info, wrapper, args.GetIsolate(), WrapperConfiguration:
:Dependent); | 112 V8DOMWrapper::associateObjectWithWrapper<V8TestExtendedEvent>(event.release(
), &V8TestExtendedEvent::wrapperTypeInfo, wrapper, args.GetIsolate(), WrapperCon
figuration::Dependent); |
| 113 v8SetReturnValue(args, wrapper); | 113 v8SetReturnValue(args, wrapper); |
| 114 } | 114 } |
| 115 } // namespace EventV8Internal | 115 } // namespace EventV8Internal |
| 116 | 116 |
| 117 static const V8DOMConfiguration::AttributeConfiguration V8TestExtendedEventAttri
butes[] = { | 117 static const V8DOMConfiguration::AttributeConfiguration V8TestExtendedEventAttri
butes[] = { |
| 118 {"location", EventV8Internal::locationAttributeGetterCallback, 0, 0, 0, 0, s
tatic_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v
8::None), 0 /* on instance */}, | 118 {"location", EventV8Internal::locationAttributeGetterCallback, 0, 0, 0, 0, s
tatic_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v
8::None), 0 /* on instance */}, |
| 119 {"keyLocation", EventV8Internal::keyLocationAttributeGetterCallback, 0, 0, 0
, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttrib
ute>(v8::None), 0 /* on instance */}, | 119 {"keyLocation", EventV8Internal::keyLocationAttributeGetterCallback, 0, 0, 0
, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttrib
ute>(v8::None), 0 /* on instance */}, |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 bool fillEventInit(EventInit& eventInit, const Dictionary& options) | 122 bool fillEventInit(EventInit& eventInit, const Dictionary& options) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 desc->SetLength(1); | 162 desc->SetLength(1); |
| 163 | 163 |
| 164 // Custom toString template | 164 // Custom toString template |
| 165 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 165 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
| 166 return desc; | 166 return desc; |
| 167 } | 167 } |
| 168 | 168 |
| 169 v8::Handle<v8::FunctionTemplate> V8TestExtendedEvent::GetTemplate(v8::Isolate* i
solate, WrapperWorldType currentWorldType) | 169 v8::Handle<v8::FunctionTemplate> V8TestExtendedEvent::GetTemplate(v8::Isolate* i
solate, WrapperWorldType currentWorldType) |
| 170 { | 170 { |
| 171 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 171 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 172 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); | 172 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 173 if (result != data->templateMap(currentWorldType).end()) | 173 if (result != data->templateMap(currentWorldType).end()) |
| 174 return result->value.newLocal(isolate); | 174 return result->value.newLocal(isolate); |
| 175 | 175 |
| 176 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 176 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 177 v8::HandleScope handleScope(isolate); | 177 v8::HandleScope handleScope(isolate); |
| 178 v8::Handle<v8::FunctionTemplate> templ = | 178 v8::Handle<v8::FunctionTemplate> templ = |
| 179 ConfigureV8TestExtendedEventTemplate(data->rawTemplate(&info, currentWor
ldType), isolate, currentWorldType); | 179 ConfigureV8TestExtendedEventTemplate(data->rawTemplate(&wrapperTypeInfo,
currentWorldType), isolate, currentWorldType); |
| 180 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); | 180 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 181 return handleScope.Close(templ); | 181 return handleScope.Close(templ); |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool V8TestExtendedEvent::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 184 bool V8TestExtendedEvent::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate
* isolate, WrapperWorldType currentWorldType) |
| 185 { | 185 { |
| 186 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, currentW
orldType); | 186 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 187 } | 187 } |
| 188 | 188 |
| 189 bool V8TestExtendedEvent::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) | 189 bool V8TestExtendedEvent::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) |
| 190 { | 190 { |
| 191 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, MainWorl
d) | 191 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 192 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, Isolated
World) | 192 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 193 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, WorkerWo
rld); | 193 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 194 } | 194 } |
| 195 | 195 |
| 196 v8::Handle<v8::Object> V8TestExtendedEvent::createWrapper(PassRefPtr<Event> impl
, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 196 v8::Handle<v8::Object> V8TestExtendedEvent::createWrapper(PassRefPtr<Event> impl
, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 197 { | 197 { |
| 198 ASSERT(impl); | 198 ASSERT(impl); |
| 199 ASSERT(!DOMDataStore::containsWrapper<V8TestExtendedEvent>(impl.get(), isola
te)); | 199 ASSERT(!DOMDataStore::containsWrapper<V8TestExtendedEvent>(impl.get(), isola
te)); |
| 200 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 200 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 201 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 201 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 202 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 202 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 203 // the same object de-ref functions, though, so use that as the basis of
the check. | 203 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 204 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); | 204 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 205 } | 205 } |
| 206 | 206 |
| 207 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); | 207 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 208 if (UNLIKELY(wrapper.IsEmpty())) | 208 if (UNLIKELY(wrapper.IsEmpty())) |
| 209 return wrapper; | 209 return wrapper; |
| 210 | 210 |
| 211 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 211 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 212 V8DOMWrapper::associateObjectWithWrapper<V8TestExtendedEvent>(impl, &info, w
rapper, isolate, WrapperConfiguration::Independent); | 212 V8DOMWrapper::associateObjectWithWrapper<V8TestExtendedEvent>(impl, &wrapper
TypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 213 return wrapper; | 213 return wrapper; |
| 214 } | 214 } |
| 215 | 215 |
| 216 void V8TestExtendedEvent::derefObject(void* object) | 216 void V8TestExtendedEvent::derefObject(void* object) |
| 217 { | 217 { |
| 218 fromInternalPointer(object)->deref(); | 218 fromInternalPointer(object)->deref(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace WebCore | 221 } // namespace WebCore |
| 222 | 222 |
| 223 #endif // ENABLE(TEST) | 223 #endif // ENABLE(TEST) |
| OLD | NEW |