| 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 "V8TestNode.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 "core/dom/ContextFeatures.h" | |
| 15 #include "core/dom/Document.h" | |
| 16 #include "core/frame/LocalDOMWindow.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 V8TestNode::wrapperTypeInfo = { gin::kEmbedderBlink, V8Tes
tNode::domTemplate, V8TestNode::refObject, V8TestNode::derefObject, V8TestNode::
createPersistentHandle, 0, V8TestNode::toEventTarget, 0, V8TestNode::installCond
itionallyEnabledMethods, V8TestNode::installConditionallyEnabledProperties, &V8N
ode::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeIn
fo::NodeClassId, WrapperTypeInfo::Dependent, WrapperTypeInfo::WillBeGarbageColle
ctedObject }; | |
| 25 | |
| 26 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestNode.h. | |
| 27 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
| 28 // bindings/core/v8/ScriptWrappable.h. | |
| 29 const WrapperTypeInfo& TestNode::s_wrapperTypeInfo = V8TestNode::wrapperTypeInfo
; | |
| 30 | |
| 31 namespace TestNodeV8Internal { | |
| 32 | |
| 33 template <typename T> void V8_USE(T) { } | |
| 34 | |
| 35 static void hrefAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 36 { | |
| 37 v8::Handle<v8::Object> holder = info.Holder(); | |
| 38 TestNode* impl = V8TestNode::toImpl(holder); | |
| 39 v8SetReturnValueString(info, impl->href(), info.GetIsolate()); | |
| 40 } | |
| 41 | |
| 42 static void hrefAttributeGetterCallback(v8::Local<v8::String>, const v8::Propert
yCallbackInfo<v8::Value>& info) | |
| 43 { | |
| 44 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 45 TestNodeV8Internal::hrefAttributeGetter(info); | |
| 46 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 47 } | |
| 48 | |
| 49 static void hrefAttributeSetter(v8::Local<v8::Value> v8Value, const v8::Property
CallbackInfo<void>& info) | |
| 50 { | |
| 51 v8::Handle<v8::Object> holder = info.Holder(); | |
| 52 TestNode* impl = V8TestNode::toImpl(holder); | |
| 53 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); | |
| 54 impl->setHref(cppValue); | |
| 55 } | |
| 56 | |
| 57 static void hrefAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Val
ue> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 58 { | |
| 59 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 60 TestNodeV8Internal::hrefAttributeSetter(v8Value, info); | |
| 61 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 62 } | |
| 63 | |
| 64 static void hrefThrowsAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>&
info) | |
| 65 { | |
| 66 v8::Handle<v8::Object> holder = info.Holder(); | |
| 67 TestNode* impl = V8TestNode::toImpl(holder); | |
| 68 v8SetReturnValueString(info, impl->hrefThrows(), info.GetIsolate()); | |
| 69 } | |
| 70 | |
| 71 static void hrefThrowsAttributeGetterCallback(v8::Local<v8::String>, const v8::P
ropertyCallbackInfo<v8::Value>& info) | |
| 72 { | |
| 73 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 74 TestNodeV8Internal::hrefThrowsAttributeGetter(info); | |
| 75 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 76 } | |
| 77 | |
| 78 static void hrefThrowsAttributeSetter(v8::Local<v8::Value> v8Value, const v8::Pr
opertyCallbackInfo<void>& info) | |
| 79 { | |
| 80 v8::Handle<v8::Object> holder = info.Holder(); | |
| 81 ExceptionState exceptionState(ExceptionState::SetterContext, "hrefThrows", "
TestNode", holder, info.GetIsolate()); | |
| 82 TestNode* impl = V8TestNode::toImpl(holder); | |
| 83 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); | |
| 84 impl->setHrefThrows(cppValue, exceptionState); | |
| 85 exceptionState.throwIfNeeded(); | |
| 86 } | |
| 87 | |
| 88 static void hrefThrowsAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v
8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 89 { | |
| 90 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 91 TestNodeV8Internal::hrefThrowsAttributeSetter(v8Value, info); | |
| 92 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 93 } | |
| 94 | |
| 95 static void hrefCallWithAttributeGetter(const v8::PropertyCallbackInfo<v8::Value
>& info) | |
| 96 { | |
| 97 v8::Handle<v8::Object> holder = info.Holder(); | |
| 98 TestNode* impl = V8TestNode::toImpl(holder); | |
| 99 v8SetReturnValueString(info, impl->hrefCallWith(), info.GetIsolate()); | |
| 100 } | |
| 101 | |
| 102 static void hrefCallWithAttributeGetterCallback(v8::Local<v8::String>, const v8:
:PropertyCallbackInfo<v8::Value>& info) | |
| 103 { | |
| 104 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 105 TestNodeV8Internal::hrefCallWithAttributeGetter(info); | |
| 106 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 107 } | |
| 108 | |
| 109 static void hrefCallWithAttributeSetter(v8::Local<v8::Value> v8Value, const v8::
PropertyCallbackInfo<void>& info) | |
| 110 { | |
| 111 v8::Handle<v8::Object> holder = info.Holder(); | |
| 112 TestNode* impl = V8TestNode::toImpl(holder); | |
| 113 TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); | |
| 114 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | |
| 115 impl->setHrefCallWith(executionContext, callingDOMWindow(info.GetIsolate()),
enteredDOMWindow(info.GetIsolate()), cppValue); | |
| 116 } | |
| 117 | |
| 118 static void hrefCallWithAttributeSetterCallback(v8::Local<v8::String>, v8::Local
<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 119 { | |
| 120 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 121 TestNodeV8Internal::hrefCallWithAttributeSetter(v8Value, info); | |
| 122 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 123 } | |
| 124 | |
| 125 static void hrefByteStringAttributeGetter(const v8::PropertyCallbackInfo<v8::Val
ue>& info) | |
| 126 { | |
| 127 v8::Handle<v8::Object> holder = info.Holder(); | |
| 128 TestNode* impl = V8TestNode::toImpl(holder); | |
| 129 v8SetReturnValueString(info, impl->hrefByteString(), info.GetIsolate()); | |
| 130 } | |
| 131 | |
| 132 static void hrefByteStringAttributeGetterCallback(v8::Local<v8::String>, const v
8::PropertyCallbackInfo<v8::Value>& info) | |
| 133 { | |
| 134 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
| 135 TestNodeV8Internal::hrefByteStringAttributeGetter(info); | |
| 136 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 137 } | |
| 138 | |
| 139 static void hrefByteStringAttributeSetter(v8::Local<v8::Value> v8Value, const v8
::PropertyCallbackInfo<void>& info) | |
| 140 { | |
| 141 v8::Handle<v8::Object> holder = info.Holder(); | |
| 142 ExceptionState exceptionState(ExceptionState::SetterContext, "hrefByteString
", "TestNode", holder, info.GetIsolate()); | |
| 143 TestNode* impl = V8TestNode::toImpl(holder); | |
| 144 TONATIVE_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, toByteString(v8Va
lue, exceptionState), exceptionState); | |
| 145 impl->setHrefByteString(cppValue); | |
| 146 } | |
| 147 | |
| 148 static void hrefByteStringAttributeSetterCallback(v8::Local<v8::String>, v8::Loc
al<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) | |
| 149 { | |
| 150 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); | |
| 151 TestNodeV8Internal::hrefByteStringAttributeSetter(v8Value, info); | |
| 152 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
| 153 } | |
| 154 | |
| 155 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 156 { | |
| 157 RefPtrWillBeRawPtr<TestNode> impl = TestNode::create(); | |
| 158 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 159 impl->associateWithWrapper(&V8TestNode::wrapperTypeInfo, wrapper, info.GetIs
olate()); | |
| 160 v8SetReturnValue(info, wrapper); | |
| 161 } | |
| 162 | |
| 163 } // namespace TestNodeV8Internal | |
| 164 | |
| 165 static const V8DOMConfiguration::AttributeConfiguration V8TestNodeAttributes[] =
{ | |
| 166 {"href", TestNodeV8Internal::hrefAttributeGetterCallback, TestNodeV8Internal
::hrefAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAU
LT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedTo
AllScripts, V8DOMConfiguration::OnInstance}, | |
| 167 {"hrefThrows", TestNodeV8Internal::hrefThrowsAttributeGetterCallback, TestNo
deV8Internal::hrefThrowsAttributeSetterCallback, 0, 0, 0, static_cast<v8::Access
Control>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfig
uration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 168 {"hrefCallWith", TestNodeV8Internal::hrefCallWithAttributeGetterCallback, Te
stNodeV8Internal::hrefCallWithAttributeSetterCallback, 0, 0, 0, static_cast<v8::
AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOM
Configuration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 169 {"hrefByteString", TestNodeV8Internal::hrefByteStringAttributeGetterCallback
, TestNodeV8Internal::hrefByteStringAttributeSetterCallback, 0, 0, 0, static_cas
t<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None),
V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
| 170 }; | |
| 171 | |
| 172 void V8TestNode::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | |
| 173 { | |
| 174 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor"); | |
| 175 if (!info.IsConstructCall()) { | |
| 176 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab
leAsFunction("TestNode"), info.GetIsolate()); | |
| 177 return; | |
| 178 } | |
| 179 | |
| 180 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | |
| 181 v8SetReturnValue(info, info.Holder()); | |
| 182 return; | |
| 183 } | |
| 184 | |
| 185 TestNodeV8Internal::constructor(info); | |
| 186 } | |
| 187 | |
| 188 static void installV8TestNodeTemplate(v8::Handle<v8::FunctionTemplate> functionT
emplate, v8::Isolate* isolate) | |
| 189 { | |
| 190 functionTemplate->ReadOnlyPrototype(); | |
| 191 | |
| 192 v8::Local<v8::Signature> defaultSignature; | |
| 193 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestNode", V8Node::domTemplate(isolate), V8TestNode::internalFieldCount, | |
| 194 V8TestNodeAttributes, WTF_ARRAY_LENGTH(V8TestNodeAttributes), | |
| 195 0, 0, | |
| 196 0, 0, | |
| 197 isolate); | |
| 198 functionTemplate->SetCallHandler(V8TestNode::constructorCallback); | |
| 199 functionTemplate->SetLength(0); | |
| 200 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
| 201 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->PrototypeTemplate(); | |
| 202 | |
| 203 // Custom toString template | |
| 204 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
| 205 } | |
| 206 | |
| 207 v8::Handle<v8::FunctionTemplate> V8TestNode::domTemplate(v8::Isolate* isolate) | |
| 208 { | |
| 209 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestNodeTemplate); | |
| 210 } | |
| 211 | |
| 212 bool V8TestNode::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate
) | |
| 213 { | |
| 214 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 215 } | |
| 216 | |
| 217 v8::Handle<v8::Object> V8TestNode::findInstanceInPrototypeChain(v8::Handle<v8::V
alue> v8Value, v8::Isolate* isolate) | |
| 218 { | |
| 219 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 220 } | |
| 221 | |
| 222 TestNode* V8TestNode::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::V
alue> value) | |
| 223 { | |
| 224 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestNode>() : 0; | |
| 225 } | |
| 226 | |
| 227 EventTarget* V8TestNode::toEventTarget(v8::Handle<v8::Object> object) | |
| 228 { | |
| 229 return toImpl(object); | |
| 230 } | |
| 231 | |
| 232 | |
| 233 void V8TestNode::refObject(ScriptWrappableBase* internalPointer) | |
| 234 { | |
| 235 #if !ENABLE(OILPAN) | |
| 236 internalPointer->toImpl<TestNode>()->ref(); | |
| 237 #endif | |
| 238 } | |
| 239 | |
| 240 void V8TestNode::derefObject(ScriptWrappableBase* internalPointer) | |
| 241 { | |
| 242 #if !ENABLE(OILPAN) | |
| 243 internalPointer->toImpl<TestNode>()->deref(); | |
| 244 #endif | |
| 245 } | |
| 246 | |
| 247 WrapperPersistentNode* V8TestNode::createPersistentHandle(ScriptWrappableBase* i
nternalPointer) | |
| 248 { | |
| 249 #if ENABLE(OILPAN) | |
| 250 return WrapperPersistent<TestNode>::create(internalPointer->toImpl<TestNode>
()); | |
| 251 #else | |
| 252 ASSERT_NOT_REACHED(); | |
| 253 return 0; | |
| 254 #endif | |
| 255 } | |
| 256 | |
| 257 template<> | |
| 258 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati
onContext, v8::Isolate* isolate) | |
| 259 { | |
| 260 return toV8(impl, creationContext, isolate); | |
| 261 } | |
| 262 | |
| 263 } // namespace blink | |
| OLD | NEW |