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

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

Issue 217053007: Revert of Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert 213543004 too Created 6 years, 8 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 uLongLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8: :Value>& info) 51 static void unsignedLongLongAttrAttributeGetter(const v8::PropertyCallbackInfo<v 8::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->uLongLongAttribute())); 55 v8SetReturnValue(info, static_cast<double>(impl->unsignedLongLongAttr()));
56 } 56 }
57 57
58 static void uLongLongAttributeAttributeGetterCallback(v8::Local<v8::String>, con st v8::PropertyCallbackInfo<v8::Value>& info) 58 static void unsignedLongLongAttrAttributeGetterCallback(v8::Local<v8::String>, c onst 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::uLongLongAttributeAttributeGetter(info); 61 TestTypedefsV8Internal::unsignedLongLongAttrAttributeGetter(info);
62 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 62 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
63 } 63 }
64 64
65 static void uLongLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, cons t v8::PropertyCallbackInfo<void>& info) 65 static void unsignedLongLongAttrAttributeSetter(v8::Local<v8::Value> v8Value, co nst 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, "uLongLongAttri bute", "TestTypedefs", holder, info.GetIsolate()); 68 ExceptionState exceptionState(ExceptionState::SetterContext, "unsignedLongLo ngAttr", "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->setULongLongAttribute(cppValue); 71 impl->setUnsignedLongLongAttr(cppValue);
72 } 72 }
73 73
74 static void uLongLongAttributeAttributeSetterCallback(v8::Local<v8::String>, v8: :Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 74 static void unsignedLongLongAttrAttributeSetterCallback(v8::Local<v8::String>, v 8::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::uLongLongAttributeAttributeSetter(v8Value, info); 77 TestTypedefsV8Internal::unsignedLongLongAttrAttributeSetter(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
81 static void TestTypedefsConstructorGetter(v8::Local<v8::String>, const v8::Prope rtyCallbackInfo<v8::Value>& info) 210 static void TestTypedefsConstructorGetter(v8::Local<v8::String>, const v8::Prope rtyCallbackInfo<v8::Value>& info)
82 { 211 {
83 v8::Handle<v8::Value> data = info.Data(); 212 v8::Handle<v8::Value> data = info.Data();
84 ASSERT(data->IsExternal()); 213 ASSERT(data->IsExternal());
85 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); 214 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
86 if (!perContextData) 215 if (!perContextData)
87 return; 216 return;
88 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); 217 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
89 } 218 }
90 219
91 static void TestTypedefsReplaceableAttributeSetter(v8::Local<v8::String> name, v 8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 220 static void TestTypedefsReplaceableAttributeSetter(v8::Local<v8::String> name, v 8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
92 { 221 {
93 info.This()->ForceSet(name, v8Value); 222 info.This()->ForceSet(name, v8Value);
94 } 223 }
95 224
96 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 225 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
97 { 226 {
98 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, v8Value , info); 227 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, v8Value , info);
99 } 228 }
100 229
101 static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V alue>& info) 230 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
102 { 231 {
103 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 232 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
104 if (UNLIKELY(info.Length() <= 0)) { 233 if (UNLIKELY(info.Length() <= 0)) {
105 impl->voidMethodArrayOfLongsArg(); 234 impl->func();
106 return; 235 return;
107 } 236 }
108 V8TRYCATCH_VOID(Vector<int>, arrayOfLongsArg, toNativeArray<int>(info[0], 1, info.GetIsolate())); 237 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola te()));
109 impl->voidMethodArrayOfLongsArg(arrayOfLongsArg); 238 impl->func(x);
110 } 239 }
111 240
112 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) 241 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
113 { 242 {
114 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 243 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
115 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info); 244 TestTypedefsV8Internal::funcMethod(info);
116 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 245 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
117 } 246 }
118 247
119 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 248 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
120 { 249 {
121 if (UNLIKELY(info.Length() < 2)) { 250 if (UNLIKELY(info.Length() < 3)) {
122 throwTypeError(ExceptionMessages::failedToExecute("voidMethodFloatArgStr ingArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(2, info.Length()) ), info.GetIsolate()); 251 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate ());
123 return; 252 return;
124 } 253 }
125 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 254 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
126 V8TRYCATCH_VOID(float, floatArg, static_cast<float>(info[0]->NumberValue())) ; 255 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue()));
127 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[1]) ; 256 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue()));
128 impl->voidMethodFloatArgStringArg(floatArg, stringArg); 257 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue()));
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);
129 } 269 }
130 270
131 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 271 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
132 { 272 {
133 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 273 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
134 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info); 274 TestTypedefsV8Internal::setShadowMethod(info);
135 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 275 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
136 } 276 }
137 277
138 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb ackInfo<v8::Value>& info) 278 static void voidMethodTestCallbackInterfaceArgumentMethod(const v8::FunctionCall backInfo<v8::Value>& info)
139 { 279 {
140 if (UNLIKELY(info.Length() < 1)) { 280 if (UNLIKELY(info.Length() < 1)) {
141 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceTypeArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, inf o.Length())), info.GetIsolate()); 281 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceArgument", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, in fo.Length())), info.GetIsolate());
142 return; 282 return;
143 } 283 }
144 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 284 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
145 if (info.Length() <= 0 || !info[0]->IsFunction()) { 285 if (info.Length() <= 0 || !info[0]->IsFunction()) {
146 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceTypeArg", "TestTypedefs", "The callback provided as parameter 1 is not a function."), info.GetIsolate()); 286 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceArgument", "TestTypedefs", "The callback provided as parameter 1 is no t a function."), info.GetIsolate());
147 return; 287 return;
148 } 288 }
149 OwnPtr<TestCallbackInterface> testCallbackInterfaceTypeArg = V8TestCallbackI nterface::create(v8::Handle<v8::Function>::Cast(info[0]), currentExecutionContex t(info.GetIsolate())); 289 OwnPtr<TestCallbackInterface> testCallbackInterface = V8TestCallbackInterfac e::create(v8::Handle<v8::Function>::Cast(info[0]), currentExecutionContext(info. GetIsolate()));
150 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg.re lease()); 290 impl->voidMethodTestCallbackInterfaceArgument(testCallbackInterface.release( ));
151 } 291 }
152 292
153 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info) 293 static void voidMethodTestCallbackInterfaceArgumentMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info)
154 { 294 {
155 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 295 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
156 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info); 296 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceArgumentMethod(info);
157 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 297 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
158 } 298 }
159 299
160 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ctionCallbackInfo<v8::Value>& info) 300 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value >& info)
161 { 301 {
162 if (UNLIKELY(info.Length() < 1)) { 302 if (UNLIKELY(info.Length() < 1)) {
163 throwTypeError(ExceptionMessages::failedToExecute("uLongLongMethodTestIn terfaceEmptyTypeSequenceArg", "TestTypedefs", ExceptionMessages::notEnoughArgume nts(1, info.Length())), info.GetIsolate()); 303 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg ", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf o.GetIsolate());
164 return; 304 return;
165 } 305 }
166 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 306 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
167 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, testInterfaceEmptyTypeS equenceArg, (toRefPtrNativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[ 0], 1, info.GetIsolate()))); 307 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, sequenceArg, (toRefPtrN ativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[0], 1, info.GetIsolate ())));
168 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg))); 308 v8SetReturnValue(info, static_cast<double>(impl->methodWithSequenceArg(seque nceArg)));
169 } 309 }
170 310
171 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 311 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& info)
172 { 312 {
173 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 313 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
174 TestTypedefsV8Internal::uLongLongMethodTestInterfaceEmptyTypeSequenceArgMeth od(info); 314 TestTypedefsV8Internal::methodWithSequenceArgMethod(info);
175 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 315 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
176 } 316 }
177 317
178 static void fooOrBarMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info ) 318 static void fooOrBarMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info )
179 { 319 {
180 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 320 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
181 bool result0Enabled = false; 321 bool result0Enabled = false;
182 RefPtr<Foo> result0; 322 RefPtr<Foo> result0;
183 bool result1Enabled = false; 323 bool result1Enabled = false;
184 RefPtr<Bar> result1; 324 RefPtr<Bar> result1;
185 impl->fooOrBarMethod(result0Enabled, result0, result1Enabled, result1); 325 impl->fooOrBarMethod(result0Enabled, result0, result1Enabled, result1);
186 if (result0Enabled) { 326 if (result0Enabled) {
187 v8SetReturnValue(info, result0.release()); 327 v8SetReturnValue(info, result0.release());
188 return; 328 return;
189 } 329 }
190 if (result1Enabled) { 330 if (result1Enabled) {
191 v8SetReturnValue(info, result1.release()); 331 v8SetReturnValue(info, result1.release());
192 return; 332 return;
193 } 333 }
194 v8SetReturnValueNull(info); 334 v8SetReturnValueNull(info);
195 } 335 }
196 336
197 static void fooOrBarMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) 337 static void fooOrBarMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info)
198 { 338 {
199 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 339 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
200 TestTypedefsV8Internal::fooOrBarMethodMethod(info); 340 TestTypedefsV8Internal::fooOrBarMethodMethod(info);
201 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 341 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
202 } 342 }
203 343
204 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ckInfo<v8::Value>& info) 344 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
205 { 345 {
346 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function", "TestTypedefs", info.Holder(), info.GetIsolate());
206 if (UNLIKELY(info.Length() < 1)) { 347 if (UNLIKELY(info.Length() < 1)) {
207 throwTypeError(ExceptionMessages::failedToExecute("arrayOfStringsMethodA rrayOfStringsArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info .Length())), info.GetIsolate()); 348 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
349 exceptionState.throwIfNeeded();
208 return; 350 return;
209 } 351 }
210 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 352 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
211 V8TRYCATCH_VOID(Vector<String>, arrayOfStringsArg, toNativeArray<String>(inf o[0], 1, info.GetIsolate())); 353 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate()));
212 v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(a rrayOfStringsArg), info.GetIsolate())); 354 Vector<String> result = impl->stringArrayFunction(values, exceptionState);
355 if (exceptionState.throwIfNeeded())
356 return;
357 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
213 } 358 }
214 359
215 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi onCallbackInfo<v8::Value>& info) 360 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
216 { 361 {
217 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 362 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
218 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info); 363 TestTypedefsV8Internal::stringArrayFunctionMethod(info);
219 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 364 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
220 } 365 }
221 366
222 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) 367 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value> & info)
223 { 368 {
369 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function2", "TestTypedefs", info.Holder(), info.GetIsolate());
224 if (UNLIKELY(info.Length() < 1)) { 370 if (UNLIKELY(info.Length() < 1)) {
225 throwTypeError(ExceptionMessages::failedToExecute("stringArrayMethodStri ngArrayArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Lengt h())), info.GetIsolate()); 371 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
372 exceptionState.throwIfNeeded();
226 return; 373 return;
227 } 374 }
228 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 375 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
229 V8TRYCATCH_VOID(Vector<String>, stringArrayArg, toNativeArray<String>(info[0 ], 1, info.GetIsolate())); 376 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate()));
230 v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringA rrayArg), info.GetIsolate())); 377 Vector<String> result = impl->stringArrayFunction2(values, exceptionState);
378 if (exceptionState.throwIfNeeded())
379 return;
380 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
231 } 381 }
232 382
233 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 383 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8 ::Value>& info)
234 { 384 {
235 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 385 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
236 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info); 386 TestTypedefsV8Internal::stringArrayFunction2Method(info);
237 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 387 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
238 } 388 }
239 389
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
240 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 406 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
241 { 407 {
242 v8::Isolate* isolate = info.GetIsolate(); 408 v8::Isolate* isolate = info.GetIsolate();
243 if (UNLIKELY(info.Length() < 1)) { 409 if (UNLIKELY(info.Length() < 1)) {
244 throwTypeError(ExceptionMessages::failedToConstruct("TestTypedefs", Exce ptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); 410 throwTypeError(ExceptionMessages::failedToConstruct("TestTypedefs", Exce ptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
245 return; 411 return;
246 } 412 }
247 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]) ; 413 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, info[0]);
248 RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg); 414 RefPtr<TestTypedefs> impl = TestTypedefs::create(hello);
249 415
250 v8::Handle<v8::Object> wrapper = info.Holder(); 416 v8::Handle<v8::Object> wrapper = info.Holder();
251 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8 TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independe nt); 417 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8 TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independe nt);
252 v8SetReturnValue(info, wrapper); 418 v8SetReturnValue(info, wrapper);
253 } 419 }
254 420
255 } // namespace TestTypedefsV8Internal 421 } // namespace TestTypedefsV8Internal
256 422
257 static const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsAttributes [] = { 423 static const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsAttributes [] = {
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 */}, 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 */},
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 */}, 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 */},
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 */},
260 }; 430 };
261 431
262 static const V8DOMConfiguration::MethodConfiguration V8TestTypedefsMethods[] = { 432 static const V8DOMConfiguration::MethodConfiguration V8TestTypedefsMethods[] = {
263 {"voidMethodArrayOfLongsArg", TestTypedefsV8Internal::voidMethodArrayOfLongs ArgMethodCallback, 0, 0}, 433 {"func", TestTypedefsV8Internal::funcMethodCallback, 0, 0},
264 {"voidMethodFloatArgStringArg", TestTypedefsV8Internal::voidMethodFloatArgSt ringArgMethodCallback, 0, 2}, 434 {"setShadow", TestTypedefsV8Internal::setShadowMethodCallback, 0, 3},
265 {"voidMethodTestCallbackInterfaceTypeArg", TestTypedefsV8Internal::voidMetho dTestCallbackInterfaceTypeArgMethodCallback, 0, 1}, 435 {"voidMethodTestCallbackInterfaceArgument", TestTypedefsV8Internal::voidMeth odTestCallbackInterfaceArgumentMethodCallback, 0, 1},
266 {"uLongLongMethodTestInterfaceEmptyTypeSequenceArg", TestTypedefsV8Internal: :uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback, 0, 1}, 436 {"methodWithSequenceArg", TestTypedefsV8Internal::methodWithSequenceArgMetho dCallback, 0, 1},
267 {"fooOrBarMethod", TestTypedefsV8Internal::fooOrBarMethodMethodCallback, 0, 0}, 437 {"fooOrBarMethod", TestTypedefsV8Internal::fooOrBarMethodMethodCallback, 0, 0},
268 {"arrayOfStringsMethodArrayOfStringsArg", TestTypedefsV8Internal::arrayOfStr ingsMethodArrayOfStringsArgMethodCallback, 0, 1}, 438 {"stringArrayFunction", TestTypedefsV8Internal::stringArrayFunctionMethodCal lback, 0, 1},
269 {"stringArrayMethodStringArrayArg", TestTypedefsV8Internal::stringArrayMetho dStringArrayArgMethodCallback, 0, 1}, 439 {"stringArrayFunction2", TestTypedefsV8Internal::stringArrayFunction2MethodC allback, 0, 1},
440 {"methodWithException", TestTypedefsV8Internal::methodWithExceptionMethodCal lback, 0, 0},
270 }; 441 };
271 442
272 void V8TestTypedefs::constructorCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) 443 void V8TestTypedefs::constructorCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info)
273 { 444 {
274 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor"); 445 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
275 if (!info.IsConstructCall()) { 446 if (!info.IsConstructCall()) {
276 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Test Typedefs"), info.GetIsolate()); 447 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Test Typedefs"), info.GetIsolate());
277 return; 448 return;
278 } 449 }
279 450
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 fromInternalPointer(object)->deref(); 529 fromInternalPointer(object)->deref();
359 } 530 }
360 531
361 template<> 532 template<>
362 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 533 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
363 { 534 {
364 return toV8(impl, creationContext, isolate); 535 return toV8(impl, creationContext, isolate);
365 } 536 }
366 537
367 } // namespace WebCore 538 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.h ('k') | Source/bindings/v8/CustomElementConstructorBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698