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

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

Issue 213543004: Consolidate IDL test cases (15%: 34 => 29) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reupload Created 6 years, 9 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "V8TestTypedefs.h" 8 #include "V8TestTypedefs.h"
9 9
10 #include "RuntimeEnabledFeatures.h" 10 #include "RuntimeEnabledFeatures.h"
(...skipping 30 matching lines...) Expand all
41 WebCore::initializeScriptWrappableForInterface(object); 41 WebCore::initializeScriptWrappableForInterface(object);
42 } 42 }
43 43
44 namespace WebCore { 44 namespace WebCore {
45 const WrapperTypeInfo V8TestTypedefs::wrapperTypeInfo = { gin::kEmbedderBlink, V 8TestTypedefs::domTemplate, V8TestTypedefs::derefObject, 0, 0, 0, V8TestTypedefs ::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false }; 45 const WrapperTypeInfo V8TestTypedefs::wrapperTypeInfo = { gin::kEmbedderBlink, V 8TestTypedefs::domTemplate, V8TestTypedefs::derefObject, 0, 0, 0, V8TestTypedefs ::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, false };
46 46
47 namespace TestTypedefsV8Internal { 47 namespace TestTypedefsV8Internal {
48 48
49 template <typename T> void V8_USE(T) { } 49 template <typename T> void V8_USE(T) { }
50 50
51 static void unsignedLongLongAttrAttributeGetter(const v8::PropertyCallbackInfo<v 8::Value>& info) 51 static void uLongLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8: :Value>& info)
52 { 52 {
53 v8::Handle<v8::Object> holder = info.Holder(); 53 v8::Handle<v8::Object> holder = info.Holder();
54 TestTypedefs* impl = V8TestTypedefs::toNative(holder); 54 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
55 v8SetReturnValue(info, static_cast<double>(impl->unsignedLongLongAttr())); 55 v8SetReturnValue(info, static_cast<double>(impl->uLongLongAttribute()));
56 } 56 }
57 57
58 static void unsignedLongLongAttrAttributeGetterCallback(v8::Local<v8::String>, c onst v8::PropertyCallbackInfo<v8::Value>& info) 58 static void uLongLongAttributeAttributeGetterCallback(v8::Local<v8::String>, con st v8::PropertyCallbackInfo<v8::Value>& info)
59 { 59 {
60 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 60 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
61 TestTypedefsV8Internal::unsignedLongLongAttrAttributeGetter(info); 61 TestTypedefsV8Internal::uLongLongAttributeAttributeGetter(info);
62 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 62 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
63 } 63 }
64 64
65 static void unsignedLongLongAttrAttributeSetter(v8::Local<v8::Value> v8Value, co nst v8::PropertyCallbackInfo<void>& info) 65 static void uLongLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, cons t v8::PropertyCallbackInfo<void>& info)
66 { 66 {
67 v8::Handle<v8::Object> holder = info.Holder(); 67 v8::Handle<v8::Object> holder = info.Holder();
68 ExceptionState exceptionState(ExceptionState::SetterContext, "unsignedLongLo ngAttr", "TestTypedefs", holder, info.GetIsolate()); 68 ExceptionState exceptionState(ExceptionState::SetterContext, "uLongLongAttri bute", "TestTypedefs", holder, info.GetIsolate());
69 TestTypedefs* impl = V8TestTypedefs::toNative(holder); 69 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
70 V8TRYCATCH_EXCEPTION_VOID(unsigned long long, cppValue, toUInt64(v8Value, ex ceptionState), exceptionState); 70 V8TRYCATCH_EXCEPTION_VOID(unsigned long long, cppValue, toUInt64(v8Value, ex ceptionState), exceptionState);
71 impl->setUnsignedLongLongAttr(cppValue); 71 impl->setULongLongAttribute(cppValue);
72 } 72 }
73 73
74 static void unsignedLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v 8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 74 static void uLongLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8: :Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
75 { 75 {
76 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 76 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
77 TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetter(v8Value, info); 77 TestTypedefsV8Internal::uLongLongAttributeAttributeSetter(v8Value, info);
78 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 78 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
79 } 79 }
80 80
81 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info)
82 {
83 v8::Handle<v8::Object> holder = info.Holder();
84 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
85 ExceptionState exceptionState(ExceptionState::GetterContext, "attrWithGetter Exception", "TestTypedefs", holder, info.GetIsolate());
86 int v8Value = impl->attrWithGetterException(exceptionState);
87 if (UNLIKELY(exceptionState.throwIfNeeded()))
88 return;
89 v8SetReturnValueInt(info, v8Value);
90 }
91
92 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
93 {
94 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
95 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info);
96 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
97 }
98
99 static void attrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
100 {
101 v8::Handle<v8::Object> holder = info.Holder();
102 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithGetter Exception", "TestTypedefs", holder, info.GetIsolate());
103 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
104 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(v8Value, exceptionState), e xceptionState);
105 impl->setAttrWithGetterException(cppValue);
106 }
107
108 static void attrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
109 {
110 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
111 TestTypedefsV8Internal::attrWithGetterExceptionAttributeSetter(v8Value, info );
112 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
113 }
114
115 static void attrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info)
116 {
117 v8::Handle<v8::Object> holder = info.Holder();
118 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
119 v8SetReturnValueInt(info, impl->attrWithSetterException());
120 }
121
122 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
123 {
124 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
125 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info);
126 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
127 }
128
129 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
130 {
131 v8::Handle<v8::Object> holder = info.Holder();
132 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithSetter Exception", "TestTypedefs", holder, info.GetIsolate());
133 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
134 V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(v8Value, exceptionState), e xceptionState);
135 impl->setAttrWithSetterException(cppValue, exceptionState);
136 exceptionState.throwIfNeeded();
137 }
138
139 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
140 {
141 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
142 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(v8Value, info );
143 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
144 }
145
146 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb ackInfo<v8::Value>& info)
147 {
148 v8::Handle<v8::Object> holder = info.Holder();
149 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
150 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttrWith GetterException", "TestTypedefs", holder, info.GetIsolate());
151 String v8Value = impl->stringAttrWithGetterException(exceptionState);
152 if (UNLIKELY(exceptionState.throwIfNeeded()))
153 return;
154 v8SetReturnValueString(info, v8Value, info.GetIsolate());
155 }
156
157 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info)
158 {
159 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
160 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info);
161 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
162 }
163
164 static void stringAttrWithGetterExceptionAttributeSetter(v8::Local<v8::Value> v8 Value, const v8::PropertyCallbackInfo<void>& info)
165 {
166 v8::Handle<v8::Object> holder = info.Holder();
167 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
168 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, v8Value);
169 impl->setStringAttrWithGetterException(cppValue);
170 }
171
172 static void stringAttrWithGetterExceptionAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info )
173 {
174 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
175 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeSetter(v8Value , info);
176 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
177 }
178
179 static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallb ackInfo<v8::Value>& info)
180 {
181 v8::Handle<v8::Object> holder = info.Holder();
182 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
183 v8SetReturnValueString(info, impl->stringAttrWithSetterException(), info.Get Isolate());
184 }
185
186 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info)
187 {
188 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
189 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info);
190 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
191 }
192
193 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> v8 Value, const v8::PropertyCallbackInfo<void>& info)
194 {
195 v8::Handle<v8::Object> holder = info.Holder();
196 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith SetterException", "TestTypedefs", holder, info.GetIsolate());
197 TestTypedefs* impl = V8TestTypedefs::toNative(holder);
198 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, v8Value);
199 impl->setStringAttrWithSetterException(cppValue, exceptionState);
200 exceptionState.throwIfNeeded();
201 }
202
203 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info )
204 {
205 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
206 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(v8Value , info);
207 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
208 }
209
210 static void TestTypedefsConstructorGetter(v8::Local<v8::String>, const v8::Prope rtyCallbackInfo<v8::Value>& info) 81 static void TestTypedefsConstructorGetter(v8::Local<v8::String>, const v8::Prope rtyCallbackInfo<v8::Value>& info)
211 { 82 {
212 v8::Handle<v8::Value> data = info.Data(); 83 v8::Handle<v8::Value> data = info.Data();
213 ASSERT(data->IsExternal()); 84 ASSERT(data->IsExternal());
214 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); 85 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
215 if (!perContextData) 86 if (!perContextData)
216 return; 87 return;
217 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); 88 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
218 } 89 }
219 90
220 static void TestTypedefsReplaceableAttributeSetter(v8::Local<v8::String> name, v 8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 91 static void TestTypedefsReplaceableAttributeSetter(v8::Local<v8::String> name, v 8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
221 { 92 {
222 info.This()->ForceSet(name, v8Value); 93 info.This()->ForceSet(name, v8Value);
223 } 94 }
224 95
225 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 96 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
226 { 97 {
227 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, v8Value , info); 98 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, v8Value , info);
228 } 99 }
229 100
230 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 101 static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
231 { 102 {
232 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 103 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
233 if (UNLIKELY(info.Length() <= 0)) { 104 if (UNLIKELY(info.Length() <= 0)) {
234 impl->func(); 105 impl->voidMethodArrayOfLongsArg();
235 return; 106 return;
236 } 107 }
237 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola te())); 108 V8TRYCATCH_VOID(Vector<int>, arrayOfLongsArg, toNativeArray<int>(info[0], 1, info.GetIsolate()));
238 impl->func(x); 109 impl->voidMethodArrayOfLongsArg(arrayOfLongsArg);
239 } 110 }
240 111
241 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 112 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
242 { 113 {
243 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 114 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
244 TestTypedefsV8Internal::funcMethod(info); 115 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info);
245 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 116 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
246 } 117 }
247 118
248 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 119 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
249 { 120 {
250 if (UNLIKELY(info.Length() < 3)) { 121 if (UNLIKELY(info.Length() < 2)) {
251 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate ()); 122 throwTypeError(ExceptionMessages::failedToExecute("voidMethodFloatArgStr ingArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(2, info.Length()) ), info.GetIsolate());
252 return; 123 return;
253 } 124 }
254 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 125 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
255 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); 126 V8TRYCATCH_VOID(float, floatArg, static_cast<float>(info[0]->NumberValue())) ;
256 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); 127 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[1]) ;
257 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); 128 impl->voidMethodFloatArgStringArg(floatArg, stringArg);
258 if (UNLIKELY(info.Length() <= 3)) {
259 impl->setShadow(width, height, blur);
260 return;
261 }
262 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, color, info[3]);
263 if (UNLIKELY(info.Length() <= 4)) {
264 impl->setShadow(width, height, blur, color);
265 return;
266 }
267 V8TRYCATCH_VOID(float, alpha, static_cast<float>(info[4]->NumberValue()));
268 impl->setShadow(width, height, blur, color, alpha);
269 } 129 }
270 130
271 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 131 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
272 { 132 {
273 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 133 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
274 TestTypedefsV8Internal::setShadowMethod(info); 134 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info);
275 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 135 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
276 } 136 }
277 137
278 static void voidMethodTestCallbackInterfaceArgumentMethod(const v8::FunctionCall backInfo<v8::Value>& info) 138 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb ackInfo<v8::Value>& info)
279 { 139 {
280 if (UNLIKELY(info.Length() < 1)) { 140 if (UNLIKELY(info.Length() < 1)) {
281 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceArgument", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, in fo.Length())), info.GetIsolate()); 141 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceTypeArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, inf o.Length())), info.GetIsolate());
282 return; 142 return;
283 } 143 }
284 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 144 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
285 if (info.Length() <= 0 || !info[0]->IsFunction()) { 145 if (info.Length() <= 0 || !info[0]->IsFunction()) {
286 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceArgument", "TestTypedefs", "The callback provided as parameter 1 is no t a function."), info.GetIsolate()); 146 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceTypeArg", "TestTypedefs", "The callback provided as parameter 1 is not a function."), info.GetIsolate());
287 return; 147 return;
288 } 148 }
289 OwnPtr<TestCallbackInterface> testCallbackInterface = V8TestCallbackInterfac e::create(v8::Handle<v8::Function>::Cast(info[0]), currentExecutionContext(info. GetIsolate())); 149 OwnPtr<TestCallbackInterface> testCallbackInterfaceTypeArg = V8TestCallbackI nterface::create(v8::Handle<v8::Function>::Cast(info[0]), currentExecutionContex t(info.GetIsolate()));
290 impl->voidMethodTestCallbackInterfaceArgument(testCallbackInterface.release( )); 150 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg.re lease());
291 } 151 }
292 152
293 static void voidMethodTestCallbackInterfaceArgumentMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info) 153 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info)
294 { 154 {
295 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 155 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
296 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceArgumentMethod(info); 156 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info);
297 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 157 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
298 } 158 }
299 159
300 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value >& info) 160 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ctionCallbackInfo<v8::Value>& info)
301 { 161 {
302 if (UNLIKELY(info.Length() < 1)) { 162 if (UNLIKELY(info.Length() < 1)) {
303 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg ", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf o.GetIsolate()); 163 throwTypeError(ExceptionMessages::failedToExecute("uLongLongMethodTestIn terfaceEmptyTypeSequenceArg", "TestTypedefs", ExceptionMessages::notEnoughArgume nts(1, info.Length())), info.GetIsolate());
304 return; 164 return;
305 } 165 }
306 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 166 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
307 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, sequenceArg, (toRefPtrN ativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate ()))); 167 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, testInterfaceEmptyTypeS equenceArg, (toRefPtrNativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[ 0], 1, info.GetIsolate())));
308 v8SetReturnValue(info, static_cast<double>(impl->methodWithSequenceArg(seque nceArg))); 168 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg)));
309 } 169 }
310 170
311 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& info) 171 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
312 { 172 {
313 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 173 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
314 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); 174 TestTypedefsV8Internal::uLongLongMethodTestInterfaceEmptyTypeSequenceArgMeth od(info);
315 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 175 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
316 } 176 }
317 177
318 static void fooOrBarMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info ) 178 static void fooOrBarMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info )
319 { 179 {
320 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 180 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
321 bool result0Enabled = false; 181 bool result0Enabled = false;
322 RefPtr<Foo> result0; 182 RefPtr<Foo> result0;
323 bool result1Enabled = false; 183 bool result1Enabled = false;
324 RefPtr<Bar> result1; 184 RefPtr<Bar> result1;
325 impl->fooOrBarMethod(result0Enabled, result0, result1Enabled, result1); 185 impl->fooOrBarMethod(result0Enabled, result0, result1Enabled, result1);
326 if (result0Enabled) { 186 if (result0Enabled) {
327 v8SetReturnValue(info, result0.release()); 187 v8SetReturnValue(info, result0.release());
328 return; 188 return;
329 } 189 }
330 if (result1Enabled) { 190 if (result1Enabled) {
331 v8SetReturnValue(info, result1.release()); 191 v8SetReturnValue(info, result1.release());
332 return; 192 return;
333 } 193 }
334 v8SetReturnValueNull(info); 194 v8SetReturnValueNull(info);
335 } 195 }
336 196
337 static void fooOrBarMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) 197 static void fooOrBarMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info)
338 { 198 {
339 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 199 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
340 TestTypedefsV8Internal::fooOrBarMethodMethod(info); 200 TestTypedefsV8Internal::fooOrBarMethodMethod(info);
341 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 201 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
342 } 202 }
343 203
344 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 204 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ckInfo<v8::Value>& info)
345 { 205 {
346 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function", "TestTypedefs", info.Holder(), info.GetIsolate());
347 if (UNLIKELY(info.Length() < 1)) { 206 if (UNLIKELY(info.Length() < 1)) {
348 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 207 throwTypeError(ExceptionMessages::failedToExecute("arrayOfStringsMethodA rrayOfStringsArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info .Length())), info.GetIsolate());
349 exceptionState.throwIfNeeded();
350 return; 208 return;
351 } 209 }
352 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 210 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
353 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate())); 211 V8TRYCATCH_VOID(Vector<String>, arrayOfStringsArg, toNativeArray<String>(inf o[0], 1, info.GetIsolate()));
354 Vector<String> result = impl->stringArrayFunction(values, exceptionState); 212 v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(a rrayOfStringsArg), info.GetIsolate()));
355 if (exceptionState.throwIfNeeded())
356 return;
357 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
358 } 213 }
359 214
360 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 215 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi onCallbackInfo<v8::Value>& info)
361 { 216 {
362 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 217 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
363 TestTypedefsV8Internal::stringArrayFunctionMethod(info); 218 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info);
364 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 219 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
365 } 220 }
366 221
367 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value> & info) 222 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
368 { 223 {
369 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function2", "TestTypedefs", info.Holder(), info.GetIsolate());
370 if (UNLIKELY(info.Length() < 1)) { 224 if (UNLIKELY(info.Length() < 1)) {
371 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 225 throwTypeError(ExceptionMessages::failedToExecute("stringArrayMethodStri ngArrayArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Lengt h())), info.GetIsolate());
372 exceptionState.throwIfNeeded();
373 return; 226 return;
374 } 227 }
375 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 228 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
376 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate())); 229 V8TRYCATCH_VOID(Vector<String>, stringArrayArg, toNativeArray<String>(info[0 ], 1, info.GetIsolate()));
377 Vector<String> result = impl->stringArrayFunction2(values, exceptionState); 230 v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringA rrayArg), info.GetIsolate()));
378 if (exceptionState.throwIfNeeded())
379 return;
380 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
381 } 231 }
382 232
383 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8 ::Value>& info) 233 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
384 { 234 {
385 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 235 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
386 TestTypedefsV8Internal::stringArrayFunction2Method(info); 236 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info);
387 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 237 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
388 } 238 }
389 239
390 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
391 {
392 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithE xception", "TestTypedefs", info.Holder(), info.GetIsolate());
393 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
394 impl->methodWithException(exceptionState);
395 if (exceptionState.throwIfNeeded())
396 return;
397 }
398
399 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
400 {
401 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
402 TestTypedefsV8Internal::methodWithExceptionMethod(info);
403 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
404 }
405
406 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 240 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
407 { 241 {
408 v8::Isolate* isolate = info.GetIsolate(); 242 v8::Isolate* isolate = info.GetIsolate();
409 if (UNLIKELY(info.Length() < 1)) { 243 if (UNLIKELY(info.Length() < 1)) {
410 throwTypeError(ExceptionMessages::failedToConstruct("TestTypedefs", Exce ptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); 244 throwTypeError(ExceptionMessages::failedToConstruct("TestTypedefs", Exce ptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
411 return; 245 return;
412 } 246 }
413 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, info[0]); 247 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]) ;
414 RefPtr<TestTypedefs> impl = TestTypedefs::create(hello); 248 RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg);
415 249
416 v8::Handle<v8::Object> wrapper = info.Holder(); 250 v8::Handle<v8::Object> wrapper = info.Holder();
417 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8 TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independe nt); 251 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8 TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independe nt);
418 v8SetReturnValue(info, wrapper); 252 v8SetReturnValue(info, wrapper);
419 } 253 }
420 254
421 } // namespace TestTypedefsV8Internal 255 } // namespace TestTypedefsV8Internal
422 256
423 static const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsAttributes [] = { 257 static const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsAttributes [] = {
424 {"unsignedLongLongAttr", TestTypedefsV8Internal::unsignedLongLongAttrAttribu teGetterCallback, TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetterCal lback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Pro pertyAttribute>(v8::None), 0 /* on instance */}, 258 {"uLongLongAttribute", TestTypedefsV8Internal::uLongLongAttributeAttributeGe tterCallback, TestTypedefsV8Internal::uLongLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyA ttribute>(v8::None), 0 /* on instance */},
425 {"TestSubObj", TestTypedefsV8Internal::TestTypedefsConstructorGetter, TestTy pedefsV8Internal::TestTypedefsReplaceableAttributeSetterCallback, 0, 0, const_ca st<WrapperTypeInfo*>(&V8TestSubObj::wrapperTypeInfo), static_cast<v8::AccessCont rol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), 0 /* on ins tance */}, 259 {"tAttribute", TestTypedefsV8Internal::TestTypedefsConstructorGetter, TestTy pedefsV8Internal::TestTypedefsReplaceableAttributeSetterCallback, 0, 0, const_ca st<WrapperTypeInfo*>(&V8TestSubObj::wrapperTypeInfo), static_cast<v8::AccessCont rol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum), 0 /* on ins tance */},
426 {"attrWithGetterException", TestTypedefsV8Internal::attrWithGetterExceptionA ttributeGetterCallback, TestTypedefsV8Internal::attrWithGetterExceptionAttribute SetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cas t<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
427 {"attrWithSetterException", TestTypedefsV8Internal::attrWithSetterExceptionA ttributeGetterCallback, TestTypedefsV8Internal::attrWithSetterExceptionAttribute SetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cas t<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
428 {"stringAttrWithGetterException", TestTypedefsV8Internal::stringAttrWithGett erExceptionAttributeGetterCallback, TestTypedefsV8Internal::stringAttrWithGetter ExceptionAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DE FAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
429 {"stringAttrWithSetterException", TestTypedefsV8Internal::stringAttrWithSett erExceptionAttributeGetterCallback, TestTypedefsV8Internal::stringAttrWithSetter ExceptionAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DE FAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
430 }; 260 };
431 261
432 static const V8DOMConfiguration::MethodConfiguration V8TestTypedefsMethods[] = { 262 static const V8DOMConfiguration::MethodConfiguration V8TestTypedefsMethods[] = {
433 {"func", TestTypedefsV8Internal::funcMethodCallback, 0, 0}, 263 {"voidMethodArrayOfLongsArg", TestTypedefsV8Internal::voidMethodArrayOfLongs ArgMethodCallback, 0, 0},
434 {"setShadow", TestTypedefsV8Internal::setShadowMethodCallback, 0, 3}, 264 {"voidMethodFloatArgStringArg", TestTypedefsV8Internal::voidMethodFloatArgSt ringArgMethodCallback, 0, 2},
435 {"voidMethodTestCallbackInterfaceArgument", TestTypedefsV8Internal::voidMeth odTestCallbackInterfaceArgumentMethodCallback, 0, 1}, 265 {"voidMethodTestCallbackInterfaceTypeArg", TestTypedefsV8Internal::voidMetho dTestCallbackInterfaceTypeArgMethodCallback, 0, 1},
436 {"methodWithSequenceArg", TestTypedefsV8Internal::methodWithSequenceArgMetho dCallback, 0, 1}, 266 {"uLongLongMethodTestInterfaceEmptyTypeSequenceArg", TestTypedefsV8Internal: :uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback, 0, 1},
437 {"fooOrBarMethod", TestTypedefsV8Internal::fooOrBarMethodMethodCallback, 0, 0}, 267 {"fooOrBarMethod", TestTypedefsV8Internal::fooOrBarMethodMethodCallback, 0, 0},
438 {"stringArrayFunction", TestTypedefsV8Internal::stringArrayFunctionMethodCal lback, 0, 1}, 268 {"arrayOfStringsMethodArrayOfStringsArg", TestTypedefsV8Internal::arrayOfStr ingsMethodArrayOfStringsArgMethodCallback, 0, 1},
439 {"stringArrayFunction2", TestTypedefsV8Internal::stringArrayFunction2MethodC allback, 0, 1}, 269 {"stringArrayMethodStringArrayArg", TestTypedefsV8Internal::stringArrayMetho dStringArrayArgMethodCallback, 0, 1},
440 {"methodWithException", TestTypedefsV8Internal::methodWithExceptionMethodCal lback, 0, 0},
441 }; 270 };
442 271
443 void V8TestTypedefs::constructorCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) 272 void V8TestTypedefs::constructorCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info)
444 { 273 {
445 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); 274 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
446 if (!info.IsConstructCall()) { 275 if (!info.IsConstructCall()) {
447 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Test Typedefs"), info.GetIsolate()); 276 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Test Typedefs"), info.GetIsolate());
448 return; 277 return;
449 } 278 }
450 279
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 fromInternalPointer(object)->deref(); 358 fromInternalPointer(object)->deref();
530 } 359 }
531 360
532 template<> 361 template<>
533 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 362 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
534 { 363 {
535 return toV8(impl, creationContext, isolate); 364 return toV8(impl, creationContext, isolate);
536 } 365 }
537 366
538 } // namespace WebCore 367 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestSpecialOperationsOverrideBuiltins.cpp ('k') | Tools/Scripts/webkitpy/bindings/main.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698