| 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 "platform/TraceEvent.h" | 33 #include "platform/TraceEvent.h" |
| 34 #include "wtf/GetPtr.h" | 34 #include "wtf/GetPtr.h" |
| 35 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.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(RealClass* object) | 40 static void initializeScriptWrappableForInterface(RealClass* object) |
| 41 { | 41 { |
| 42 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 42 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 43 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceImplemented
As::info); | 43 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceImplemented
As::wrapperTypeInfo); |
| 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::RealClass* object) | 54 void webCoreInitializeScriptWrappableForInterface(WebCore::RealClass* object) |
| 55 { | 55 { |
| 56 WebCore::initializeScriptWrappableForInterface(object); | 56 WebCore::initializeScriptWrappableForInterface(object); |
| 57 } | 57 } |
| 58 | 58 |
| 59 namespace WebCore { | 59 namespace WebCore { |
| 60 WrapperTypeInfo V8TestInterfaceImplementedAs::info = { V8TestInterfaceImplemente
dAs::GetTemplate, V8TestInterfaceImplementedAs::derefObject, 0, 0, 0, V8TestInte
rfaceImplementedAs::installPerContextEnabledPrototypeProperties, 0, WrapperTypeO
bjectPrototype }; | 60 WrapperTypeInfo V8TestInterfaceImplementedAs::wrapperTypeInfo = { V8TestInterfac
eImplementedAs::GetTemplate, V8TestInterfaceImplementedAs::derefObject, 0, 0, 0,
V8TestInterfaceImplementedAs::installPerContextEnabledPrototypeProperties, 0, W
rapperTypeObjectPrototype }; |
| 61 | 61 |
| 62 namespace RealClassV8Internal { | 62 namespace RealClassV8Internal { |
| 63 | 63 |
| 64 template <typename T> void V8_USE(T) { } | 64 template <typename T> void V8_USE(T) { } |
| 65 | 65 |
| 66 static void aAttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallb
ackInfo<v8::Value>& info) | 66 static void aAttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallb
ackInfo<v8::Value>& info) |
| 67 { | 67 { |
| 68 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); | 68 RealClass* imp = V8TestInterfaceImplementedAs::toNative(info.Holder()); |
| 69 v8SetReturnValueString(info, imp->a(), info.GetIsolate()); | 69 v8SetReturnValueString(info, imp->a(), info.GetIsolate()); |
| 70 } | 70 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 V8TestInterfaceImplementedAsAttributes, WTF_ARRAY_LENGTH(V8TestInterface
ImplementedAsAttributes), | 175 V8TestInterfaceImplementedAsAttributes, WTF_ARRAY_LENGTH(V8TestInterface
ImplementedAsAttributes), |
| 176 V8TestInterfaceImplementedAsMethods, WTF_ARRAY_LENGTH(V8TestInterfaceImp
lementedAsMethods), isolate, currentWorldType); | 176 V8TestInterfaceImplementedAsMethods, WTF_ARRAY_LENGTH(V8TestInterfaceImp
lementedAsMethods), isolate, currentWorldType); |
| 177 UNUSED_PARAM(defaultSignature); | 177 UNUSED_PARAM(defaultSignature); |
| 178 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); | 178 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |
| 179 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); | 179 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); |
| 180 UNUSED_PARAM(instance); | 180 UNUSED_PARAM(instance); |
| 181 UNUSED_PARAM(proto); | 181 UNUSED_PARAM(proto); |
| 182 | 182 |
| 183 // Custom Signature 'funcTestInterfaceImplementedAsParam' | 183 // Custom Signature 'funcTestInterfaceImplementedAsParam' |
| 184 const int funcTestInterfaceImplementedAsParamArgc = 1; | 184 const int funcTestInterfaceImplementedAsParamArgc = 1; |
| 185 v8::Handle<v8::FunctionTemplate> funcTestInterfaceImplementedAsParamArgv[fun
cTestInterfaceImplementedAsParamArgc] = { V8PerIsolateData::from(isolate)->rawTe
mplate(&V8TestInterfaceImplementedAs::info, currentWorldType) }; | 185 v8::Handle<v8::FunctionTemplate> funcTestInterfaceImplementedAsParamArgv[fun
cTestInterfaceImplementedAsParamArgc] = { V8PerIsolateData::from(isolate)->rawTe
mplate(&V8TestInterfaceImplementedAs::wrapperTypeInfo, currentWorldType) }; |
| 186 v8::Handle<v8::Signature> funcTestInterfaceImplementedAsParamSignature = v8:
:Signature::New(desc, funcTestInterfaceImplementedAsParamArgc, funcTestInterface
ImplementedAsParamArgv); | 186 v8::Handle<v8::Signature> funcTestInterfaceImplementedAsParamSignature = v8:
:Signature::New(desc, funcTestInterfaceImplementedAsParamArgc, funcTestInterface
ImplementedAsParamArgv); |
| 187 proto->Set(v8::String::NewSymbol("funcTestInterfaceImplementedAsParam"), v8:
:FunctionTemplate::New(RealClassV8Internal::funcTestInterfaceImplementedAsParamM
ethodCallback, v8Undefined(), funcTestInterfaceImplementedAsParamSignature, 1)); | 187 proto->Set(v8::String::NewSymbol("funcTestInterfaceImplementedAsParam"), v8:
:FunctionTemplate::New(RealClassV8Internal::funcTestInterfaceImplementedAsParamM
ethodCallback, v8Undefined(), funcTestInterfaceImplementedAsParamSignature, 1)); |
| 188 | 188 |
| 189 // Custom toString template | 189 // Custom toString template |
| 190 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 190 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
| 191 return desc; | 191 return desc; |
| 192 } | 192 } |
| 193 | 193 |
| 194 v8::Handle<v8::FunctionTemplate> V8TestInterfaceImplementedAs::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) | 194 v8::Handle<v8::FunctionTemplate> V8TestInterfaceImplementedAs::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) |
| 195 { | 195 { |
| 196 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 196 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 197 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); | 197 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 198 if (result != data->templateMap(currentWorldType).end()) | 198 if (result != data->templateMap(currentWorldType).end()) |
| 199 return result->value.newLocal(isolate); | 199 return result->value.newLocal(isolate); |
| 200 | 200 |
| 201 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 201 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 202 v8::HandleScope handleScope(isolate); | 202 v8::HandleScope handleScope(isolate); |
| 203 v8::Handle<v8::FunctionTemplate> templ = | 203 v8::Handle<v8::FunctionTemplate> templ = |
| 204 ConfigureV8TestInterfaceImplementedAsTemplate(data->rawTemplate(&info, c
urrentWorldType), isolate, currentWorldType); | 204 ConfigureV8TestInterfaceImplementedAsTemplate(data->rawTemplate(&wrapper
TypeInfo, currentWorldType), isolate, currentWorldType); |
| 205 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); | 205 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 206 return handleScope.Close(templ); | 206 return handleScope.Close(templ); |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool V8TestInterfaceImplementedAs::HasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 209 bool V8TestInterfaceImplementedAs::HasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) |
| 210 { | 210 { |
| 211 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, currentW
orldType); | 211 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 212 } | 212 } |
| 213 | 213 |
| 214 bool V8TestInterfaceImplementedAs::HasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) | 214 bool V8TestInterfaceImplementedAs::HasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) |
| 215 { | 215 { |
| 216 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, MainWorl
d) | 216 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 217 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, Isolated
World) | 217 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 218 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, WorkerWo
rld); | 218 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 219 } | 219 } |
| 220 | 220 |
| 221 v8::Handle<v8::Object> V8TestInterfaceImplementedAs::createWrapper(PassRefPtr<Re
alClass> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 221 v8::Handle<v8::Object> V8TestInterfaceImplementedAs::createWrapper(PassRefPtr<Re
alClass> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 222 { | 222 { |
| 223 ASSERT(impl); | 223 ASSERT(impl); |
| 224 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceImplementedAs>(impl.get
(), isolate)); | 224 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceImplementedAs>(impl.get
(), isolate)); |
| 225 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 225 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 226 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 226 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 227 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 227 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 228 // the same object de-ref functions, though, so use that as the basis of
the check. | 228 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 229 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); | 229 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 230 } | 230 } |
| 231 | 231 |
| 232 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); | 232 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 233 if (UNLIKELY(wrapper.IsEmpty())) | 233 if (UNLIKELY(wrapper.IsEmpty())) |
| 234 return wrapper; | 234 return wrapper; |
| 235 | 235 |
| 236 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 236 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 237 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceImplementedAs>(impl,
&info, wrapper, isolate, WrapperConfiguration::Independent); | 237 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceImplementedAs>(impl,
&wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 238 return wrapper; | 238 return wrapper; |
| 239 } | 239 } |
| 240 | 240 |
| 241 void V8TestInterfaceImplementedAs::derefObject(void* object) | 241 void V8TestInterfaceImplementedAs::derefObject(void* object) |
| 242 { | 242 { |
| 243 fromInternalPointer(object)->deref(); | 243 fromInternalPointer(object)->deref(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace WebCore | 246 } // namespace WebCore |
| OLD | NEW |