| 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 exceptionState(info.Holder(), info.GetIsolate()); | 140 ExceptionState exceptionState(ExceptionState::GetterContext, "attrWithGetter
Exception", "TestTypedefs" ,info.Holder(), info.GetIsolate()); |
| 141 int jsValue = imp->attrWithGetterException(exceptionState); | 141 int jsValue = imp->attrWithGetterException(exceptionState); |
| 142 if (UNLIKELY(exceptionState.throwIfNeeded())) | 142 if (UNLIKELY(exceptionState.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 22 matching lines...) Expand all Loading... |
| 173 | 173 |
| 174 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) | 174 static void attrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::String>
, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 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 ExceptionState exceptionState(ExceptionState::SetterContext, "attrWithSetter
Exception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 183 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 184 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 184 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); | 185 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); |
| 185 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 186 imp->setAttrWithSetterException(cppValue, exceptionState); | 186 imp->setAttrWithSetterException(cppValue, exceptionState); |
| 187 exceptionState.throwIfNeeded(); | 187 exceptionState.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 exceptionState(info.Holder(), info.GetIsolate()); | 200 ExceptionState exceptionState(ExceptionState::GetterContext, "stringAttrWith
GetterException", "TestTypedefs" ,info.Holder(), info.GetIsolate()); |
| 201 String jsValue = imp->stringAttrWithGetterException(exceptionState); | 201 String jsValue = imp->stringAttrWithGetterException(exceptionState); |
| 202 if (UNLIKELY(exceptionState.throwIfNeeded())) | 202 if (UNLIKELY(exceptionState.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 22 matching lines...) Expand all Loading... |
| 233 | 233 |
| 234 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) | 234 static void stringAttrWithSetterExceptionAttributeGetterCallback(v8::Local<v8::S
tring>, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 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 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttrWith
SetterException", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 243 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 244 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 244 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); | 245 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); |
| 245 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 246 imp->setStringAttrWithSetterException(cppValue, exceptionState); | 246 imp->setStringAttrWithSetterException(cppValue, exceptionState); |
| 247 exceptionState.throwIfNeeded(); | 247 exceptionState.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 13 matching lines...) Expand all Loading... |
| 269 info.This()->ForceSet(name, jsValue); | 269 info.This()->ForceSet(name, jsValue); |
| 270 } | 270 } |
| 271 | 271 |
| 272 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String>
name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 272 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String>
name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 273 { | 273 { |
| 274 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, jsValue
, info); | 274 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, jsValue
, info); |
| 275 } | 275 } |
| 276 | 276 |
| 277 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 277 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 278 { | 278 { |
| 279 ExceptionState exceptionState(ExceptionState::ExecutionContext, "func", "Tes
tTypedefs", info.Holder(), info.GetIsolate()); |
| 279 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 280 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 280 if (UNLIKELY(info.Length() <= 0)) { | 281 if (UNLIKELY(info.Length() <= 0)) { |
| 281 imp->func(); | 282 imp->func(); |
| 282 return; | 283 return; |
| 283 } | 284 } |
| 284 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola
te())); | 285 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(info[0], 1, info.GetIsola
te())); |
| 285 imp->func(x); | 286 imp->func(x); |
| 286 } | 287 } |
| 287 | 288 |
| 288 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 289 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 289 { | 290 { |
| 290 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 291 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 291 TestTypedefsV8Internal::funcMethod(info); | 292 TestTypedefsV8Internal::funcMethod(info); |
| 292 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 293 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 293 } | 294 } |
| 294 | 295 |
| 295 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 296 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 296 { | 297 { |
| 298 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setShadow",
"TestTypedefs", info.Holder(), info.GetIsolate()); |
| 297 if (UNLIKELY(info.Length() < 3)) { | 299 if (UNLIKELY(info.Length() < 3)) { |
| 298 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType
defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate
()); | 300 throwTypeError(ExceptionMessages::failedToExecute("setShadow", "TestType
defs", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsolate
()); |
| 299 return; | 301 return; |
| 300 } | 302 } |
| 301 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 303 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 302 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); | 304 V8TRYCATCH_VOID(float, width, static_cast<float>(info[0]->NumberValue())); |
| 303 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); | 305 V8TRYCATCH_VOID(float, height, static_cast<float>(info[1]->NumberValue())); |
| 304 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); | 306 V8TRYCATCH_VOID(float, blur, static_cast<float>(info[2]->NumberValue())); |
| 305 if (UNLIKELY(info.Length() <= 3)) { | 307 if (UNLIKELY(info.Length() <= 3)) { |
| 306 imp->setShadow(width, height, blur); | 308 imp->setShadow(width, height, blur); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 317 | 319 |
| 318 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 320 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 319 { | 321 { |
| 320 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 322 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 321 TestTypedefsV8Internal::setShadowMethod(info); | 323 TestTypedefsV8Internal::setShadowMethod(info); |
| 322 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 324 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 323 } | 325 } |
| 324 | 326 |
| 325 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value
>& info) | 327 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value
>& info) |
| 326 { | 328 { |
| 329 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithS
equenceArg", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 327 if (UNLIKELY(info.Length() < 1)) { | 330 if (UNLIKELY(info.Length() < 1)) { |
| 328 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg
", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); | 331 throwTypeError(ExceptionMessages::failedToExecute("methodWithSequenceArg
", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), inf
o.GetIsolate()); |
| 329 return; | 332 return; |
| 330 } | 333 } |
| 331 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 334 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 332 V8TRYCATCH_VOID(Vector<RefPtr<SerializedScriptValue> >, sequenceArg, (toRefP
trNativeArray<SerializedScriptValue, V8SerializedScriptValue>(info[0], 1, info.G
etIsolate()))); | 335 V8TRYCATCH_VOID(Vector<RefPtr<SerializedScriptValue> >, sequenceArg, (toRefP
trNativeArray<SerializedScriptValue, V8SerializedScriptValue>(info[0], 1, info.G
etIsolate()))); |
| 333 v8SetReturnValue(info, static_cast<double>(imp->methodWithSequenceArg(sequen
ceArg))); | 336 v8SetReturnValue(info, static_cast<double>(imp->methodWithSequenceArg(sequen
ceArg))); |
| 334 } | 337 } |
| 335 | 338 |
| 336 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) | 339 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v
8::Value>& info) |
| 337 { | 340 { |
| 338 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 341 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 339 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); | 342 TestTypedefsV8Internal::methodWithSequenceArgMethod(info); |
| 340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 343 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 341 } | 344 } |
| 342 | 345 |
| 343 static void nullableArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | 346 static void nullableArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& in
fo) |
| 344 { | 347 { |
| 348 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nullableArr
ayArg", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 345 if (UNLIKELY(info.Length() < 1)) { | 349 if (UNLIKELY(info.Length() < 1)) { |
| 346 throwTypeError(ExceptionMessages::failedToExecute("nullableArrayArg", "T
estTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Get
Isolate()); | 350 throwTypeError(ExceptionMessages::failedToExecute("nullableArrayArg", "T
estTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Get
Isolate()); |
| 347 return; | 351 return; |
| 348 } | 352 } |
| 349 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 353 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 350 bool arrayArgIsNull = info[0]->IsNull(); | 354 bool arrayArgIsNull = info[0]->IsNull(); |
| 351 V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(info[0], 1,
info.GetIsolate())); | 355 V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(info[0], 1,
info.GetIsolate())); |
| 352 imp->nullableArrayArg(arrayArgIsNull ? 0 : &arrayArg); | 356 imp->nullableArrayArg(arrayArgIsNull ? 0 : &arrayArg); |
| 353 } | 357 } |
| 354 | 358 |
| 355 static void nullableArrayArgMethodCallback(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 359 static void nullableArrayArgMethodCallback(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
| 356 { | 360 { |
| 357 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 361 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 358 TestTypedefsV8Internal::nullableArrayArgMethod(info); | 362 TestTypedefsV8Internal::nullableArrayArgMethod(info); |
| 359 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 363 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 360 } | 364 } |
| 361 | 365 |
| 362 static void immutablePointFunctionMethod(const v8::FunctionCallbackInfo<v8::Valu
e>& info) | 366 static void immutablePointFunctionMethod(const v8::FunctionCallbackInfo<v8::Valu
e>& info) |
| 363 { | 367 { |
| 368 ExceptionState exceptionState(ExceptionState::ExecutionContext, "immutablePo
intFunction", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 364 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 369 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 365 v8SetReturnValue(info, WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(imp-
>immutablePointFunction()))); | 370 v8SetReturnValue(info, WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(imp-
>immutablePointFunction()))); |
| 366 } | 371 } |
| 367 | 372 |
| 368 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) | 373 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo<
v8::Value>& info) |
| 369 { | 374 { |
| 370 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 375 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 371 TestTypedefsV8Internal::immutablePointFunctionMethod(info); | 376 TestTypedefsV8Internal::immutablePointFunctionMethod(info); |
| 372 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 377 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 373 } | 378 } |
| 374 | 379 |
| 375 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 380 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 376 { | 381 { |
| 382 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 377 if (UNLIKELY(info.Length() < 1)) { | 383 if (UNLIKELY(info.Length() < 1)) { |
| 378 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction",
"TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.
GetIsolate()); | 384 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction",
"TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info.
GetIsolate()); |
| 379 return; | 385 return; |
| 380 } | 386 } |
| 381 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 387 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 382 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 383 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 388 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
| 384 Vector<String> result = imp->stringArrayFunction(values, exceptionState); | 389 Vector<String> result = imp->stringArrayFunction(values, exceptionState); |
| 385 if (exceptionState.throwIfNeeded()) | 390 if (exceptionState.throwIfNeeded()) |
| 386 return; | 391 return; |
| 387 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 392 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
| 388 } | 393 } |
| 389 | 394 |
| 390 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 395 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 391 { | 396 { |
| 392 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 397 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 393 TestTypedefsV8Internal::stringArrayFunctionMethod(info); | 398 TestTypedefsV8Internal::stringArrayFunctionMethod(info); |
| 394 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 399 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 395 } | 400 } |
| 396 | 401 |
| 397 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) | 402 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value>
& info) |
| 398 { | 403 { |
| 404 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray
Function2", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 399 if (UNLIKELY(info.Length() < 1)) { | 405 if (UNLIKELY(info.Length() < 1)) { |
| 400 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction2"
, "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); | 406 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction2"
, "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Length())), info
.GetIsolate()); |
| 401 return; | 407 return; |
| 402 } | 408 } |
| 403 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 409 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 404 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 405 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); | 410 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in
fo.GetIsolate())); |
| 406 Vector<String> result = imp->stringArrayFunction2(values, exceptionState); | 411 Vector<String> result = imp->stringArrayFunction2(values, exceptionState); |
| 407 if (exceptionState.throwIfNeeded()) | 412 if (exceptionState.throwIfNeeded()) |
| 408 return; | 413 return; |
| 409 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); | 414 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); |
| 410 } | 415 } |
| 411 | 416 |
| 412 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) | 417 static void stringArrayFunction2MethodCallback(const v8::FunctionCallbackInfo<v8
::Value>& info) |
| 413 { | 418 { |
| 414 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 419 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 415 TestTypedefsV8Internal::stringArrayFunction2Method(info); | 420 TestTypedefsV8Internal::stringArrayFunction2Method(info); |
| 416 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 421 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| 417 } | 422 } |
| 418 | 423 |
| 419 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) | 424 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 420 { | 425 { |
| 426 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodWithE
xception", "TestTypedefs", info.Holder(), info.GetIsolate()); |
| 421 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); | 427 TestTypedefs* imp = V8TestTypedefs::toNative(info.Holder()); |
| 422 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | |
| 423 imp->methodWithException(exceptionState); | 428 imp->methodWithException(exceptionState); |
| 424 if (exceptionState.throwIfNeeded()) | 429 if (exceptionState.throwIfNeeded()) |
| 425 return; | 430 return; |
| 426 } | 431 } |
| 427 | 432 |
| 428 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) | 433 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 429 { | 434 { |
| 430 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 435 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 431 TestTypedefsV8Internal::methodWithExceptionMethod(info); | 436 TestTypedefsV8Internal::methodWithExceptionMethod(info); |
| 432 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | 437 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 fromInternalPointer(object)->deref(); | 571 fromInternalPointer(object)->deref(); |
| 567 } | 572 } |
| 568 | 573 |
| 569 template<> | 574 template<> |
| 570 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 575 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
| 571 { | 576 { |
| 572 return toV8(impl, creationContext, isolate); | 577 return toV8(impl, creationContext, isolate); |
| 573 } | 578 } |
| 574 | 579 |
| 575 } // namespace WebCore | 580 } // namespace WebCore |
| OLD | NEW |