| 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/dom/ContextFeatures.h" | 29 #include "core/dom/ContextFeatures.h" |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "platform/TraceEvent.h" | 31 #include "platform/TraceEvent.h" |
| 32 #include "wtf/UnusedParam.h" | 32 #include "wtf/UnusedParam.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 static void initializeScriptWrappableForInterface(TestInterfaceEmpty* object) | 36 static void initializeScriptWrappableForInterface(TestInterfaceEmpty* object) |
| 37 { | 37 { |
| 38 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 38 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 39 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceEmpty::info
); | 39 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceEmpty::wrap
perTypeInfo); |
| 40 else | 40 else |
| 41 ASSERT_NOT_REACHED(); | 41 ASSERT_NOT_REACHED(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace WebCore | 44 } // namespace WebCore |
| 45 | 45 |
| 46 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 46 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 47 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 47 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 48 // in the global namespace. | 48 // in the global namespace. |
| 49 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 49 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 50 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceEmpty* o
bject) | 50 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceEmpty* o
bject) |
| 51 { | 51 { |
| 52 WebCore::initializeScriptWrappableForInterface(object); | 52 WebCore::initializeScriptWrappableForInterface(object); |
| 53 } | 53 } |
| 54 | 54 |
| 55 namespace WebCore { | 55 namespace WebCore { |
| 56 WrapperTypeInfo V8TestInterfaceEmpty::info = { V8TestInterfaceEmpty::GetTemplate
, V8TestInterfaceEmpty::derefObject, 0, 0, 0, V8TestInterfaceEmpty::installPerCo
ntextEnabledPrototypeProperties, 0, WrapperTypeObjectPrototype }; | 56 WrapperTypeInfo V8TestInterfaceEmpty::wrapperTypeInfo = { V8TestInterfaceEmpty::
GetTemplate, V8TestInterfaceEmpty::derefObject, 0, 0, 0, V8TestInterfaceEmpty::i
nstallPerContextEnabledPrototypeProperties, 0, WrapperTypeObjectPrototype }; |
| 57 | 57 |
| 58 namespace TestInterfaceEmptyV8Internal { | 58 namespace TestInterfaceEmptyV8Internal { |
| 59 | 59 |
| 60 template <typename T> void V8_USE(T) { } | 60 template <typename T> void V8_USE(T) { } |
| 61 | 61 |
| 62 } // namespace TestInterfaceEmptyV8Internal | 62 } // namespace TestInterfaceEmptyV8Internal |
| 63 | 63 |
| 64 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceEmptyTemplate(v8
::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType curr
entWorldType) | 64 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceEmptyTemplate(v8
::Handle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType curr
entWorldType) |
| 65 { | 65 { |
| 66 desc->ReadOnlyPrototype(); | 66 desc->ReadOnlyPrototype(); |
| 67 | 67 |
| 68 v8::Local<v8::Signature> defaultSignature; | 68 v8::Local<v8::Signature> defaultSignature; |
| 69 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "TestIn
terfaceEmpty", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceEmpty::internal
FieldCount, | 69 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "TestIn
terfaceEmpty", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceEmpty::internal
FieldCount, |
| 70 0, 0, | 70 0, 0, |
| 71 0, 0, isolate, currentWorldType); | 71 0, 0, isolate, currentWorldType); |
| 72 UNUSED_PARAM(defaultSignature); | 72 UNUSED_PARAM(defaultSignature); |
| 73 | 73 |
| 74 // Custom toString template | 74 // Custom toString template |
| 75 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 75 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
| 76 return desc; | 76 return desc; |
| 77 } | 77 } |
| 78 | 78 |
| 79 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEmpty::GetTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) | 79 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEmpty::GetTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) |
| 80 { | 80 { |
| 81 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 81 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 82 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); | 82 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 83 if (result != data->templateMap(currentWorldType).end()) | 83 if (result != data->templateMap(currentWorldType).end()) |
| 84 return result->value.newLocal(isolate); | 84 return result->value.newLocal(isolate); |
| 85 | 85 |
| 86 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 86 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 87 v8::HandleScope handleScope(isolate); | 87 v8::HandleScope handleScope(isolate); |
| 88 v8::Handle<v8::FunctionTemplate> templ = | 88 v8::Handle<v8::FunctionTemplate> templ = |
| 89 ConfigureV8TestInterfaceEmptyTemplate(data->rawTemplate(&info, currentWo
rldType), isolate, currentWorldType); | 89 ConfigureV8TestInterfaceEmptyTemplate(data->rawTemplate(&wrapperTypeInfo
, currentWorldType), isolate, currentWorldType); |
| 90 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); | 90 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 91 return handleScope.Close(templ); | 91 return handleScope.Close(templ); |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool V8TestInterfaceEmpty::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isolat
e* isolate, WrapperWorldType currentWorldType) | 94 bool V8TestInterfaceEmpty::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isolat
e* isolate, WrapperWorldType currentWorldType) |
| 95 { | 95 { |
| 96 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, currentW
orldType); | 96 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool V8TestInterfaceEmpty::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) | 99 bool V8TestInterfaceEmpty::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) |
| 100 { | 100 { |
| 101 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, MainWorl
d) | 101 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 102 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, Isolated
World) | 102 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 103 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, WorkerWo
rld); | 103 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 104 } | 104 } |
| 105 | 105 |
| 106 v8::Handle<v8::Object> V8TestInterfaceEmpty::createWrapper(PassRefPtr<TestInterf
aceEmpty> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 106 v8::Handle<v8::Object> V8TestInterfaceEmpty::createWrapper(PassRefPtr<TestInterf
aceEmpty> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 107 { | 107 { |
| 108 ASSERT(impl); | 108 ASSERT(impl); |
| 109 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEmpty>(impl.get(), isol
ate)); | 109 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEmpty>(impl.get(), isol
ate)); |
| 110 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 110 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 111 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 111 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 112 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 112 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 113 // the same object de-ref functions, though, so use that as the basis of
the check. | 113 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 114 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); | 114 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 115 } | 115 } |
| 116 | 116 |
| 117 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); | 117 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 118 if (UNLIKELY(wrapper.IsEmpty())) | 118 if (UNLIKELY(wrapper.IsEmpty())) |
| 119 return wrapper; | 119 return wrapper; |
| 120 | 120 |
| 121 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 121 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 122 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEmpty>(impl, &info,
wrapper, isolate, WrapperConfiguration::Independent); | 122 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEmpty>(impl, &wrappe
rTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 123 return wrapper; | 123 return wrapper; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void V8TestInterfaceEmpty::derefObject(void* object) | 126 void V8TestInterfaceEmpty::derefObject(void* object) |
| 127 { | 127 { |
| 128 fromInternalPointer(object)->deref(); | 128 fromInternalPointer(object)->deref(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace WebCore | 131 } // namespace WebCore |
| OLD | NEW |