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

Side by Side Diff: Source/bindings/tests/results/V8TestSpecialOperations.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 "V8TestSpecialOperations.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/V8NodeList.h"
14 #include "bindings/core/v8/V8ObjectConstructor.h"
15 #include "bindings/tests/v8/V8Node.h"
16 #include "core/dom/ContextFeatures.h"
17 #include "core/dom/Document.h"
18 #include "core/dom/NameNodeList.h"
19 #include "core/dom/NodeList.h"
20 #include "core/dom/StaticNodeList.h"
21 #include "core/html/LabelsNodeList.h"
22 #include "platform/RuntimeEnabledFeatures.h"
23 #include "platform/TraceEvent.h"
24 #include "wtf/GetPtr.h"
25 #include "wtf/RefPtr.h"
26
27 namespace blink {
28
29 const WrapperTypeInfo V8TestSpecialOperations::wrapperTypeInfo = { gin::kEmbedde rBlink, V8TestSpecialOperations::domTemplate, V8TestSpecialOperations::refObject , V8TestSpecialOperations::derefObject, V8TestSpecialOperations::createPersisten tHandle, 0, 0, 0, V8TestSpecialOperations::installConditionallyEnabledMethods, V 8TestSpecialOperations::installConditionallyEnabledProperties, 0, WrapperTypeInf o::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo:: Independent, WrapperTypeInfo::RefCountedObject };
30
31 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestSpecialO perations.h.
32 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
33 // bindings/core/v8/ScriptWrappable.h.
34 const WrapperTypeInfo& TestSpecialOperations::s_wrapperTypeInfo = V8TestSpecialO perations::wrapperTypeInfo;
35
36 namespace TestSpecialOperationsV8Internal {
37
38 template <typename T> void V8_USE(T) { }
39
40 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
41 {
42 if (UNLIKELY(info.Length() < 1)) {
43 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("n amedItem", "TestSpecialOperations", 1, info.Length(), info.GetIsolate()), info.G etIsolate());
44 return;
45 }
46 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ;
47 V8StringResource<> name;
48 {
49 TOSTRING_VOID_INTERNAL(name, info[0]);
50 }
51 RefPtrWillBeRawPtr<Node> result0 = nullptr;
52 RefPtrWillBeRawPtr<NodeList> result1 = nullptr;
53 impl->getItem(name, result0, result1);
54 if (result0) {
55 v8SetReturnValue(info, result0.release());
56 return;
57 }
58 if (result1) {
59 v8SetReturnValue(info, result1.release());
60 return;
61 }
62 v8SetReturnValueNull(info);
63 }
64
65 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
66 {
67 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
68 TestSpecialOperationsV8Internal::namedItemMethod(info);
69 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
70 }
71
72 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
73 {
74 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ;
75 AtomicString propertyName = toCoreAtomicString(name);
76 RefPtrWillBeRawPtr<Node> result0 = nullptr;
77 RefPtrWillBeRawPtr<NodeList> result1 = nullptr;
78 impl->getItem(propertyName, result0, result1);
79 if (!(result0 || result1))
80 return;
81 if (result0) {
82 v8SetReturnValue(info, result0.release());
83 return;
84 }
85 if (result1) {
86 v8SetReturnValue(info, result1.release());
87 return;
88 }
89 ASSERT_NOT_REACHED();
90 }
91
92 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
93 {
94 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
95 TestSpecialOperationsV8Internal::namedPropertyGetter(name, info);
96 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
97 }
98
99 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
100 {
101 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ;
102 TOSTRING_VOID(V8StringResource<>, propertyName, name);
103 TONATIVE_VOID(Node*, propertyValue, V8Node::toImplWithTypeCheck(info.GetIsol ate(), v8Value));
104 bool result = impl->anonymousNamedSetter(propertyName, propertyValue);
105 if (!result)
106 return;
107 v8SetReturnValue(info, v8Value);
108 }
109
110 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
111 {
112 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
113 TestSpecialOperationsV8Internal::namedPropertySetter(name, v8Value, info);
114 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
115 }
116
117 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
118 {
119 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ;
120 AtomicString propertyName = toCoreAtomicString(name);
121 v8::String::Utf8Value namedProperty(name);
122 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperations", info.Holder(), info.GetIsolate());
123 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
124 if (exceptionState.throwIfNeeded())
125 return;
126 if (!result)
127 return;
128 v8SetReturnValueInt(info, v8::None);
129 }
130
131 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
132 {
133 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
134 TestSpecialOperationsV8Internal::namedPropertyQuery(name, info);
135 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
136 }
137
138 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
139 {
140 TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder()) ;
141 Vector<String> names;
142 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci alOperations", info.Holder(), info.GetIsolate());
143 impl->namedPropertyEnumerator(names, exceptionState);
144 if (exceptionState.throwIfNeeded())
145 return;
146 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size ());
147 for (size_t i = 0; i < names.size(); ++i)
148 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs olate(), names[i]));
149 v8SetReturnValue(info, v8names);
150 }
151
152 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
153 {
154 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty");
155 TestSpecialOperationsV8Internal::namedPropertyEnumerator(info);
156 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
157 }
158
159 } // namespace TestSpecialOperationsV8Internal
160
161 static const V8DOMConfiguration::MethodConfiguration V8TestSpecialOperationsMeth ods[] = {
162 {"namedItem", TestSpecialOperationsV8Internal::namedItemMethodCallback, 0, 1 , V8DOMConfiguration::ExposedToAllScripts},
163 };
164
165 static void installV8TestSpecialOperationsTemplate(v8::Handle<v8::FunctionTempla te> functionTemplate, v8::Isolate* isolate)
166 {
167 functionTemplate->ReadOnlyPrototype();
168
169 v8::Local<v8::Signature> defaultSignature;
170 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestSpecialOperations", v8::Local<v8::FunctionTemplate>(), V8TestSpecialOp erations::internalFieldCount,
171 0, 0,
172 0, 0,
173 V8TestSpecialOperationsMethods, WTF_ARRAY_LENGTH(V8TestSpecialOperations Methods),
174 isolate);
175 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate();
176 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate();
177 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe rationsV8Internal::namedPropertyGetterCallback, TestSpecialOperationsV8Internal: :namedPropertySetterCallback, TestSpecialOperationsV8Internal::namedPropertyQuer yCallback, 0, TestSpecialOperationsV8Internal::namedPropertyEnumeratorCallback);
178
179 // Custom toString template
180 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :from(isolate)->toStringTemplate());
181 }
182
183 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperations::domTemplate(v8::Isolat e* isolate)
184 {
185 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeI nfo*>(&wrapperTypeInfo), installV8TestSpecialOperationsTemplate);
186 }
187
188 bool V8TestSpecialOperations::hasInstance(v8::Handle<v8::Value> v8Value, v8::Iso late* isolate)
189 {
190 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
191 }
192
193 v8::Handle<v8::Object> V8TestSpecialOperations::findInstanceInPrototypeChain(v8: :Handle<v8::Value> v8Value, v8::Isolate* isolate)
194 {
195 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
196 }
197
198 TestSpecialOperations* V8TestSpecialOperations::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
199 {
200 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<TestSpecialOperations>() : 0;
201 }
202
203
204 void V8TestSpecialOperations::refObject(ScriptWrappableBase* internalPointer)
205 {
206 internalPointer->toImpl<TestSpecialOperations>()->ref();
207 }
208
209 void V8TestSpecialOperations::derefObject(ScriptWrappableBase* internalPointer)
210 {
211 internalPointer->toImpl<TestSpecialOperations>()->deref();
212 }
213
214 WrapperPersistentNode* V8TestSpecialOperations::createPersistentHandle(ScriptWra ppableBase* internalPointer)
215 {
216 ASSERT_NOT_REACHED();
217 return 0;
218 }
219
220 template<>
221 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperations* impl, v8::Handle<v8::O bject> creationContext, v8::Isolate* isolate)
222 {
223 return toV8(impl, creationContext, isolate);
224 }
225
226 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698