| 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 "V8TestInterfaceEmpty.h" | 34 #include "V8TestActiveDOMObjectInterface.h" |
| 35 | 35 |
| 36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
| 37 #include "bindings/v8/ScriptController.h" | 37 #include "bindings/v8/ScriptController.h" |
| 38 #include "bindings/v8/V8Binding.h" | 38 #include "bindings/v8/V8Binding.h" |
| 39 #include "bindings/v8/V8DOMConfiguration.h" | 39 #include "bindings/v8/V8DOMConfiguration.h" |
| 40 #include "bindings/v8/V8DOMWrapper.h" | 40 #include "bindings/v8/V8DOMWrapper.h" |
| 41 #include "core/dom/ContextFeatures.h" | 41 #include "core/dom/ContextFeatures.h" |
| 42 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
| 43 #include "platform/TraceEvent.h" | 43 #include "platform/TraceEvent.h" |
| 44 #include "wtf/UnusedParam.h" | 44 #include "wtf/UnusedParam.h" |
| 45 | 45 |
| 46 namespace WebCore { | 46 namespace WebCore { |
| 47 | 47 |
| 48 static void initializeScriptWrappableForInterface(TestInterfaceEmpty* object) | 48 static void initializeScriptWrappableForInterface(TestActiveDOMObjectInterface*
object) |
| 49 { | 49 { |
| 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceEmpty::wrap
perTypeInfo); | 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestActiveDOMObjectInter
face::wrapperTypeInfo); |
| 52 else | 52 else |
| 53 ASSERT_NOT_REACHED(); | 53 ASSERT_NOT_REACHED(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace WebCore | 56 } // namespace WebCore |
| 57 | 57 |
| 58 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 58 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: |
| 59 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function | 59 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 60 // in the global namespace. | 60 // in the global namespace. |
| 61 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) | 61 // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/fe
edback/details/664619/the-namespace-of-local-function-declarations-in-c) |
| 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceEmpty* o
bject) | 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestActiveDOMObjectIn
terface* object) |
| 63 { | 63 { |
| 64 WebCore::initializeScriptWrappableForInterface(object); | 64 WebCore::initializeScriptWrappableForInterface(object); |
| 65 } | 65 } |
| 66 | 66 |
| 67 namespace WebCore { | 67 namespace WebCore { |
| 68 const WrapperTypeInfo V8TestInterfaceEmpty::wrapperTypeInfo = { V8TestInterfaceE
mpty::GetTemplate, V8TestInterfaceEmpty::derefObject, 0, 0, 0, V8TestInterfaceEm
pty::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype }; | 68 const WrapperTypeInfo V8TestActiveDOMObjectInterface::wrapperTypeInfo = { V8Test
ActiveDOMObjectInterface::GetTemplate, V8TestActiveDOMObjectInterface::derefObje
ct, V8TestActiveDOMObjectInterface::toActiveDOMObject, 0, 0, V8TestActiveDOMObje
ctInterface::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype }; |
| 69 | 69 |
| 70 namespace TestInterfaceEmptyV8Internal { | 70 namespace TestActiveDOMObjectInterfaceV8Internal { |
| 71 | 71 |
| 72 template <typename T> void V8_USE(T) { } | 72 template <typename T> void V8_USE(T) { } |
| 73 | 73 |
| 74 } // namespace TestInterfaceEmptyV8Internal | 74 } // namespace TestActiveDOMObjectInterfaceV8Internal |
| 75 | 75 |
| 76 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceEmptyTemplate(v8
::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWo
rldType currentWorldType) | 76 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestActiveDOMObjectInterfaceT
emplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate,
WrapperWorldType currentWorldType) |
| 77 { | 77 { |
| 78 functionTemplate->ReadOnlyPrototype(); | 78 functionTemplate->ReadOnlyPrototype(); |
| 79 | 79 |
| 80 v8::Local<v8::Signature> defaultSignature; | 80 v8::Local<v8::Signature> defaultSignature; |
| 81 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEmpty", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceEmp
ty::internalFieldCount, | 81 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestActiveDOMObjectInterface", v8::Local<v8::FunctionTemplate>(), V8TestAc
tiveDOMObjectInterface::internalFieldCount, |
| 82 0, 0, | 82 0, 0, |
| 83 0, 0, | 83 0, 0, |
| 84 0, 0, | 84 0, 0, |
| 85 isolate, currentWorldType); | 85 isolate, currentWorldType); |
| 86 UNUSED_PARAM(defaultSignature); | 86 UNUSED_PARAM(defaultSignature); |
| 87 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 87 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 88 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 88 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 89 UNUSED_PARAM(instanceTemplate); | 89 UNUSED_PARAM(instanceTemplate); |
| 90 UNUSED_PARAM(prototypeTemplate); | 90 UNUSED_PARAM(prototypeTemplate); |
| 91 | 91 |
| 92 // Custom toString template | 92 // Custom toString template |
| 93 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 93 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); |
| 94 return functionTemplate; | 94 return functionTemplate; |
| 95 } | 95 } |
| 96 | 96 |
| 97 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEmpty::GetTemplate(v8::Isolate*
isolate, WrapperWorldType currentWorldType) | 97 v8::Handle<v8::FunctionTemplate> V8TestActiveDOMObjectInterface::GetTemplate(v8:
:Isolate* isolate, WrapperWorldType currentWorldType) |
| 98 { | 98 { |
| 99 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 99 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 100 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 100 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 101 if (result != data->templateMap(currentWorldType).end()) | 101 if (result != data->templateMap(currentWorldType).end()) |
| 102 return result->value.newLocal(isolate); | 102 return result->value.newLocal(isolate); |
| 103 | 103 |
| 104 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 104 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 105 v8::HandleScope handleScope(isolate); | 105 v8::HandleScope handleScope(isolate); |
| 106 v8::Handle<v8::FunctionTemplate> templ = | 106 v8::Handle<v8::FunctionTemplate> templ = |
| 107 ConfigureV8TestInterfaceEmptyTemplate(data->rawTemplate(&wrapperTypeInfo
, currentWorldType), isolate, currentWorldType); | 107 ConfigureV8TestActiveDOMObjectInterfaceTemplate(data->rawTemplate(&wrapp
erTypeInfo, currentWorldType), isolate, currentWorldType); |
| 108 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 108 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 109 return handleScope.Close(templ); | 109 return handleScope.Close(templ); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool V8TestInterfaceEmpty::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolat
e* isolate, WrapperWorldType currentWorldType) | 112 bool V8TestActiveDOMObjectInterface::hasInstance(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 113 { | 113 { |
| 114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool V8TestInterfaceEmpty::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) | 117 bool V8TestActiveDOMObjectInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value>
jsValue, v8::Isolate* isolate) |
| 118 { | 118 { |
| 119 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 119 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 120 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 120 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 121 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 121 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 122 } | 122 } |
| 123 | 123 |
| 124 v8::Handle<v8::Object> V8TestInterfaceEmpty::createWrapper(PassRefPtr<TestInterf
aceEmpty> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 124 ActiveDOMObject* V8TestActiveDOMObjectInterface::toActiveDOMObject(v8::Handle<v8
::Object> object) |
| 125 { |
| 126 return toNative(object); |
| 127 } |
| 128 |
| 129 v8::Handle<v8::Object> V8TestActiveDOMObjectInterface::createWrapper(PassRefPtr<
TestActiveDOMObjectInterface> impl, v8::Handle<v8::Object> creationContext, v8::
Isolate* isolate) |
| 125 { | 130 { |
| 126 ASSERT(impl); | 131 ASSERT(impl); |
| 127 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEmpty>(impl.get(), isol
ate)); | 132 ASSERT(!DOMDataStore::containsWrapper<V8TestActiveDOMObjectInterface>(impl.g
et(), isolate)); |
| 128 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 133 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 129 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 134 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 130 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 135 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 131 // the same object de-ref functions, though, so use that as the basis of
the check. | 136 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 132 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 137 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 133 } | 138 } |
| 134 | 139 |
| 135 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 140 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 136 if (UNLIKELY(wrapper.IsEmpty())) | 141 if (UNLIKELY(wrapper.IsEmpty())) |
| 137 return wrapper; | 142 return wrapper; |
| 138 | 143 |
| 139 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 144 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 140 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEmpty>(impl, &wrappe
rTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | 145 V8DOMWrapper::associateObjectWithWrapper<V8TestActiveDOMObjectInterface>(imp
l, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); |
| 141 return wrapper; | 146 return wrapper; |
| 142 } | 147 } |
| 143 | 148 |
| 144 void V8TestInterfaceEmpty::derefObject(void* object) | 149 void V8TestActiveDOMObjectInterface::derefObject(void* object) |
| 145 { | 150 { |
| 146 fromInternalPointer(object)->deref(); | 151 fromInternalPointer(object)->deref(); |
| 147 } | 152 } |
| 148 | 153 |
| 149 } // namespace WebCore | 154 } // namespace WebCore |
| OLD | NEW |