| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY! | |
| 32 | |
| 33 #include "config.h" | |
| 34 #include "V8TestInterfacePython4.h" | |
| 35 | |
| 36 #include "RuntimeEnabledFeatures.h" | |
| 37 #include "bindings/v8/ExceptionState.h" | |
| 38 #include "bindings/v8/V8DOMConfiguration.h" | |
| 39 #include "bindings/v8/V8GCController.h" | |
| 40 #include "bindings/v8/V8ObjectConstructor.h" | |
| 41 #include "core/dom/ContextFeatures.h" | |
| 42 #include "core/dom/Document.h" | |
| 43 #include "core/dom/Element.h" | |
| 44 #include "platform/TraceEvent.h" | |
| 45 #include "wtf/GetPtr.h" | |
| 46 #include "wtf/RefPtr.h" | |
| 47 | |
| 48 namespace WebCore { | |
| 49 | |
| 50 static void initializeScriptWrappableForInterface(TestInterfacePython4* object) | |
| 51 { | |
| 52 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | |
| 53 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython4::wr
apperTypeInfo); | |
| 54 else | |
| 55 ASSERT_NOT_REACHED(); | |
| 56 } | |
| 57 | |
| 58 } // namespace WebCore | |
| 59 | |
| 60 // 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 // 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 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython4*
object) | |
| 65 { | |
| 66 WebCore::initializeScriptWrappableForInterface(object); | |
| 67 } | |
| 68 | |
| 69 namespace WebCore { | |
| 70 const WrapperTypeInfo V8TestInterfacePython4::wrapperTypeInfo = { gin::kEmbedder
Blink, V8TestInterfacePython4::domTemplate, V8TestInterfacePython4::derefObject,
0, 0, V8TestInterfacePython4::visitDOMWrapper, V8TestInterfacePython4::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; | |
| 71 | |
| 72 namespace TestInterfacePython4V8Internal { | |
| 73 | |
| 74 template <typename T> void V8_USE(T) { } | |
| 75 | |
| 76 } // namespace TestInterfacePython4V8Internal | |
| 77 | |
| 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) | |
| 86 { | |
| 87 functionTemplate->ReadOnlyPrototype(); | |
| 88 | |
| 89 v8::Local<v8::Signature> defaultSignature; | |
| 90 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython4", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython4::internalFieldCount, | |
| 91 0, 0, | |
| 92 0, 0, | |
| 93 0, 0, | |
| 94 isolate, currentWorldType); | |
| 95 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | |
| 96 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | |
| 97 | |
| 98 // Custom toString template | |
| 99 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | |
| 100 } | |
| 101 | |
| 102 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython4::domTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) | |
| 103 { | |
| 104 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 105 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | |
| 106 if (result != data->templateMap(currentWorldType).end()) | |
| 107 return result->value.newLocal(isolate); | |
| 108 | |
| 109 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
| 110 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | |
| 111 configureV8TestInterfacePython4Template(templ, isolate, currentWorldType); | |
| 112 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | |
| 113 return templ; | |
| 114 } | |
| 115 | |
| 116 bool V8TestInterfacePython4::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) | |
| 117 { | |
| 118 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | |
| 119 } | |
| 120 | |
| 121 v8::Handle<v8::Object> V8TestInterfacePython4::findInstanceInPrototypeChain(v8::
Handle<v8::Value> jsValue, v8::Isolate* isolate) | |
| 122 { | |
| 123 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, jsValue); | |
| 124 } | |
| 125 | |
| 126 TestInterfacePython4* V8TestInterfacePython4::toNativeWithTypeCheck(v8::Isolate*
isolate, v8::Handle<v8::Value> value) | |
| 127 { | |
| 128 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | |
| 129 } | |
| 130 | |
| 131 v8::Handle<v8::Object> V8TestInterfacePython4::createWrapper(PassRefPtr<TestInte
rfacePython4> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) | |
| 132 { | |
| 133 ASSERT(impl); | |
| 134 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython4>(impl.get(), is
olate)); | |
| 135 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | |
| 136 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | |
| 137 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | |
| 138 // the same object de-ref functions, though, so use that as the basis of
the check. | |
| 139 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | |
| 140 } | |
| 141 | |
| 142 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | |
| 143 if (UNLIKELY(wrapper.IsEmpty())) | |
| 144 return wrapper; | |
| 145 | |
| 146 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | |
| 147 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython4>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); | |
| 148 return wrapper; | |
| 149 } | |
| 150 | |
| 151 void V8TestInterfacePython4::derefObject(void* object) | |
| 152 { | |
| 153 fromInternalPointer(object)->deref(); | |
| 154 } | |
| 155 | |
| 156 template<> | |
| 157 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython4* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | |
| 158 { | |
| 159 return toV8(impl, creationContext, isolate); | |
| 160 } | |
| 161 | |
| 162 } // namespace WebCore | |
| OLD | NEW |