Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceWillBeGarbageCollected.cpp

Issue 557203002: Added core and modules to binding tests results for binding modularization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "V8TestInterfaceWillBeGarbageCollected.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/V8TestInterfaceWillBeGarbageCollected.h"
15 #include "core/dom/ContextFeatures.h"
16 #include "core/dom/Document.h"
17 #include "core/frame/LocalDOMWindow.h"
18 #include "platform/RuntimeEnabledFeatures.h"
19 #include "platform/TraceEvent.h"
20 #include "wtf/GetPtr.h"
21 #include "wtf/RefPtr.h"
22
23 namespace blink {
24
25 const WrapperTypeInfo V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceWillBeGarbageCollected::domTemplate, V8Test InterfaceWillBeGarbageCollected::refObject, V8TestInterfaceWillBeGarbageCollecte d::derefObject, V8TestInterfaceWillBeGarbageCollected::createPersistentHandle, 0 , V8TestInterfaceWillBeGarbageCollected::toEventTarget, 0, V8TestInterfaceWillBe GarbageCollected::installConditionallyEnabledMethods, V8TestInterfaceWillBeGarba geCollected::installConditionallyEnabledProperties, &V8EventTarget::wrapperTypeI nfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId , WrapperTypeInfo::Independent, WrapperTypeInfo::WillBeGarbageCollectedObject };
26
27 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac eWillBeGarbageCollected.h.
28 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
29 // bindings/core/v8/ScriptWrappable.h.
30 const WrapperTypeInfo& TestInterfaceWillBeGarbageCollected::s_wrapperTypeInfo = V8TestInterfaceWillBeGarbageCollected::wrapperTypeInfo;
31
32 namespace TestInterfaceWillBeGarbageCollectedV8Internal {
33
34 template <typename T> void V8_USE(T) { }
35
36 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info )
37 {
38 v8::Handle<v8::Object> holder = info.Holder();
39 TestInterfaceWillBeGarbageCollected* impl = V8TestInterfaceWillBeGarbageColl ected::toImpl(holder);
40 v8SetReturnValueFast(info, WTF::getPtr(impl->attr1()), impl);
41 }
42
43 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::Proper tyCallbackInfo<v8::Value>& info)
44 {
45 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
46 TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeGetter(info);
47 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
48 }
49
50 static void attr1AttributeSetter(v8::Local<v8::Value> v8Value, const v8::Propert yCallbackInfo<void>& info)
51 {
52 v8::Handle<v8::Object> holder = info.Holder();
53 TestInterfaceWillBeGarbageCollected* impl = V8TestInterfaceWillBeGarbageColl ected::toImpl(holder);
54 TONATIVE_VOID(TestInterfaceWillBeGarbageCollected*, cppValue, V8TestInterfac eWillBeGarbageCollected::toImplWithTypeCheck(info.GetIsolate(), v8Value));
55 impl->setAttr1(WTF::getPtr(cppValue));
56 }
57
58 static void attr1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Va lue> v8Value, const v8::PropertyCallbackInfo<void>& info)
59 {
60 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
61 TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeSetter(v8Value, info);
62 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
63 }
64
65 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
66 {
67 if (UNLIKELY(info.Length() < 1)) {
68 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("f unc", "TestInterfaceWillBeGarbageCollected", 1, info.Length(), info.GetIsolate() ), info.GetIsolate());
69 return;
70 }
71 TestInterfaceWillBeGarbageCollected* impl = V8TestInterfaceWillBeGarbageColl ected::toImpl(info.Holder());
72 TestInterfaceWillBeGarbageCollected* arg;
73 {
74 v8::TryCatch block;
75 V8RethrowTryCatchScope rethrow(block);
76 TONATIVE_VOID_INTERNAL(arg, V8TestInterfaceWillBeGarbageCollected::toImp lWithTypeCheck(info.GetIsolate(), info[0]));
77 }
78 impl->func(arg);
79 }
80
81 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
82 {
83 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
84 TestInterfaceWillBeGarbageCollectedV8Internal::funcMethod(info);
85 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
86 }
87
88 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
89 {
90 if (UNLIKELY(info.Length() < 1)) {
91 V8ThrowException::throwException(createMinimumArityTypeErrorForConstruct or("TestInterfaceWillBeGarbageCollected", 1, info.Length(), info.GetIsolate()), info.GetIsolate());
92 return;
93 }
94 V8StringResource<> str;
95 {
96 TOSTRING_VOID_INTERNAL(str, info[0]);
97 }
98 RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterface WillBeGarbageCollected::create(str);
99 v8::Handle<v8::Object> wrapper = info.Holder();
100 impl->associateWithWrapper(&V8TestInterfaceWillBeGarbageCollected::wrapperTy peInfo, wrapper, info.GetIsolate());
101 v8SetReturnValue(info, wrapper);
102 }
103
104 } // namespace TestInterfaceWillBeGarbageCollectedV8Internal
105
106 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceWillBeGar bageCollectedAttributes[] = {
107 {"attr1", TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeGette rCallback, TestInterfaceWillBeGarbageCollectedV8Internal::attr1AttributeSetterCa llback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Pr opertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfig uration::OnInstance},
108 };
109
110 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceWillBeGarbag eCollectedMethods[] = {
111 {"func", TestInterfaceWillBeGarbageCollectedV8Internal::funcMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
112 };
113
114 const WrapperTypeInfo V8TestInterfaceWillBeGarbageCollectedConstructor::wrapperT ypeInfo = { gin::kEmbedderBlink, V8TestInterfaceWillBeGarbageCollectedConstructo r::domTemplate, V8TestInterfaceWillBeGarbageCollected::refObject, V8TestInterfac eWillBeGarbageCollected::derefObject, V8TestInterfaceWillBeGarbageCollected::cre atePersistentHandle, 0, V8TestInterfaceWillBeGarbageCollected::toEventTarget, 0, V8TestInterfaceWillBeGarbageCollected::installConditionallyEnabledMethods, V8Te stInterfaceWillBeGarbageCollected::installConditionallyEnabledProperties, 0, Wra pperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, Wrappe rTypeInfo::Independent, WrapperTypeInfo::WillBeGarbageCollectedObject };
115
116 static void V8TestInterfaceWillBeGarbageCollectedConstructorCallback(const v8::F unctionCallbackInfo<v8::Value>& info)
117 {
118 if (!info.IsConstructCall()) {
119 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab leAsFunction("TestInterface"), info.GetIsolate());
120 return;
121 }
122
123 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis tingObject) {
124 v8SetReturnValue(info, info.Holder());
125 return;
126 }
127 if (UNLIKELY(info.Length() < 1)) {
128 V8ThrowException::throwException(createMinimumArityTypeErrorForConstruct or("TestInterfaceWillBeGarbageCollected", 1, info.Length(), info.GetIsolate()), info.GetIsolate());
129 return;
130 }
131 V8StringResource<> str;
132 {
133 TOSTRING_VOID_INTERNAL(str, info[0]);
134 }
135 RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> impl = TestInterface WillBeGarbageCollected::createForJSConstructor(str);
136 v8::Handle<v8::Object> wrapper = info.Holder();
137 impl->associateWithWrapper(&V8TestInterfaceWillBeGarbageCollectedConstructor ::wrapperTypeInfo, wrapper, info.GetIsolate());
138 v8SetReturnValue(info, wrapper);
139 }
140
141 v8::Handle<v8::FunctionTemplate> V8TestInterfaceWillBeGarbageCollectedConstructo r::domTemplate(v8::Isolate* isolate)
142 {
143 static int domTemplateKey; // This address is used for a key to look up the dom template.
144 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
145 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey);
146 if (!result.IsEmpty())
147 return result;
148
149 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate");
150 result = v8::FunctionTemplate::New(isolate, V8TestInterfaceWillBeGarbageColl ectedConstructorCallback);
151 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
152 instanceTemplate->SetInternalFieldCount(V8TestInterfaceWillBeGarbageCollecte d::internalFieldCount);
153 result->SetClassName(v8AtomicString(isolate, "TestInterfaceWillBeGarbageColl ected"));
154 result->Inherit(V8TestInterfaceWillBeGarbageCollected::domTemplate(isolate)) ;
155 data->setDOMTemplate(&domTemplateKey, result);
156 return result;
157 }
158
159 void V8TestInterfaceWillBeGarbageCollected::constructorCallback(const v8::Functi onCallbackInfo<v8::Value>& info)
160 {
161 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor");
162 if (!info.IsConstructCall()) {
163 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab leAsFunction("TestInterfaceWillBeGarbageCollected"), info.GetIsolate());
164 return;
165 }
166
167 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis tingObject) {
168 v8SetReturnValue(info, info.Holder());
169 return;
170 }
171
172 TestInterfaceWillBeGarbageCollectedV8Internal::constructor(info);
173 }
174
175 static void installV8TestInterfaceWillBeGarbageCollectedTemplate(v8::Handle<v8:: FunctionTemplate> functionTemplate, v8::Isolate* isolate)
176 {
177 functionTemplate->ReadOnlyPrototype();
178
179 v8::Local<v8::Signature> defaultSignature;
180 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterfaceWillBeGarbageCollected", V8EventTarget::domTemplate(isolate), V8TestInterfaceWillBeGarbageCollected::internalFieldCount,
181 V8TestInterfaceWillBeGarbageCollectedAttributes, WTF_ARRAY_LENGTH(V8Test InterfaceWillBeGarbageCollectedAttributes),
182 0, 0,
183 V8TestInterfaceWillBeGarbageCollectedMethods, WTF_ARRAY_LENGTH(V8TestInt erfaceWillBeGarbageCollectedMethods),
184 isolate);
185 functionTemplate->SetCallHandler(V8TestInterfaceWillBeGarbageCollected::cons tructorCallback);
186 functionTemplate->SetLength(1);
187 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate();
188 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate();
189
190 // Custom toString template
191 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate());
192 }
193
194 v8::Handle<v8::FunctionTemplate> V8TestInterfaceWillBeGarbageCollected::domTempl ate(v8::Isolate* isolate)
195 {
196 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), installV8TestInterfaceWillBeGarbageCollectedTemplate);
197 }
198
199 bool V8TestInterfaceWillBeGarbageCollected::hasInstance(v8::Handle<v8::Value> v8 Value, v8::Isolate* isolate)
200 {
201 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
202 }
203
204 v8::Handle<v8::Object> V8TestInterfaceWillBeGarbageCollected::findInstanceInProt otypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
205 {
206 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
207 }
208
209 TestInterfaceWillBeGarbageCollected* V8TestInterfaceWillBeGarbageCollected::toIm plWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
210 {
211 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<TestInterfaceWillBeGarbageCollected>() : 0;
212 }
213
214 EventTarget* V8TestInterfaceWillBeGarbageCollected::toEventTarget(v8::Handle<v8: :Object> object)
215 {
216 return toImpl(object);
217 }
218
219
220 void V8TestInterfaceWillBeGarbageCollected::refObject(ScriptWrappableBase* inter nalPointer)
221 {
222 #if !ENABLE(OILPAN)
223 internalPointer->toImpl<TestInterfaceWillBeGarbageCollected>()->ref();
224 #endif
225 }
226
227 void V8TestInterfaceWillBeGarbageCollected::derefObject(ScriptWrappableBase* int ernalPointer)
228 {
229 #if !ENABLE(OILPAN)
230 internalPointer->toImpl<TestInterfaceWillBeGarbageCollected>()->deref();
231 #endif
232 }
233
234 WrapperPersistentNode* V8TestInterfaceWillBeGarbageCollected::createPersistentHa ndle(ScriptWrappableBase* internalPointer)
235 {
236 #if ENABLE(OILPAN)
237 return WrapperPersistent<TestInterfaceWillBeGarbageCollected>::create(intern alPointer->toImpl<TestInterfaceWillBeGarbageCollected>());
238 #else
239 ASSERT_NOT_REACHED();
240 return 0;
241 #endif
242 }
243
244 template<>
245 v8::Handle<v8::Value> toV8NoInline(TestInterfaceWillBeGarbageCollected* impl, v8 ::Handle<v8::Object> creationContext, v8::Isolate* isolate)
246 {
247 return toV8(impl, creationContext, isolate);
248 }
249
250 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceWillBeGarbageCollected.h ('k') | Source/bindings/tests/results/V8TestNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698