| 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 "V8TestInterfaceNotScriptWrappable.h" | |
| 9 | |
| 10 #include "bindings/core/v8/ExceptionState.h" | |
| 11 #include "bindings/core/v8/V8DOMConfiguration.h" | |
| 12 #include "bindings/core/v8/V8HiddenValue.h" | |
| 13 #include "bindings/core/v8/V8ObjectConstructor.h" | |
| 14 #include "bindings/tests/v8/V8TestInterfaceNotScriptWrappable.h" | |
| 15 #include "core/dom/ContextFeatures.h" | |
| 16 #include "core/dom/Document.h" | |
| 17 #include "platform/RuntimeEnabledFeatures.h" | |
| 18 #include "platform/TraceEvent.h" | |
| 19 #include "wtf/GetPtr.h" | |
| 20 #include "wtf/RefPtr.h" | |
| 21 | |
| 22 namespace blink { | |
| 23 | |
| 24 const WrapperTypeInfo V8TestInterfaceNotScriptWrappable::wrapperTypeInfo = { gin
::kEmbedderBlink, V8TestInterfaceNotScriptWrappable::domTemplate, V8TestInterfac
eNotScriptWrappable::refObject, V8TestInterfaceNotScriptWrappable::derefObject,
V8TestInterfaceNotScriptWrappable::createPersistentHandle, 0, 0, 0, V8TestInterf
aceNotScriptWrappable::installConditionallyEnabledMethods, V8TestInterfaceNotScr
iptWrappable::installConditionallyEnabledProperties, 0, WrapperTypeInfo::Wrapper
TypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independen
t, WrapperTypeInfo::RefCountedObject }; | |
| 25 | |
| 26 namespace TestInterfaceNotScriptWrappableV8Internal { | |
| 27 | |
| 28 template <typename T> void V8_USE(T) { } | |
| 29 | |
| 30 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info
) | |
| 31 { | |
| 32 v8::Handle<v8::Object> holder = info.Holder(); | |
| 33 TestInterfaceNotScriptWrappable* impl = V8TestInterfaceNotScriptWrappable::t
oImpl(holder); | |
| 34 v8SetReturnValueFast(info, WTF::getPtr(impl->attr1()), impl); | |
| 35 } | |
| 36 | |
| 37 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::Proper
tyCallbackInfo<v8::Value>& info) | |
| 38 { | |
| 39 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 40 TestInterfaceNotScriptWrappableV8Internal::attr1AttributeGetter(info); | |
| 41 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 42 } | |
| 43 | |
| 44 static void attr1AttributeSetter(v8::Local<v8::Value> v8Value, const v8::Propert
yCallbackInfo<void>& info) | |
| 45 { | |
| 46 v8::Handle<v8::Object> holder = info.Holder(); | |
| 47 TestInterfaceNotScriptWrappable* impl = V8TestInterfaceNotScriptWrappable::t
oImpl(holder); | |
| 48 TONATIVE_VOID(TestInterfaceNotScriptWrappable*, cppValue, V8TestInterfaceNot
ScriptWrappable::toImplWithTypeCheck(info.GetIsolate(), v8Value)); | |
| 49 impl->setAttr1(WTF::getPtr(cppValue)); | |
| 50 } | |
| 51 | |
| 52 static void attr1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Va
lue> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 53 { | |
| 54 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 55 TestInterfaceNotScriptWrappableV8Internal::attr1AttributeSetter(v8Value, inf
o); | |
| 56 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 57 } | |
| 58 | |
| 59 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 60 { | |
| 61 if (UNLIKELY(info.Length() < 1)) { | |
| 62 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("f
unc", "TestInterfaceNotScriptWrappable", 1, info.Length(), info.GetIsolate()), i
nfo.GetIsolate()); | |
| 63 return; | |
| 64 } | |
| 65 TestInterfaceNotScriptWrappable* impl = V8TestInterfaceNotScriptWrappable::t
oImpl(info.Holder()); | |
| 66 TestInterfaceNotScriptWrappable* arg; | |
| 67 { | |
| 68 v8::TryCatch block; | |
| 69 V8RethrowTryCatchScope rethrow(block); | |
| 70 TONATIVE_VOID_INTERNAL(arg, V8TestInterfaceNotScriptWrappable::toImplWit
hTypeCheck(info.GetIsolate(), info[0])); | |
| 71 } | |
| 72 impl->func(arg); | |
| 73 } | |
| 74 | |
| 75 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 76 { | |
| 77 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | |
| 78 TestInterfaceNotScriptWrappableV8Internal::funcMethod(info); | |
| 79 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 80 } | |
| 81 | |
| 82 } // namespace TestInterfaceNotScriptWrappableV8Internal | |
| 83 | |
| 84 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNotScript
WrappableAttributes[] = { | |
| 85 {"attr1", TestInterfaceNotScriptWrappableV8Internal::attr1AttributeGetterCal
lback, TestInterfaceNotScriptWrappableV8Internal::attr1AttributeSetterCallback,
0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAt
tribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration:
:OnInstance}, | |
| 86 }; | |
| 87 | |
| 88 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceNotScriptWra
ppableMethods[] = { | |
| 89 {"func", TestInterfaceNotScriptWrappableV8Internal::funcMethodCallback, 0, 1
, V8DOMConfiguration::ExposedToAllScripts}, | |
| 90 }; | |
| 91 | |
| 92 static void installV8TestInterfaceNotScriptWrappableTemplate(v8::Handle<v8::Func
tionTemplate> functionTemplate, v8::Isolate* isolate) | |
| 93 { | |
| 94 functionTemplate->ReadOnlyPrototype(); | |
| 95 | |
| 96 v8::Local<v8::Signature> defaultSignature; | |
| 97 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceNotScriptWrappable", v8::Local<v8::FunctionTemplate>(), V8Tes
tInterfaceNotScriptWrappable::internalFieldCount, | |
| 98 V8TestInterfaceNotScriptWrappableAttributes, WTF_ARRAY_LENGTH(V8TestInte
rfaceNotScriptWrappableAttributes), | |
| 99 0, 0, | |
| 100 V8TestInterfaceNotScriptWrappableMethods, WTF_ARRAY_LENGTH(V8TestInterfa
ceNotScriptWrappableMethods), | |
| 101 isolate); | |
| 102 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
| 103 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->PrototypeTemplate(); | |
| 104 | |
| 105 // Custom toString template | |
| 106 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
| 107 } | |
| 108 | |
| 109 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNotScriptWrappable::domTemplate(
v8::Isolate* isolate) | |
| 110 { | |
| 111 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestInterfaceNotScriptWrappableTemplate); | |
| 112 } | |
| 113 | |
| 114 bool V8TestInterfaceNotScriptWrappable::hasInstance(v8::Handle<v8::Value> v8Valu
e, v8::Isolate* isolate) | |
| 115 { | |
| 116 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 117 } | |
| 118 | |
| 119 v8::Handle<v8::Object> V8TestInterfaceNotScriptWrappable::findInstanceInPrototyp
eChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
| 120 { | |
| 121 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 122 } | |
| 123 | |
| 124 TestInterfaceNotScriptWrappable* V8TestInterfaceNotScriptWrappable::toImplWithTy
peCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) | |
| 125 { | |
| 126 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestInterfaceNotScriptWrappable>() : 0; | |
| 127 } | |
| 128 | |
| 129 v8::Handle<v8::Object> wrap(TestInterfaceNotScriptWrappable* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | |
| 130 { | |
| 131 ASSERT(impl); | |
| 132 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNotScriptWrappable>(imp
l, isolate)); | |
| 133 return V8TestInterfaceNotScriptWrappable::createWrapper(impl, creationContex
t, isolate); | |
| 134 } | |
| 135 | |
| 136 v8::Handle<v8::Object> V8TestInterfaceNotScriptWrappable::createWrapper(PassRefP
tr<TestInterfaceNotScriptWrappable> impl, v8::Handle<v8::Object> creationContext
, v8::Isolate* isolate) | |
| 137 { | |
| 138 ASSERT(impl); | |
| 139 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNotScriptWrappable>(imp
l.get(), isolate)); | |
| 140 | |
| 141 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, impl->toScriptWrappableBase(), isolate); | |
| 142 if (UNLIKELY(wrapper.IsEmpty())) | |
| 143 return wrapper; | |
| 144 | |
| 145 installConditionallyEnabledProperties(wrapper, isolate); | |
| 146 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNotScriptWrappable>(
impl, &wrapperTypeInfo, wrapper, isolate); | |
| 147 return wrapper; | |
| 148 } | |
| 149 | |
| 150 | |
| 151 void V8TestInterfaceNotScriptWrappable::refObject(ScriptWrappableBase* internalP
ointer) | |
| 152 { | |
| 153 internalPointer->toImpl<TestInterfaceNotScriptWrappable>()->ref(); | |
| 154 } | |
| 155 | |
| 156 void V8TestInterfaceNotScriptWrappable::derefObject(ScriptWrappableBase* interna
lPointer) | |
| 157 { | |
| 158 internalPointer->toImpl<TestInterfaceNotScriptWrappable>()->deref(); | |
| 159 } | |
| 160 | |
| 161 WrapperPersistentNode* V8TestInterfaceNotScriptWrappable::createPersistentHandle
(ScriptWrappableBase* internalPointer) | |
| 162 { | |
| 163 ASSERT_NOT_REACHED(); | |
| 164 return 0; | |
| 165 } | |
| 166 | |
| 167 template<> | |
| 168 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNotScriptWrappable* impl, v8::Ha
ndle<v8::Object> creationContext, v8::Isolate* isolate) | |
| 169 { | |
| 170 return toV8(impl, creationContext, isolate); | |
| 171 } | |
| 172 | |
| 173 } // namespace blink | |
| OLD | NEW |