| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! |
| 32 | 32 |
| 33 #include "config.h" | 33 #include "config.h" |
| 34 #include "V8TestGenerateVisitDOMWrapperInterface.h" | 34 #if ENABLE(CONDITION) |
| 35 #include "V8TestInterfacePython.h" |
| 35 | 36 |
| 36 #include "RuntimeEnabledFeatures.h" | 37 #include "RuntimeEnabledFeatures.h" |
| 37 #include "bindings/v8/ScriptController.h" | 38 #include "bindings/v8/ScriptController.h" |
| 38 #include "bindings/v8/V8Binding.h" | 39 #include "bindings/v8/V8Binding.h" |
| 39 #include "bindings/v8/V8DOMConfiguration.h" | 40 #include "bindings/v8/V8DOMConfiguration.h" |
| 40 #include "bindings/v8/V8DOMWrapper.h" | 41 #include "bindings/v8/V8DOMWrapper.h" |
| 41 #include "bindings/v8/V8GCController.h" | 42 #include "bindings/v8/V8GCController.h" |
| 42 #include "core/dom/ContextFeatures.h" | 43 #include "core/dom/ContextFeatures.h" |
| 43 #include "core/dom/Document.h" | 44 #include "core/dom/Document.h" |
| 44 #include "core/dom/Element.h" | 45 #include "core/dom/Element.h" |
| 45 #include "platform/TraceEvent.h" | 46 #include "platform/TraceEvent.h" |
| 46 #include "wtf/UnusedParam.h" | 47 #include "wtf/UnusedParam.h" |
| 47 | 48 |
| 48 namespace WebCore { | 49 namespace WebCore { |
| 49 | 50 |
| 50 static void initializeScriptWrappableForInterface(TestGenerateVisitDOMWrapperInt
erface* object) | 51 static void initializeScriptWrappableForInterface(TestInterfacePython* object) |
| 51 { | 52 { |
| 52 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 53 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 53 ScriptWrappable::setTypeInfoInObject(object, &V8TestGenerateVisitDOMWrap
perInterface::wrapperTypeInfo); | 54 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython::wra
pperTypeInfo); |
| 54 else | 55 else |
| 55 ASSERT_NOT_REACHED(); | 56 ASSERT_NOT_REACHED(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 } // namespace WebCore | 59 } // namespace WebCore |
| 59 | 60 |
| 60 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 61 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 61 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 62 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 62 // in the global namespace. | 63 // in the global namespace. |
| 63 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 64 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 64 void webCoreInitializeScriptWrappableForInterface(WebCore::TestGenerateVisitDOMW
rapperInterface* object) | 65 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython*
object) |
| 65 { | 66 { |
| 66 WebCore::initializeScriptWrappableForInterface(object); | 67 WebCore::initializeScriptWrappableForInterface(object); |
| 67 } | 68 } |
| 68 | 69 |
| 69 namespace WebCore { | 70 namespace WebCore { |
| 70 const WrapperTypeInfo V8TestGenerateVisitDOMWrapperInterface::wrapperTypeInfo =
{ gin::kEmbedderBlink, V8TestGenerateVisitDOMWrapperInterface::GetTemplate, V8Te
stGenerateVisitDOMWrapperInterface::derefObject, 0, 0, V8TestGenerateVisitDOMWra
pperInterface::visitDOMWrapper, V8TestGenerateVisitDOMWrapperInterface::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype }; | 71 const WrapperTypeInfo V8TestInterfacePython::wrapperTypeInfo = { gin::kEmbedderB
link, V8TestInterfacePython::GetTemplate, V8TestInterfacePython::derefObject, V8
TestInterfacePython::toActiveDOMObject, 0, V8TestInterfacePython::visitDOMWrappe
r, V8TestInterfacePython::installPerContextEnabledMethods, 0, WrapperTypeObjectP
rototype }; |
| 71 | 72 |
| 72 namespace TestGenerateVisitDOMWrapperInterfaceV8Internal { | 73 namespace TestInterfacePythonV8Internal { |
| 73 | 74 |
| 74 template <typename T> void V8_USE(T) { } | 75 template <typename T> void V8_USE(T) { } |
| 75 | 76 |
| 76 } // namespace TestGenerateVisitDOMWrapperInterfaceV8Internal | 77 } // namespace TestInterfacePythonV8Internal |
| 77 | 78 |
| 78 void V8TestGenerateVisitDOMWrapperInterface::visitDOMWrapper(void* object, const
v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate) | 79 void V8TestInterfacePython::visitDOMWrapper(void* object, const v8::Persistent<v
8::Object>& wrapper, v8::Isolate* isolate) |
| 79 { | 80 { |
| 80 TestGenerateVisitDOMWrapperInterface* impl = fromInternalPointer(object); | 81 TestInterfacePython* impl = fromInternalPointer(object); |
| 81 if (Node* owner = impl->ownerNode()) { | 82 if (Node* owner = impl->ownerNode()) { |
| 82 setObjectGroup(V8GCController::opaqueRootForGC(owner, isolate), wrapper,
isolate); | 83 setObjectGroup(V8GCController::opaqueRootForGC(owner, isolate), wrapper,
isolate); |
| 83 return; | 84 return; |
| 84 } | 85 } |
| 85 setObjectGroup(object, wrapper, isolate); | 86 setObjectGroup(object, wrapper, isolate); |
| 86 } | 87 } |
| 87 | 88 |
| 88 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestGenerateVisitDOMWrapperIn
terfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate*
isolate, WrapperWorldType currentWorldType) | 89 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfacePythonTemplate(v
8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperW
orldType currentWorldType) |
| 89 { | 90 { |
| 90 functionTemplate->ReadOnlyPrototype(); | 91 functionTemplate->ReadOnlyPrototype(); |
| 91 | 92 |
| 92 v8::Local<v8::Signature> defaultSignature; | 93 v8::Local<v8::Signature> defaultSignature; |
| 93 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestGenerateVisitDOMWrapperInterface", v8::Local<v8::FunctionTemplate>(),
V8TestGenerateVisitDOMWrapperInterface::internalFieldCount, | 94 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython", v8::Local<v8::FunctionTemplate>(), V8TestInterfacePy
thon::internalFieldCount, |
| 94 0, 0, | 95 0, 0, |
| 95 0, 0, | 96 0, 0, |
| 96 0, 0, | 97 0, 0, |
| 97 isolate, currentWorldType); | 98 isolate, currentWorldType); |
| 98 UNUSED_PARAM(defaultSignature); | 99 UNUSED_PARAM(defaultSignature); |
| 99 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 100 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 100 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 101 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 101 UNUSED_PARAM(instanceTemplate); | 102 UNUSED_PARAM(instanceTemplate); |
| 102 UNUSED_PARAM(prototypeTemplate); | 103 UNUSED_PARAM(prototypeTemplate); |
| 104 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestInterfa
cePython::legacyCallCustom); |
| 103 | 105 |
| 104 // Custom toString template | 106 // Custom toString template |
| 105 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 107 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 106 return functionTemplate; | 108 return functionTemplate; |
| 107 } | 109 } |
| 108 | 110 |
| 109 v8::Handle<v8::FunctionTemplate> V8TestGenerateVisitDOMWrapperInterface::GetTemp
late(v8::Isolate* isolate, WrapperWorldType currentWorldType) | 111 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython::GetTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) |
| 110 { | 112 { |
| 111 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 113 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 112 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 114 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 113 if (result != data->templateMap(currentWorldType).end()) | 115 if (result != data->templateMap(currentWorldType).end()) |
| 114 return result->value.newLocal(isolate); | 116 return result->value.newLocal(isolate); |
| 115 | 117 |
| 116 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 118 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 117 v8::EscapableHandleScope handleScope(isolate); | 119 v8::EscapableHandleScope handleScope(isolate); |
| 118 v8::Local<v8::FunctionTemplate> templ = | 120 v8::Local<v8::FunctionTemplate> templ = |
| 119 ConfigureV8TestGenerateVisitDOMWrapperInterfaceTemplate(data->rawTemplat
e(&wrapperTypeInfo, currentWorldType), isolate, currentWorldType); | 121 ConfigureV8TestInterfacePythonTemplate(data->rawTemplate(&wrapperTypeInf
o, currentWorldType), isolate, currentWorldType); |
| 120 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 122 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 121 return handleScope.Escape(templ); | 123 return handleScope.Escape(templ); |
| 122 } | 124 } |
| 123 | 125 |
| 124 bool V8TestGenerateVisitDOMWrapperInterface::hasInstance(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 126 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate, WrapperWorldType currentWorldType) |
| 125 { | 127 { |
| 126 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 128 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 127 } | 129 } |
| 128 | 130 |
| 129 bool V8TestGenerateVisitDOMWrapperInterface::hasInstanceInAnyWorld(v8::Handle<v8
::Value> jsValue, v8::Isolate* isolate) | 131 bool V8TestInterfacePython::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) |
| 130 { | 132 { |
| 131 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 133 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 132 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 134 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 133 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 135 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 134 } | 136 } |
| 135 | 137 |
| 136 v8::Handle<v8::Object> V8TestGenerateVisitDOMWrapperInterface::createWrapper(Pas
sRefPtr<TestGenerateVisitDOMWrapperInterface> impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) | 138 ActiveDOMObject* V8TestInterfacePython::toActiveDOMObject(v8::Handle<v8::Object>
wrapper) |
| 139 { |
| 140 return toNative(wrapper); |
| 141 } |
| 142 |
| 143 v8::Handle<v8::Object> V8TestInterfacePython::createWrapper(PassRefPtr<TestInter
facePython> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 137 { | 144 { |
| 138 ASSERT(impl); | 145 ASSERT(impl); |
| 139 ASSERT(!DOMDataStore::containsWrapper<V8TestGenerateVisitDOMWrapperInterface
>(impl.get(), isolate)); | 146 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython>(impl.get(), iso
late)); |
| 140 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 147 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 141 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 148 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 142 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 149 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 143 // the same object de-ref functions, though, so use that as the basis of
the check. | 150 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 144 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 151 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 145 } | 152 } |
| 146 | 153 |
| 147 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 154 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 148 if (UNLIKELY(wrapper.IsEmpty())) | 155 if (UNLIKELY(wrapper.IsEmpty())) |
| 149 return wrapper; | 156 return wrapper; |
| 150 | 157 |
| 151 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 158 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 152 V8DOMWrapper::associateObjectWithWrapper<V8TestGenerateVisitDOMWrapperInterf
ace>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); | 159 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython>(impl, &wrapp
erTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); |
| 153 return wrapper; | 160 return wrapper; |
| 154 } | 161 } |
| 155 | 162 |
| 156 void V8TestGenerateVisitDOMWrapperInterface::derefObject(void* object) | 163 void V8TestInterfacePython::derefObject(void* object) |
| 157 { | 164 { |
| 158 fromInternalPointer(object)->deref(); | 165 fromInternalPointer(object)->deref(); |
| 159 } | 166 } |
| 160 | 167 |
| 161 template<> | 168 template<> |
| 162 v8::Handle<v8::Value> toV8NoInline(TestGenerateVisitDOMWrapperInterface* impl, v
8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 169 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython* impl, v8::Handle<v8::Obj
ect> creationContext, v8::Isolate* isolate) |
| 163 { | 170 { |
| 164 return toV8(impl, creationContext, isolate); | 171 return toV8(impl, creationContext, isolate); |
| 165 } | 172 } |
| 166 | 173 |
| 167 } // namespace WebCore | 174 } // namespace WebCore |
| 175 #endif // ENABLE(CONDITION) |
| OLD | NEW |