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

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

Issue 99083002: WIP: Migrate generated bindings to new ExceptionState constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 7 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 static void immutableSerializedScriptValueAttributeSetterCallback(v8::Local<v8:: String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf o) 129 static void immutableSerializedScriptValueAttributeSetterCallback(v8::Local<v8:: String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf o)
130 { 130 {
131 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 131 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
132 TestTypedefsV8Internal::immutableSerializedScriptValueAttributeSetter(jsValu e, info); 132 TestTypedefsV8Internal::immutableSerializedScriptValueAttributeSetter(jsValu e, info);
133 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 133 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
134 } 134 }
135 135
136 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info) 136 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info)
137 { 137 {
138 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); 138 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
139 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 139 ExceptionState exceptionState(ExceptionState::GetterContext, "attrWithGetter Exception", "TestTypedefs" ,info.Holder(), info.GetIsolate());
140 int jsValue = imp->attrWithGetterException(exceptionState); 140 int jsValue = imp->attrWithGetterException(exceptionState);
141 if (UNLIKELY(exceptionState.throwIfNeeded())) 141 if (UNLIKELY(exceptionState.throwIfNeeded()))
142 return; 142 return;
143 v8SetReturnValueInt(info, jsValue); 143 v8SetReturnValueInt(info, jsValue);
144 } 144 }
145 145
146 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info) 146 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
147 { 147 {
148 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 148 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
149 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); 149 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info);
(...skipping 22 matching lines...) Expand all
172 172
173 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info) 173 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
174 { 174 {
175 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 175 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
176 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); 176 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info);
177 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 177 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
178 } 178 }
179 179
180 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 180 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
181 { 181 {
182 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithSetter Exception", "TestTypedefs", info.Holder(), info.GetIsolate());
182 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); 183 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
183 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); 184 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue));
184 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
185 imp->setAttrWithSetterException(cppValue, exceptionState); 185 imp->setAttrWithSetterException(cppValue, exceptionState);
186 exceptionState.throwIfNeeded(); 186 exceptionState.throwIfNeeded();
187 } 187 }
188 188
189 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 189 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
190 { 190 {
191 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 191 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
192 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info ); 192 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info );
193 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 193 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
194 } 194 }
195 195
196 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb ackInfo<v8::Value>& info) 196 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb ackInfo<v8::Value>& info)
197 { 197 {
198 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); 198 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
199 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 199 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttrWith GetterException", "TestTypedefs" ,info.Holder(), info.GetIsolate());
200 String jsValue = imp->stringAttrWithGetterException(exceptionState); 200 String jsValue = imp->stringAttrWithGetterException(exceptionState);
201 if (UNLIKELY(exceptionState.throwIfNeeded())) 201 if (UNLIKELY(exceptionState.throwIfNeeded()))
202 return; 202 return;
203 v8SetReturnValueString(info, jsValue, info.GetIsolate()); 203 v8SetReturnValueString(info, jsValue, info.GetIsolate());
204 } 204 }
205 205
206 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info) 206 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info)
207 { 207 {
208 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 208 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
209 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); 209 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info);
(...skipping 22 matching lines...) Expand all
232 232
233 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info) 233 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info)
234 { 234 {
235 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 235 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
236 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); 236 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info);
237 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 237 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
238 } 238 }
239 239
240 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js Value, const v8::PropertyCallbackInfo<void>& info) 240 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js Value, const v8::PropertyCallbackInfo<void>& info)
241 { 241 {
242 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith SetterException", "TestTypedefs", info.Holder(), info.GetIsolate());
242 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); 243 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
243 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); 244 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
244 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
245 imp->setStringAttrWithSetterException(cppValue, exceptionState); 245 imp->setStringAttrWithSetterException(cppValue, exceptionState);
246 exceptionState.throwIfNeeded(); 246 exceptionState.throwIfNeeded();
247 } 247 }
248 248
249 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info ) 249 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info )
250 { 250 {
251 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 251 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
252 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue , info); 252 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue , info);
253 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 253 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
254 } 254 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 366
367 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo< v8::Value>& info) 367 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo< v8::Value>& info)
368 { 368 {
369 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 369 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
370 TestTypedefsV8Internal::immutablePointFunctionMethod(info); 370 TestTypedefsV8Internal::immutablePointFunctionMethod(info);
371 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 371 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
372 } 372 }
373 373
374 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 374 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
375 { 375 {
376 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function", "TestTypedefs", info.Holder(), info.GetIsolate());
376 if (UNLIKELY(info.Length() < 1)) { 377 if (UNLIKELY(info.Length() < 1)) {
377 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info. GetIsolate()); 378 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info. GetIsolate());
378 return; 379 return;
379 } 380 }
380 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); 381 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
381 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
382 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate())); 382 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate()));
383 Vector<String> result = imp->stringArrayFunction(values, exceptionState); 383 Vector<String> result = imp->stringArrayFunction(values, exceptionState);
384 if (exceptionState.throwIfNeeded()) 384 if (exceptionState.throwIfNeeded())
385 return; 385 return;
386 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); 386 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
387 } 387 }
388 388
389 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 389 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
390 { 390 {
391 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 391 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
392 TestTypedefsV8Internal::stringArrayFunctionMethod(info); 392 TestTypedefsV8Internal::stringArrayFunctionMethod(info);
393 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 393 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
394 } 394 }
395 395
396 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value> & info) 396 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value> & info)
397 { 397 {
398 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function2", "TestTypedefs", info.Holder(), info.GetIsolate());
398 if (UNLIKELY(info.Length() < 1)) { 399 if (UNLIKELY(info.Length() < 1)) {
399 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction2" , "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info .GetIsolate()); 400 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction2" , "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info .GetIsolate());
400 return; 401 return;
401 } 402 }
402 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); 403 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
403 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
404 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate())); 404 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate()));
405 Vector<String> result = imp->stringArrayFunction2(values, exceptionState); 405 Vector<String> result = imp->stringArrayFunction2(values, exceptionState);
406 if (exceptionState.throwIfNeeded()) 406 if (exceptionState.throwIfNeeded())
407 return; 407 return;
408 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); 408 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
409 } 409 }
410 410
411 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8 ::Value>& info) 411 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8 ::Value>& info)
412 { 412 {
413 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 413 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
414 TestTypedefsV8Internal::stringArrayFunction2Method(info); 414 TestTypedefsV8Internal::stringArrayFunction2Method(info);
415 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 415 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
416 } 416 }
417 417
418 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 418 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
419 { 419 {
420 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithE xception", "TestTypedefs", info.Holder(), info.GetIsolate());
420 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); 421 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder());
421 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
422 imp->methodWithException(exceptionState); 422 imp->methodWithException(exceptionState);
423 if (exceptionState.throwIfNeeded()) 423 if (exceptionState.throwIfNeeded())
424 return; 424 return;
425 } 425 }
426 426
427 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 427 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
428 { 428 {
429 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 429 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
430 TestTypedefsV8Internal::methodWithExceptionMethod(info); 430 TestTypedefsV8Internal::methodWithExceptionMethod(info);
431 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 431 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 fromInternalPointer(object)->deref(); 565 fromInternalPointer(object)->deref();
566 } 566 }
567 567
568 template<> 568 template<>
569 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 569 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
570 { 570 {
571 return toV8(impl, creationContext, isolate); 571 return toV8(impl, creationContext, isolate);
572 } 572 }
573 573
574 } // namespace WebCore 574 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698