| 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 "V8TestInterfacePython3.h" | 34 #include "V8TestInterfacePython4.h" |
| 35 | 35 |
| 36 #include "RuntimeEnabledFeatures.h" | 36 #include "RuntimeEnabledFeatures.h" |
| 37 #include "bindings/v8/ExceptionState.h" | 37 #include "bindings/v8/ExceptionState.h" |
| 38 #include "bindings/v8/V8DOMConfiguration.h" | 38 #include "bindings/v8/V8DOMConfiguration.h" |
| 39 #include "bindings/v8/V8GCController.h" |
| 39 #include "bindings/v8/V8ObjectConstructor.h" | 40 #include "bindings/v8/V8ObjectConstructor.h" |
| 40 #include "core/dom/ContextFeatures.h" | 41 #include "core/dom/ContextFeatures.h" |
| 41 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
| 43 #include "core/dom/Element.h" |
| 42 #include "platform/TraceEvent.h" | 44 #include "platform/TraceEvent.h" |
| 43 #include "wtf/GetPtr.h" | 45 #include "wtf/GetPtr.h" |
| 44 #include "wtf/RefPtr.h" | 46 #include "wtf/RefPtr.h" |
| 45 | 47 |
| 46 namespace WebCore { | 48 namespace WebCore { |
| 47 | 49 |
| 48 static void initializeScriptWrappableForInterface(TestInterfacePython3* object) | 50 static void initializeScriptWrappableForInterface(TestInterfacePython4* object) |
| 49 { | 51 { |
| 50 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | 52 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) |
| 51 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython3::wr
apperTypeInfo); | 53 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython4::wr
apperTypeInfo); |
| 52 else | 54 else |
| 53 ASSERT_NOT_REACHED(); | 55 ASSERT_NOT_REACHED(); |
| 54 } | 56 } |
| 55 | 57 |
| 56 } // namespace WebCore | 58 } // namespace WebCore |
| 57 | 59 |
| 58 // In ScriptWrappable::init, the use of a local function declaration has an issu
e on Windows: | 60 // 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 | 61 // the local declaration does not pick up the surrounding namespace. Therefore,
we provide this function |
| 60 // in the global namespace. | 62 // 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) | 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) |
| 62 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython3*
object) | 64 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython4*
object) |
| 63 { | 65 { |
| 64 WebCore::initializeScriptWrappableForInterface(object); | 66 WebCore::initializeScriptWrappableForInterface(object); |
| 65 } | 67 } |
| 66 | 68 |
| 67 namespace WebCore { | 69 namespace WebCore { |
| 68 const WrapperTypeInfo V8TestInterfacePython3::wrapperTypeInfo = { gin::kEmbedder
Blink, V8TestInterfacePython3::domTemplate, V8TestInterfacePython3::derefObject,
0, 0, V8TestInterfacePython3::visitDOMWrapper, V8TestInterfacePython3::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; | 70 const WrapperTypeInfo V8TestInterfacePython4::wrapperTypeInfo = { gin::kEmbedder
Blink, V8TestInterfacePython4::domTemplate, V8TestInterfacePython4::derefObject,
0, 0, V8TestInterfacePython4::visitDOMWrapper, V8TestInterfacePython4::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; |
| 69 | 71 |
| 70 namespace TestInterfacePython3V8Internal { | 72 namespace TestInterfacePython4V8Internal { |
| 71 | 73 |
| 72 template <typename T> void V8_USE(T) { } | 74 template <typename T> void V8_USE(T) { } |
| 73 | 75 |
| 74 } // namespace TestInterfacePython3V8Internal | 76 } // namespace TestInterfacePython4V8Internal |
| 75 | 77 |
| 76 static void configureV8TestInterfacePython3Template(v8::Handle<v8::FunctionTempl
ate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 78 void V8TestInterfacePython4::visitDOMWrapper(void* object, const v8::Persistent<
v8::Object>& wrapper, v8::Isolate* isolate) |
| 79 { |
| 80 TestInterfacePython4* impl = fromInternalPointer(object); |
| 81 Node* root = V8GCController::opaqueRootForGC(&impl->document(), isolate); |
| 82 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(root)
), wrapper); |
| 83 } |
| 84 |
| 85 static void configureV8TestInterfacePython4Template(v8::Handle<v8::FunctionTempl
ate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 77 { | 86 { |
| 78 functionTemplate->ReadOnlyPrototype(); | 87 functionTemplate->ReadOnlyPrototype(); |
| 79 | 88 |
| 80 v8::Local<v8::Signature> defaultSignature; | 89 v8::Local<v8::Signature> defaultSignature; |
| 81 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython3::internalFieldCount, | 90 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython4", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython4::internalFieldCount, |
| 82 0, 0, | 91 0, 0, |
| 83 0, 0, | 92 0, 0, |
| 84 0, 0, | 93 0, 0, |
| 85 isolate, currentWorldType); | 94 isolate, currentWorldType); |
| 86 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 95 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 87 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 96 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 88 | 97 |
| 89 // Custom toString template | 98 // Custom toString template |
| 90 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 99 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
| 91 } | 100 } |
| 92 | 101 |
| 93 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython3::domTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 102 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython4::domTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) |
| 94 { | 103 { |
| 95 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 104 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 96 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 105 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 97 if (result != data->templateMap(currentWorldType).end()) | 106 if (result != data->templateMap(currentWorldType).end()) |
| 98 return result->value.newLocal(isolate); | 107 return result->value.newLocal(isolate); |
| 99 | 108 |
| 100 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 109 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 101 v8::EscapableHandleScope handleScope(isolate); | 110 v8::EscapableHandleScope handleScope(isolate); |
| 102 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 111 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 103 configureV8TestInterfacePython3Template(templ, isolate, currentWorldType); | 112 configureV8TestInterfacePython4Template(templ, isolate, currentWorldType); |
| 104 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 113 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 105 return handleScope.Escape(templ); | 114 return handleScope.Escape(templ); |
| 106 } | 115 } |
| 107 | 116 |
| 108 bool V8TestInterfacePython3::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) | 117 bool V8TestInterfacePython4::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) |
| 109 { | 118 { |
| 110 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 119 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 111 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 120 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 112 } | 121 } |
| 113 | 122 |
| 114 TestInterfacePython3* V8TestInterfacePython3::toNativeWithTypeCheck(v8::Isolate*
isolate, v8::Handle<v8::Value> value) | 123 TestInterfacePython4* V8TestInterfacePython4::toNativeWithTypeCheck(v8::Isolate*
isolate, v8::Handle<v8::Value> value) |
| 115 { | 124 { |
| 116 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | 125 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 117 } | 126 } |
| 118 | 127 |
| 119 v8::Handle<v8::Object> V8TestInterfacePython3::createWrapper(PassRefPtr<TestInte
rfacePython3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) | 128 v8::Handle<v8::Object> V8TestInterfacePython4::createWrapper(PassRefPtr<TestInte
rfacePython4> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) |
| 120 { | 129 { |
| 121 ASSERT(impl); | 130 ASSERT(impl); |
| 122 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython3>(impl.get(), is
olate)); | 131 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython4>(impl.get(), is
olate)); |
| 123 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 132 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 124 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 133 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 125 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 134 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 126 // the same object de-ref functions, though, so use that as the basis of
the check. | 135 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 127 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 136 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 128 } | 137 } |
| 129 | 138 |
| 130 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 139 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 131 if (UNLIKELY(wrapper.IsEmpty())) | 140 if (UNLIKELY(wrapper.IsEmpty())) |
| 132 return wrapper; | 141 return wrapper; |
| 133 | 142 |
| 134 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 143 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 135 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython3>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); | 144 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython4>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); |
| 136 return wrapper; | 145 return wrapper; |
| 137 } | 146 } |
| 138 | 147 |
| 139 void V8TestInterfacePython3::derefObject(void* object) | 148 void V8TestInterfacePython4::derefObject(void* object) |
| 140 { | 149 { |
| 141 fromInternalPointer(object)->deref(); | 150 fromInternalPointer(object)->deref(); |
| 142 } | 151 } |
| 143 | 152 |
| 144 template<> | 153 template<> |
| 145 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython3* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 154 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython4* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
| 146 { | 155 { |
| 147 return toV8(impl, creationContext, isolate); | 156 return toV8(impl, creationContext, isolate); |
| 148 } | 157 } |
| 149 | 158 |
| 150 } // namespace WebCore | 159 } // namespace WebCore |
| OLD | NEW |