| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | |
| 6 | |
| 7 #include "config.h" | |
| 8 #include "V8TestInterfacePython3.h" | |
| 9 | |
| 10 #include "RuntimeEnabledFeatures.h" | |
| 11 #include "bindings/v8/ExceptionState.h" | |
| 12 #include "bindings/v8/V8DOMConfiguration.h" | |
| 13 #include "bindings/v8/V8HiddenValue.h" | |
| 14 #include "bindings/v8/V8ObjectConstructor.h" | |
| 15 #include "core/dom/ContextFeatures.h" | |
| 16 #include "core/dom/Document.h" | |
| 17 #include "platform/TraceEvent.h" | |
| 18 #include "wtf/GetPtr.h" | |
| 19 #include "wtf/RefPtr.h" | |
| 20 | |
| 21 namespace WebCore { | |
| 22 | |
| 23 static void initializeScriptWrappableForInterface(TestInterfacePython3* object) | |
| 24 { | |
| 25 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | |
| 26 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython3::wr
apperTypeInfo); | |
| 27 else | |
| 28 ASSERT_NOT_REACHED(); | |
| 29 } | |
| 30 | |
| 31 } // namespace WebCore | |
| 32 | |
| 33 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython3*
object) | |
| 34 { | |
| 35 WebCore::initializeScriptWrappableForInterface(object); | |
| 36 } | |
| 37 | |
| 38 namespace WebCore { | |
| 39 const WrapperTypeInfo V8TestInterfacePython3::wrapperTypeInfo = { gin::kEmbedder
Blink, V8TestInterfacePython3::domTemplate, V8TestInterfacePython3::derefObject,
0, 0, V8TestInterfacePython3::visitDOMWrapper, V8TestInterfacePython3::installP
erContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; | |
| 40 | |
| 41 namespace TestInterfacePython3V8Internal { | |
| 42 | |
| 43 template <typename T> void V8_USE(T) { } | |
| 44 | |
| 45 } // namespace TestInterfacePython3V8Internal | |
| 46 | |
| 47 static void configureV8TestInterfacePython3Template(v8::Handle<v8::FunctionTempl
ate> functionTemplate, v8::Isolate* isolate) | |
| 48 { | |
| 49 functionTemplate->ReadOnlyPrototype(); | |
| 50 | |
| 51 v8::Local<v8::Signature> defaultSignature; | |
| 52 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfacePython3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceP
ython3::internalFieldCount, | |
| 53 0, 0, | |
| 54 0, 0, | |
| 55 0, 0, | |
| 56 isolate); | |
| 57 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | |
| 58 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | |
| 59 | |
| 60 // Custom toString template | |
| 61 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | |
| 62 } | |
| 63 | |
| 64 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython3::domTemplate(v8::Isolate
* isolate) | |
| 65 { | |
| 66 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 67 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); | |
| 68 if (!result.IsEmpty()) | |
| 69 return result; | |
| 70 | |
| 71 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
| 72 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | |
| 73 configureV8TestInterfacePython3Template(result, isolate); | |
| 74 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; | |
| 75 return result; | |
| 76 } | |
| 77 | |
| 78 bool V8TestInterfacePython3::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isol
ate* isolate) | |
| 79 { | |
| 80 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 81 } | |
| 82 | |
| 83 v8::Handle<v8::Object> V8TestInterfacePython3::findInstanceInPrototypeChain(v8::
Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
| 84 { | |
| 85 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 86 } | |
| 87 | |
| 88 TestInterfacePython3* V8TestInterfacePython3::toNativeWithTypeCheck(v8::Isolate*
isolate, v8::Handle<v8::Value> value) | |
| 89 { | |
| 90 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | |
| 91 } | |
| 92 | |
| 93 v8::Handle<v8::Object> V8TestInterfacePython3::createWrapper(PassRefPtr<TestInte
rfacePython3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) | |
| 94 { | |
| 95 ASSERT(impl); | |
| 96 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython3>(impl.get(), is
olate)); | |
| 97 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | |
| 98 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | |
| 99 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | |
| 100 // the same object de-ref functions, though, so use that as the basis of
the check. | |
| 101 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | |
| 102 } | |
| 103 | |
| 104 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | |
| 105 if (UNLIKELY(wrapper.IsEmpty())) | |
| 106 return wrapper; | |
| 107 | |
| 108 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | |
| 109 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython3>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); | |
| 110 return wrapper; | |
| 111 } | |
| 112 | |
| 113 void V8TestInterfacePython3::derefObject(void* object) | |
| 114 { | |
| 115 fromInternalPointer(object)->deref(); | |
| 116 } | |
| 117 | |
| 118 template<> | |
| 119 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython3* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | |
| 120 { | |
| 121 return toV8(impl, creationContext, isolate); | |
| 122 } | |
| 123 | |
| 124 } // namespace WebCore | |
| OLD | NEW |