| 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(TestConstants* object) | 36 static void initializeScriptWrappableForInterface(TestConstants* object) |
| 37 { | 37 { |
| 38 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 38 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 39 ScriptWrappable::setTypeInfoInObject(object, &V8TestConstants::info); | 39 ScriptWrappable::setTypeInfoInObject(object, &V8TestConstants::wrapperTy
peInfo); |
| 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::TestConstants* object
) | 50 void webCoreInitializeScriptWrappableForInterface(WebCore::TestConstants* object
) |
| 51 { | 51 { |
| 52 WebCore::initializeScriptWrappableForInterface(object); | 52 WebCore::initializeScriptWrappableForInterface(object); |
| 53 } | 53 } |
| 54 | 54 |
| 55 namespace WebCore { | 55 namespace WebCore { |
| 56 WrapperTypeInfo V8TestConstants::info = { V8TestConstants::GetTemplate, V8TestCo
nstants::derefObject, 0, 0, 0, V8TestConstants::installPerContextEnabledPrototyp
eProperties, 0, WrapperTypeObjectPrototype }; | 56 WrapperTypeInfo V8TestConstants::wrapperTypeInfo = { V8TestConstants::GetTemplat
e, V8TestConstants::derefObject, 0, 0, 0, V8TestConstants::installPerContextEnab
ledPrototypeProperties, 0, WrapperTypeObjectPrototype }; |
| 57 | 57 |
| 58 namespace TestConstantsV8Internal { | 58 namespace TestConstantsV8Internal { |
| 59 | 59 |
| 60 template <typename T> void V8_USE(T) { } | 60 template <typename T> void V8_USE(T) { } |
| 61 | 61 |
| 62 } // namespace TestConstantsV8Internal | 62 } // namespace TestConstantsV8Internal |
| 63 | 63 |
| 64 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestConstantsTemplate(v8::Han
dle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWo
rldType) | 64 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestConstantsTemplate(v8::Han
dle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWo
rldType) |
| 65 { | 65 { |
| 66 desc->ReadOnlyPrototype(); | 66 desc->ReadOnlyPrototype(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 COMPILE_ASSERT(1 == TestConstants::CONST_IMPL, TheValueOfTestConstants_CONST
_IMPLDoesntMatchWithImplementation); | 118 COMPILE_ASSERT(1 == TestConstants::CONST_IMPL, TheValueOfTestConstants_CONST
_IMPLDoesntMatchWithImplementation); |
| 119 | 119 |
| 120 // Custom toString template | 120 // Custom toString template |
| 121 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 121 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
| 122 return desc; | 122 return desc; |
| 123 } | 123 } |
| 124 | 124 |
| 125 v8::Handle<v8::FunctionTemplate> V8TestConstants::GetTemplate(v8::Isolate* isola
te, WrapperWorldType currentWorldType) | 125 v8::Handle<v8::FunctionTemplate> V8TestConstants::GetTemplate(v8::Isolate* isola
te, WrapperWorldType currentWorldType) |
| 126 { | 126 { |
| 127 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 127 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 128 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&info); | 128 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 129 if (result != data->templateMap(currentWorldType).end()) | 129 if (result != data->templateMap(currentWorldType).end()) |
| 130 return result->value.newLocal(isolate); | 130 return result->value.newLocal(isolate); |
| 131 | 131 |
| 132 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 132 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 133 v8::HandleScope handleScope(isolate); | 133 v8::HandleScope handleScope(isolate); |
| 134 v8::Handle<v8::FunctionTemplate> templ = | 134 v8::Handle<v8::FunctionTemplate> templ = |
| 135 ConfigureV8TestConstantsTemplate(data->rawTemplate(&info, currentWorldTy
pe), isolate, currentWorldType); | 135 ConfigureV8TestConstantsTemplate(data->rawTemplate(&wrapperTypeInfo, cur
rentWorldType), isolate, currentWorldType); |
| 136 data->templateMap(currentWorldType).add(&info, UnsafePersistent<v8::Function
Template>(isolate, templ)); | 136 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 137 return handleScope.Close(templ); | 137 return handleScope.Close(templ); |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool V8TestConstants::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is
olate, WrapperWorldType currentWorldType) | 140 bool V8TestConstants::HasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is
olate, WrapperWorldType currentWorldType) |
| 141 { | 141 { |
| 142 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, currentW
orldType); | 142 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool V8TestConstants::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I
solate* isolate) | 145 bool V8TestConstants::HasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I
solate* isolate) |
| 146 { | 146 { |
| 147 return V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, MainWorl
d) | 147 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 148 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, Isolated
World) | 148 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 149 || V8PerIsolateData::from(isolate)->hasInstance(&info, jsValue, WorkerWo
rld); | 149 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 150 } | 150 } |
| 151 | 151 |
| 152 v8::Handle<v8::Object> V8TestConstants::createWrapper(PassRefPtr<TestConstants>
impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 152 v8::Handle<v8::Object> V8TestConstants::createWrapper(PassRefPtr<TestConstants>
impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 153 { | 153 { |
| 154 ASSERT(impl); | 154 ASSERT(impl); |
| 155 ASSERT(!DOMDataStore::containsWrapper<V8TestConstants>(impl.get(), isolate))
; | 155 ASSERT(!DOMDataStore::containsWrapper<V8TestConstants>(impl.get(), isolate))
; |
| 156 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 156 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 157 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 157 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 158 // Might be a XXXConstructor::info instead of an XXX::info. These will b
oth have | 158 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 159 // the same object de-ref functions, though, so use that as the basis of
the check. | 159 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 160 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== info.derefObjectFunction); | 160 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 161 } | 161 } |
| 162 | 162 |
| 163 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &info, toInternalPointer(impl.get()), isolate); | 163 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 164 if (UNLIKELY(wrapper.IsEmpty())) | 164 if (UNLIKELY(wrapper.IsEmpty())) |
| 165 return wrapper; | 165 return wrapper; |
| 166 | 166 |
| 167 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 167 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 168 V8DOMWrapper::associateObjectWithWrapper<V8TestConstants>(impl, &info, wrapp
er, isolate, WrapperConfiguration::Independent); | 168 V8DOMWrapper::associateObjectWithWrapper<V8TestConstants>(impl, &wrapperType
Info, wrapper, isolate, WrapperConfiguration::Independent); |
| 169 return wrapper; | 169 return wrapper; |
| 170 } | 170 } |
| 171 | 171 |
| 172 void V8TestConstants::derefObject(void* object) | 172 void V8TestConstants::derefObject(void* object) |
| 173 { | 173 { |
| 174 fromInternalPointer(object)->deref(); | 174 fromInternalPointer(object)->deref(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace WebCore | 177 } // namespace WebCore |
| OLD | NEW |