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 "V8TestInterfaceEventTarget.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 V8TestInterfaceEventTarget::wrapperTypeInfo = { gin::kEmbe
dderBlink, V8TestInterfaceEventTarget::domTemplate, V8TestInterfaceEventTarget::
refObject, V8TestInterfaceEventTarget::derefObject, V8TestInterfaceEventTarget::
createPersistentHandle, 0, V8TestInterfaceEventTarget::toEventTarget, 0, V8TestI
nterfaceEventTarget::installConditionallyEnabledMethods, V8TestInterfaceEventTar
get::installConditionallyEnabledProperties, &V8EventTarget::wrapperTypeInfo, Wra
pperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, Wrappe
rTypeInfo::Independent, WrapperTypeInfo::WillBeGarbageCollectedObject }; | |
25 | |
26 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac
eEventTarget.h. | |
27 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
28 // bindings/core/v8/ScriptWrappable.h. | |
29 const WrapperTypeInfo& TestInterfaceEventTarget::s_wrapperTypeInfo = V8TestInter
faceEventTarget::wrapperTypeInfo; | |
30 | |
31 namespace TestInterfaceEventTargetV8Internal { | |
32 | |
33 template <typename T> void V8_USE(T) { } | |
34 | |
35 } // namespace TestInterfaceEventTargetV8Internal | |
36 | |
37 const WrapperTypeInfo V8TestInterfaceEventTargetConstructor::wrapperTypeInfo = {
gin::kEmbedderBlink, V8TestInterfaceEventTargetConstructor::domTemplate, V8Test
InterfaceEventTarget::refObject, V8TestInterfaceEventTarget::derefObject, V8Test
InterfaceEventTarget::createPersistentHandle, 0, V8TestInterfaceEventTarget::toE
ventTarget, 0, V8TestInterfaceEventTarget::installConditionallyEnabledMethods, V
8TestInterfaceEventTarget::installConditionallyEnabledProperties, 0, WrapperType
Info::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInf
o::Independent, WrapperTypeInfo::WillBeGarbageCollectedObject }; | |
38 | |
39 static void V8TestInterfaceEventTargetConstructorCallback(const v8::FunctionCall
backInfo<v8::Value>& info) | |
40 { | |
41 if (!info.IsConstructCall()) { | |
42 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab
leAsFunction("Name"), info.GetIsolate()); | |
43 return; | |
44 } | |
45 | |
46 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | |
47 v8SetReturnValue(info, info.Holder()); | |
48 return; | |
49 } | |
50 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; | |
51 RefPtrWillBeRawPtr<TestInterfaceEventTarget> impl = TestInterfaceEventTarget
::createForJSConstructor(document); | |
52 v8::Handle<v8::Object> wrapper = info.Holder(); | |
53 impl->associateWithWrapper(&V8TestInterfaceEventTargetConstructor::wrapperTy
peInfo, wrapper, info.GetIsolate()); | |
54 v8SetReturnValue(info, wrapper); | |
55 } | |
56 | |
57 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventTargetConstructor::domTempl
ate(v8::Isolate* isolate) | |
58 { | |
59 static int domTemplateKey; // This address is used for a key to look up the
dom template. | |
60 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
61 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl
ateKey); | |
62 if (!result.IsEmpty()) | |
63 return result; | |
64 | |
65 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | |
66 result = v8::FunctionTemplate::New(isolate, V8TestInterfaceEventTargetConstr
uctorCallback); | |
67 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); | |
68 instanceTemplate->SetInternalFieldCount(V8TestInterfaceEventTarget::internal
FieldCount); | |
69 result->SetClassName(v8AtomicString(isolate, "TestInterfaceEventTarget")); | |
70 result->Inherit(V8TestInterfaceEventTarget::domTemplate(isolate)); | |
71 data->setDOMTemplate(&domTemplateKey, result); | |
72 return result; | |
73 } | |
74 | |
75 static void installV8TestInterfaceEventTargetTemplate(v8::Handle<v8::FunctionTem
plate> functionTemplate, v8::Isolate* isolate) | |
76 { | |
77 functionTemplate->ReadOnlyPrototype(); | |
78 | |
79 v8::Local<v8::Signature> defaultSignature; | |
80 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEventTarget", V8EventTarget::domTemplate(isolate), V8TestInte
rfaceEventTarget::internalFieldCount, | |
81 0, 0, | |
82 0, 0, | |
83 0, 0, | |
84 isolate); | |
85 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
86 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->PrototypeTemplate(); | |
87 | |
88 // Custom toString template | |
89 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:from(isolate)->toStringTemplate()); | |
90 } | |
91 | |
92 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventTarget::domTemplate(v8::Iso
late* isolate) | |
93 { | |
94 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestInterfaceEventTargetTemplate); | |
95 } | |
96 | |
97 bool V8TestInterfaceEventTarget::hasInstance(v8::Handle<v8::Value> v8Value, v8::
Isolate* isolate) | |
98 { | |
99 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
100 } | |
101 | |
102 v8::Handle<v8::Object> V8TestInterfaceEventTarget::findInstanceInPrototypeChain(
v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
103 { | |
104 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
105 } | |
106 | |
107 TestInterfaceEventTarget* V8TestInterfaceEventTarget::toImplWithTypeCheck(v8::Is
olate* isolate, v8::Handle<v8::Value> value) | |
108 { | |
109 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestInterfaceEventTarget>() : 0; | |
110 } | |
111 | |
112 EventTarget* V8TestInterfaceEventTarget::toEventTarget(v8::Handle<v8::Object> ob
ject) | |
113 { | |
114 return toImpl(object); | |
115 } | |
116 | |
117 | |
118 void V8TestInterfaceEventTarget::refObject(ScriptWrappableBase* internalPointer) | |
119 { | |
120 #if !ENABLE(OILPAN) | |
121 internalPointer->toImpl<TestInterfaceEventTarget>()->ref(); | |
122 #endif | |
123 } | |
124 | |
125 void V8TestInterfaceEventTarget::derefObject(ScriptWrappableBase* internalPointe
r) | |
126 { | |
127 #if !ENABLE(OILPAN) | |
128 internalPointer->toImpl<TestInterfaceEventTarget>()->deref(); | |
129 #endif | |
130 } | |
131 | |
132 WrapperPersistentNode* V8TestInterfaceEventTarget::createPersistentHandle(Script
WrappableBase* internalPointer) | |
133 { | |
134 #if ENABLE(OILPAN) | |
135 return WrapperPersistent<TestInterfaceEventTarget>::create(internalPointer->
toImpl<TestInterfaceEventTarget>()); | |
136 #else | |
137 ASSERT_NOT_REACHED(); | |
138 return 0; | |
139 #endif | |
140 } | |
141 | |
142 template<> | |
143 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventTarget* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | |
144 { | |
145 return toV8(impl, creationContext, isolate); | |
146 } | |
147 | |
148 } // namespace blink | |
OLD | NEW |