| OLD | NEW |
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 static void immutableSerializedScriptValueAttributeSetterCallback(v8::Local<v8::
String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) | 130 static void immutableSerializedScriptValueAttributeSetterCallback(v8::Local<v8::
String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf
o) |
| 131 { | 131 { |
| 132 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 132 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 133 TestTypedefsV8Internal::immutableSerializedScriptValueAttributeSetter(jsValu
e, info); | 133 TestTypedefsV8Internal::immutableSerializedScriptValueAttributeSetter(jsValu
e, info); |
| 134 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 134 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | 137 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) |
| 138 { | 138 { |
| 139 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 139 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 140 ExceptionState es(info.GetIsolate()); | 140 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 141 int jsValue = imp->attrWithGetterException(es); | 141 int jsValue = imp->attrWithGetterException(es); |
| 142 if (UNLIKELY(es.throwIfNeeded())) | 142 if (UNLIKELY(es.throwIfNeeded())) |
| 143 return; | 143 return; |
| 144 v8SetReturnValueInt(info, jsValue); | 144 v8SetReturnValueInt(info, jsValue); |
| 145 } | 145 } |
| 146 | 146 |
| 147 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 147 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 148 { | 148 { |
| 149 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 149 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 150 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); | 150 TestTypedefsV8Internal::attrWithGetterExceptionAttributeGetter(info); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 175 { | 175 { |
| 176 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 176 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 177 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); | 177 TestTypedefsV8Internal::attrWithSetterExceptionAttributeGetter(info); |
| 178 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 178 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 179 } | 179 } |
| 180 | 180 |
| 181 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) | 181 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<void>& info) |
| 182 { | 182 { |
| 183 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 183 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 184 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); | 184 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); |
| 185 ExceptionState es(info.GetIsolate()); | 185 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 186 imp->setAttrWithSetterException(cppValue, es); | 186 imp->setAttrWithSetterException(cppValue, es); |
| 187 es.throwIfNeeded(); | 187 es.throwIfNeeded(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 190 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String>
, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 191 { | 191 { |
| 192 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 192 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 193 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info
); | 193 TestTypedefsV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info
); |
| 194 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 194 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 195 } | 195 } |
| 196 | 196 |
| 197 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) | 197 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb
ackInfo<v8::Value>& info) |
| 198 { | 198 { |
| 199 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 199 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 200 ExceptionState es(info.GetIsolate()); | 200 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 201 String jsValue = imp->stringAttrWithGetterException(es); | 201 String jsValue = imp->stringAttrWithGetterException(es); |
| 202 if (UNLIKELY(es.throwIfNeeded())) | 202 if (UNLIKELY(es.throwIfNeeded())) |
| 203 return; | 203 return; |
| 204 v8SetReturnValueString(info, jsValue, info.GetIsolate()); | 204 v8SetReturnValueString(info, jsValue, info.GetIsolate()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 207 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 208 { | 208 { |
| 209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 209 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 210 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); | 210 TestTypedefsV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 235 { | 235 { |
| 236 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | 236 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); |
| 237 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); | 237 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); |
| 238 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 238 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 239 } | 239 } |
| 240 | 240 |
| 241 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) | 241 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js
Value, const v8::PropertyCallbackInfo<void>& info) |
| 242 { | 242 { |
| 243 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 243 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 244 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 244 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
| 245 ExceptionState es(info.GetIsolate()); | 245 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 246 imp->setStringAttrWithSetterException(cppValue, es); | 246 imp->setStringAttrWithSetterException(cppValue, es); |
| 247 es.throwIfNeeded(); | 247 es.throwIfNeeded(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) | 250 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S
tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info
) |
| 251 { | 251 { |
| 252 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); | 252 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); |
| 253 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue
, info); | 253 TestTypedefsV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue
, info); |
| 254 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 254 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 255 } | 255 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 401 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 402 } | 402 } |
| 403 | 403 |
| 404 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 404 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 405 { | 405 { |
| 406 if (UNLIKELY(info.Length() < 1)) { | 406 if (UNLIKELY(info.Length() < 1)) { |
| 407 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction",
"TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.
GetIsolate()); | 407 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction",
"TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.
GetIsolate()); |
| 408 return; | 408 return; |
| 409 } | 409 } |
| 410 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 410 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 411 ExceptionState es(info.GetIsolate()); | 411 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 412 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 412 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
| 413 Vector<String> result = imp->stringArrayFunction(values, es); | 413 Vector<String> result = imp->stringArrayFunction(values, es); |
| 414 if (es.throwIfNeeded()) | 414 if (es.throwIfNeeded()) |
| 415 return; | 415 return; |
| 416 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 416 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
| 417 } | 417 } |
| 418 | 418 |
| 419 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 419 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 420 { | 420 { |
| 421 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 421 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 422 TestTypedefsV8Internal::stringArrayFunctionMethod(info); | 422 TestTypedefsV8Internal::stringArrayFunctionMethod(info); |
| 423 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 423 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 424 } | 424 } |
| 425 | 425 |
| 426 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) | 426 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) |
| 427 { | 427 { |
| 428 if (UNLIKELY(info.Length() < 1)) { | 428 if (UNLIKELY(info.Length() < 1)) { |
| 429 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction2"
, "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); | 429 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction2"
, "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); |
| 430 return; | 430 return; |
| 431 } | 431 } |
| 432 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 432 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 433 ExceptionState es(info.GetIsolate()); | 433 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 434 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 434 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
| 435 Vector<String> result = imp->stringArrayFunction2(values, es); | 435 Vector<String> result = imp->stringArrayFunction2(values, es); |
| 436 if (es.throwIfNeeded()) | 436 if (es.throwIfNeeded()) |
| 437 return; | 437 return; |
| 438 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 438 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
| 439 } | 439 } |
| 440 | 440 |
| 441 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) | 441 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) |
| 442 { | 442 { |
| 443 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 443 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 444 TestTypedefsV8Internal::stringArrayFunction2Method(info); | 444 TestTypedefsV8Internal::stringArrayFunction2Method(info); |
| 445 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 445 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 446 } | 446 } |
| 447 | 447 |
| 448 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 448 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 449 { | 449 { |
| 450 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 450 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 451 ExceptionState es(info.GetIsolate()); | 451 ExceptionState es(info.Holder(), info.GetIsolate()); |
| 452 imp->methodWithException(es); | 452 imp->methodWithException(es); |
| 453 if (es.throwIfNeeded()) | 453 if (es.throwIfNeeded()) |
| 454 return; | 454 return; |
| 455 } | 455 } |
| 456 | 456 |
| 457 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 457 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 458 { | 458 { |
| 459 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 459 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 460 TestTypedefsV8Internal::methodWithExceptionMethod(info); | 460 TestTypedefsV8Internal::methodWithExceptionMethod(info); |
| 461 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 461 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl, &wrapperTypeI
nfo, wrapper, isolate, WrapperConfiguration::Independent); | 589 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl, &wrapperTypeI
nfo, wrapper, isolate, WrapperConfiguration::Independent); |
| 590 return wrapper; | 590 return wrapper; |
| 591 } | 591 } |
| 592 | 592 |
| 593 void V8TestTypedefs::derefObject(void* object) | 593 void V8TestTypedefs::derefObject(void* object) |
| 594 { | 594 { |
| 595 fromInternalPointer(object)->deref(); | 595 fromInternalPointer(object)->deref(); |
| 596 } | 596 } |
| 597 | 597 |
| 598 } // namespace WebCore | 598 } // namespace WebCore |
| OLD | NEW |