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

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

Issue 171533006: V8 Binding: Introduce toNativeWithTypeCheck (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 /* 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 { 537 {
538 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 538 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
539 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::Te stFeature); 539 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::Te stFeature);
540 TestObjV8Internal::testObjAttrAttributeGetter(info); 540 TestObjV8Internal::testObjAttrAttributeGetter(info);
541 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 541 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
542 } 542 }
543 543
544 static void testObjAttrAttributeSetter(v8::Local<v8::Value> jsValue, const v8::P ropertyCallbackInfo<void>& info) 544 static void testObjAttrAttributeSetter(v8::Local<v8::Value> jsValue, const v8::P ropertyCallbackInfo<void>& info)
545 { 545 {
546 TestObj* imp = V8TestObject::toNative(info.Holder()); 546 TestObj* imp = V8TestObject::toNative(info.Holder());
547 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::hasInstance(jsValue, info. GetIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 547 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::toNativeWithTypeCheck(info .GetIsolate(), jsValue));
548 imp->setTestObjAttr(WTF::getPtr(cppValue)); 548 imp->setTestObjAttr(WTF::getPtr(cppValue));
549 } 549 }
550 550
551 static void testObjAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Local< v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 551 static void testObjAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Local< v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
552 { 552 {
553 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 553 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
554 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::Te stFeature); 554 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::Te stFeature);
555 TestObjV8Internal::testObjAttrAttributeSetter(jsValue, info); 555 TestObjV8Internal::testObjAttrAttributeSetter(jsValue, info);
556 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 556 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
557 } 557 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 static void XMLObjAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::P ropertyCallbackInfo<v8::Value>& info) 593 static void XMLObjAttrAttributeGetterCallback(v8::Local<v8::String>, const v8::P ropertyCallbackInfo<v8::Value>& info)
594 { 594 {
595 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 595 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
596 TestObjV8Internal::XMLObjAttrAttributeGetter(info); 596 TestObjV8Internal::XMLObjAttrAttributeGetter(info);
597 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 597 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
598 } 598 }
599 599
600 static void XMLObjAttrAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Pr opertyCallbackInfo<void>& info) 600 static void XMLObjAttrAttributeSetter(v8::Local<v8::Value> jsValue, const v8::Pr opertyCallbackInfo<void>& info)
601 { 601 {
602 TestObj* imp = V8TestObject::toNative(info.Holder()); 602 TestObj* imp = V8TestObject::toNative(info.Holder());
603 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::hasInstance(jsValue, info. GetIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 603 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::toNativeWithTypeCheck(info .GetIsolate(), jsValue));
604 imp->setXMLObjAttr(WTF::getPtr(cppValue)); 604 imp->setXMLObjAttr(WTF::getPtr(cppValue));
605 } 605 }
606 606
607 static void XMLObjAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v 8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 607 static void XMLObjAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v 8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
608 { 608 {
609 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 609 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
610 TestObjV8Internal::XMLObjAttrAttributeSetter(jsValue, info); 610 TestObjV8Internal::XMLObjAttrAttributeSetter(jsValue, info);
611 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 611 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
612 } 612 }
613 613
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 static void withExecutionContextAttributeAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info) 1569 static void withExecutionContextAttributeAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info)
1570 { 1570 {
1571 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1571 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
1572 TestObjV8Internal::withExecutionContextAttributeAttributeGetter(info); 1572 TestObjV8Internal::withExecutionContextAttributeAttributeGetter(info);
1573 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 1573 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1574 } 1574 }
1575 1575
1576 static void withExecutionContextAttributeAttributeSetter(v8::Local<v8::Value> js Value, const v8::PropertyCallbackInfo<void>& info) 1576 static void withExecutionContextAttributeAttributeSetter(v8::Local<v8::Value> js Value, const v8::PropertyCallbackInfo<void>& info)
1577 { 1577 {
1578 TestObj* imp = V8TestObject::toNative(info.Holder()); 1578 TestObj* imp = V8TestObject::toNative(info.Holder());
1579 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::hasInstance(jsValue, info. GetIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 1579 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::toNativeWithTypeCheck(info .GetIsolate(), jsValue));
1580 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ; 1580 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ;
1581 imp->setWithExecutionContextAttribute(scriptContext, WTF::getPtr(cppValue)); 1581 imp->setWithExecutionContextAttribute(scriptContext, WTF::getPtr(cppValue));
1582 } 1582 }
1583 1583
1584 static void withExecutionContextAttributeAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info ) 1584 static void withExecutionContextAttributeAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info )
1585 { 1585 {
1586 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1586 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1587 TestObjV8Internal::withExecutionContextAttributeAttributeSetter(jsValue, inf o); 1587 TestObjV8Internal::withExecutionContextAttributeAttributeSetter(jsValue, inf o);
1588 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 1588 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1589 } 1589 }
1590 1590
1591 static void withActiveWindowAndFirstWindowAttributeAttributeGetter(const v8::Pro pertyCallbackInfo<v8::Value>& info) 1591 static void withActiveWindowAndFirstWindowAttributeAttributeGetter(const v8::Pro pertyCallbackInfo<v8::Value>& info)
1592 { 1592 {
1593 TestObj* imp = V8TestObject::toNative(info.Holder()); 1593 TestObj* imp = V8TestObject::toNative(info.Holder());
1594 v8SetReturnValueFast(info, imp->withActiveWindowAndFirstWindowAttribute(), i mp); 1594 v8SetReturnValueFast(info, imp->withActiveWindowAndFirstWindowAttribute(), i mp);
1595 } 1595 }
1596 1596
1597 static void withActiveWindowAndFirstWindowAttributeAttributeGetterCallback(v8::L ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 1597 static void withActiveWindowAndFirstWindowAttributeAttributeGetterCallback(v8::L ocal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
1598 { 1598 {
1599 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1599 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
1600 TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttributeGetter(in fo); 1600 TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttributeGetter(in fo);
1601 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 1601 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1602 } 1602 }
1603 1603
1604 static void withActiveWindowAndFirstWindowAttributeAttributeSetter(v8::Local<v8: :Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 1604 static void withActiveWindowAndFirstWindowAttributeAttributeSetter(v8::Local<v8: :Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
1605 { 1605 {
1606 TestObj* imp = V8TestObject::toNative(info.Holder()); 1606 TestObj* imp = V8TestObject::toNative(info.Holder());
1607 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::hasInstance(jsValue, info. GetIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 1607 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::toNativeWithTypeCheck(info .GetIsolate(), jsValue));
1608 imp->setWithActiveWindowAndFirstWindowAttribute(callingDOMWindow(info.GetIso late()), enteredDOMWindow(info.GetIsolate()), WTF::getPtr(cppValue)); 1608 imp->setWithActiveWindowAndFirstWindowAttribute(callingDOMWindow(info.GetIso late()), enteredDOMWindow(info.GetIsolate()), WTF::getPtr(cppValue));
1609 } 1609 }
1610 1610
1611 static void withActiveWindowAndFirstWindowAttributeAttributeSetterCallback(v8::L ocal<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v oid>& info) 1611 static void withActiveWindowAndFirstWindowAttributeAttributeSetterCallback(v8::L ocal<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v oid>& info)
1612 { 1612 {
1613 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1613 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1614 TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttributeSetter(js Value, info); 1614 TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttributeSetter(js Value, info);
1615 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 1615 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1616 } 1616 }
1617 1617
(...skipping 10 matching lines...) Expand all
1628 static void withScriptStateAttributeRaisesAttributeGetterCallback(v8::Local<v8:: String>, const v8::PropertyCallbackInfo<v8::Value>& info) 1628 static void withScriptStateAttributeRaisesAttributeGetterCallback(v8::Local<v8:: String>, const v8::PropertyCallbackInfo<v8::Value>& info)
1629 { 1629 {
1630 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1630 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
1631 TestObjV8Internal::withScriptStateAttributeRaisesAttributeGetter(info); 1631 TestObjV8Internal::withScriptStateAttributeRaisesAttributeGetter(info);
1632 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 1632 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1633 } 1633 }
1634 1634
1635 static void withScriptStateAttributeRaisesAttributeSetter(v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<void>& info) 1635 static void withScriptStateAttributeRaisesAttributeSetter(v8::Local<v8::Value> j sValue, const v8::PropertyCallbackInfo<void>& info)
1636 { 1636 {
1637 TestObj* imp = V8TestObject::toNative(info.Holder()); 1637 TestObj* imp = V8TestObject::toNative(info.Holder());
1638 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::hasInstance(jsValue, info. GetIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 1638 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::toNativeWithTypeCheck(info .GetIsolate(), jsValue));
1639 imp->setWithScriptStateAttributeRaises(WTF::getPtr(cppValue)); 1639 imp->setWithScriptStateAttributeRaises(WTF::getPtr(cppValue));
1640 } 1640 }
1641 1641
1642 static void withScriptStateAttributeRaisesAttributeSetterCallback(v8::Local<v8:: String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf o) 1642 static void withScriptStateAttributeRaisesAttributeSetterCallback(v8::Local<v8:: String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf o)
1643 { 1643 {
1644 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1644 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1645 TestObjV8Internal::withScriptStateAttributeRaisesAttributeSetter(jsValue, in fo); 1645 TestObjV8Internal::withScriptStateAttributeRaisesAttributeSetter(jsValue, in fo);
1646 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 1646 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
1647 } 1647 }
1648 1648
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 static void perWorldAttributeAttributeGetterCallback(v8::Local<v8::String>, cons t v8::PropertyCallbackInfo<v8::Value>& info) 2490 static void perWorldAttributeAttributeGetterCallback(v8::Local<v8::String>, cons t v8::PropertyCallbackInfo<v8::Value>& info)
2491 { 2491 {
2492 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2492 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2493 TestObjV8Internal::perWorldAttributeAttributeGetter(info); 2493 TestObjV8Internal::perWorldAttributeAttributeGetter(info);
2494 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2494 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2495 } 2495 }
2496 2496
2497 static void perWorldAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 2497 static void perWorldAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
2498 { 2498 {
2499 TestObj* imp = V8TestObject::toNative(info.Holder()); 2499 TestObj* imp = V8TestObject::toNative(info.Holder());
2500 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::hasInstance(jsValue, info. GetIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 2500 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::toNativeWithTypeCheck(info .GetIsolate(), jsValue));
2501 imp->setPerWorldAttribute(WTF::getPtr(cppValue)); 2501 imp->setPerWorldAttribute(WTF::getPtr(cppValue));
2502 } 2502 }
2503 2503
2504 static void perWorldAttributeAttributeSetterCallback(v8::Local<v8::String>, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 2504 static void perWorldAttributeAttributeSetterCallback(v8::Local<v8::String>, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
2505 { 2505 {
2506 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2506 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
2507 TestObjV8Internal::perWorldAttributeAttributeSetter(jsValue, info); 2507 TestObjV8Internal::perWorldAttributeAttributeSetter(jsValue, info);
2508 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2508 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2509 } 2509 }
2510 2510
2511 static void perWorldAttributeAttributeGetterForMainWorld(const v8::PropertyCallb ackInfo<v8::Value>& info) 2511 static void perWorldAttributeAttributeGetterForMainWorld(const v8::PropertyCallb ackInfo<v8::Value>& info)
2512 { 2512 {
2513 TestObj* imp = V8TestObject::toNative(info.Holder()); 2513 TestObj* imp = V8TestObject::toNative(info.Holder());
2514 v8SetReturnValueForMainWorld(info, imp->perWorldAttribute()); 2514 v8SetReturnValueForMainWorld(info, imp->perWorldAttribute());
2515 } 2515 }
2516 2516
2517 static void perWorldAttributeAttributeGetterCallbackForMainWorld(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info) 2517 static void perWorldAttributeAttributeGetterCallbackForMainWorld(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info)
2518 { 2518 {
2519 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 2519 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
2520 TestObjV8Internal::perWorldAttributeAttributeGetterForMainWorld(info); 2520 TestObjV8Internal::perWorldAttributeAttributeGetterForMainWorld(info);
2521 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2521 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2522 } 2522 }
2523 2523
2524 static void perWorldAttributeAttributeSetterForMainWorld(v8::Local<v8::Value> js Value, const v8::PropertyCallbackInfo<void>& info) 2524 static void perWorldAttributeAttributeSetterForMainWorld(v8::Local<v8::Value> js Value, const v8::PropertyCallbackInfo<void>& info)
2525 { 2525 {
2526 TestObj* imp = V8TestObject::toNative(info.Holder()); 2526 TestObj* imp = V8TestObject::toNative(info.Holder());
2527 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::hasInstance(jsValue, info. GetIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(jsValue)) : 0); 2527 V8TRYCATCH_VOID(TestObj*, cppValue, V8TestObject::toNativeWithTypeCheck(info .GetIsolate(), jsValue));
2528 imp->setPerWorldAttribute(WTF::getPtr(cppValue)); 2528 imp->setPerWorldAttribute(WTF::getPtr(cppValue));
2529 } 2529 }
2530 2530
2531 static void perWorldAttributeAttributeSetterCallbackForMainWorld(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info ) 2531 static void perWorldAttributeAttributeSetterCallbackForMainWorld(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info )
2532 { 2532 {
2533 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2533 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
2534 TestObjV8Internal::perWorldAttributeAttributeSetterForMainWorld(jsValue, inf o); 2534 TestObjV8Internal::perWorldAttributeAttributeSetterForMainWorld(jsValue, inf o);
2535 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 2535 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
2536 } 2536 }
2537 2537
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
3201 { 3201 {
3202 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodW ithArgs", "TestObject", info.Holder(), info.GetIsolate()); 3202 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodW ithArgs", "TestObject", info.Holder(), info.GetIsolate());
3203 if (UNLIKELY(info.Length() < 3)) { 3203 if (UNLIKELY(info.Length() < 3)) {
3204 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length())); 3204 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
3205 exceptionState.throwIfNeeded(); 3205 exceptionState.throwIfNeeded();
3206 return; 3206 return;
3207 } 3207 }
3208 TestObj* imp = V8TestObject::toNative(info.Holder()); 3208 TestObj* imp = V8TestObject::toNative(info.Holder());
3209 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), ex ceptionState); 3209 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), ex ceptionState);
3210 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]); 3210 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]);
3211 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[2], info.Ge tIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[2])) : 0) ; 3211 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::toNativeWithTypeCheck(info.G etIsolate(), info[2]));
3212 imp->voidMethodWithArgs(longArg, strArg, objArg); 3212 imp->voidMethodWithArgs(longArg, strArg, objArg);
3213 } 3213 }
3214 3214
3215 static void voidMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info) 3215 static void voidMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
3216 { 3216 {
3217 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3217 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3218 TestObjV8Internal::voidMethodWithArgsMethod(info); 3218 TestObjV8Internal::voidMethodWithArgsMethod(info);
3219 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 3219 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
3220 } 3220 }
3221 3221
(...skipping 14 matching lines...) Expand all
3236 { 3236 {
3237 ExceptionState exceptionState(ExceptionState::ExecutionContext, "longMethodW ithArgs", "TestObject", info.Holder(), info.GetIsolate()); 3237 ExceptionState exceptionState(ExceptionState::ExecutionContext, "longMethodW ithArgs", "TestObject", info.Holder(), info.GetIsolate());
3238 if (UNLIKELY(info.Length() < 3)) { 3238 if (UNLIKELY(info.Length() < 3)) {
3239 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length())); 3239 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
3240 exceptionState.throwIfNeeded(); 3240 exceptionState.throwIfNeeded();
3241 return; 3241 return;
3242 } 3242 }
3243 TestObj* imp = V8TestObject::toNative(info.Holder()); 3243 TestObj* imp = V8TestObject::toNative(info.Holder());
3244 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), ex ceptionState); 3244 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), ex ceptionState);
3245 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]); 3245 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]);
3246 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[2], info.Ge tIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[2])) : 0) ; 3246 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::toNativeWithTypeCheck(info.G etIsolate(), info[2]));
3247 v8SetReturnValueInt(info, imp->longMethodWithArgs(longArg, strArg, objArg)); 3247 v8SetReturnValueInt(info, imp->longMethodWithArgs(longArg, strArg, objArg));
3248 } 3248 }
3249 3249
3250 static void longMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info) 3250 static void longMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
3251 { 3251 {
3252 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3252 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3253 TestObjV8Internal::longMethodWithArgsMethod(info); 3253 TestObjV8Internal::longMethodWithArgsMethod(info);
3254 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 3254 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
3255 } 3255 }
3256 3256
(...skipping 15 matching lines...) Expand all
3272 { 3272 {
3273 ExceptionState exceptionState(ExceptionState::ExecutionContext, "objMethodWi thArgs", "TestObject", info.Holder(), info.GetIsolate()); 3273 ExceptionState exceptionState(ExceptionState::ExecutionContext, "objMethodWi thArgs", "TestObject", info.Holder(), info.GetIsolate());
3274 if (UNLIKELY(info.Length() < 3)) { 3274 if (UNLIKELY(info.Length() < 3)) {
3275 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length())); 3275 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
3276 exceptionState.throwIfNeeded(); 3276 exceptionState.throwIfNeeded();
3277 return; 3277 return;
3278 } 3278 }
3279 TestObj* imp = V8TestObject::toNative(info.Holder()); 3279 TestObj* imp = V8TestObject::toNative(info.Holder());
3280 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), ex ceptionState); 3280 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), ex ceptionState);
3281 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]); 3281 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]);
3282 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[2], info.Ge tIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[2])) : 0) ; 3282 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::toNativeWithTypeCheck(info.G etIsolate(), info[2]));
3283 v8SetReturnValue(info, imp->objMethodWithArgs(longArg, strArg, objArg)); 3283 v8SetReturnValue(info, imp->objMethodWithArgs(longArg, strArg, objArg));
3284 } 3284 }
3285 3285
3286 static void objMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) 3286 static void objMethodWithArgsMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info)
3287 { 3287 {
3288 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3288 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3289 TestObjV8Internal::objMethodWithArgsMethod(info); 3289 TestObjV8Internal::objMethodWithArgsMethod(info);
3290 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 3290 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
3291 } 3291 }
3292 3292
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3354 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackI nfo<v8::Value>& info) 3354 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackI nfo<v8::Value>& info)
3355 { 3355 {
3356 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodThatR equiresAllArgsAndThrows", "TestObject", info.Holder(), info.GetIsolate()); 3356 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodThatR equiresAllArgsAndThrows", "TestObject", info.Holder(), info.GetIsolate());
3357 if (UNLIKELY(info.Length() < 2)) { 3357 if (UNLIKELY(info.Length() < 2)) {
3358 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 3358 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
3359 exceptionState.throwIfNeeded(); 3359 exceptionState.throwIfNeeded();
3360 return; 3360 return;
3361 } 3361 }
3362 TestObj* imp = V8TestObject::toNative(info.Holder()); 3362 TestObj* imp = V8TestObject::toNative(info.Holder());
3363 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 3363 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
3364 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0) ; 3364 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::toNativeWithTypeCheck(info.G etIsolate(), info[1]));
3365 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, obj Arg, exceptionState); 3365 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, obj Arg, exceptionState);
3366 if (exceptionState.throwIfNeeded()) 3366 if (exceptionState.throwIfNeeded())
3367 return; 3367 return;
3368 v8SetReturnValue(info, result.release()); 3368 v8SetReturnValue(info, result.release());
3369 } 3369 }
3370 3370
3371 static void methodThatRequiresAllArgsAndThrowsMethodCallback(const v8::FunctionC allbackInfo<v8::Value>& info) 3371 static void methodThatRequiresAllArgsAndThrowsMethodCallback(const v8::FunctionC allbackInfo<v8::Value>& info)
3372 { 3372 {
3373 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3373 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3374 TestObjV8Internal::methodThatRequiresAllArgsAndThrowsMethod(info); 3374 TestObjV8Internal::methodThatRequiresAllArgsAndThrowsMethod(info);
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
4273 imp->overloadedMethod(callbackInterfaceArg.release()); 4273 imp->overloadedMethod(callbackInterfaceArg.release());
4274 } 4274 }
4275 4275
4276 static void overloadedMethod3Method(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 4276 static void overloadedMethod3Method(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
4277 { 4277 {
4278 if (UNLIKELY(info.Length() < 1)) { 4278 if (UNLIKELY(info.Length() < 1)) {
4279 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate()); 4279 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate());
4280 return; 4280 return;
4281 } 4281 }
4282 TestObj* imp = V8TestObject::toNative(info.Holder()); 4282 TestObj* imp = V8TestObject::toNative(info.Holder());
4283 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[0], info.Ge tIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0) ; 4283 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::toNativeWithTypeCheck(info.G etIsolate(), info[0]));
4284 imp->overloadedMethod(objArg); 4284 imp->overloadedMethod(objArg);
4285 } 4285 }
4286 4286
4287 static void overloadedMethod4Method(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 4287 static void overloadedMethod4Method(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
4288 { 4288 {
4289 if (UNLIKELY(info.Length() < 1)) { 4289 if (UNLIKELY(info.Length() < 1)) {
4290 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate()); 4290 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate());
4291 return; 4291 return;
4292 } 4292 }
4293 TestObj* imp = V8TestObject::toNative(info.Holder()); 4293 TestObj* imp = V8TestObject::toNative(info.Holder());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
4347 4347
4348 static void overloadedMethodA1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 4348 static void overloadedMethodA1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
4349 { 4349 {
4350 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM ethodA", "TestObject", info.Holder(), info.GetIsolate()); 4350 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM ethodA", "TestObject", info.Holder(), info.GetIsolate());
4351 if (UNLIKELY(info.Length() < 1)) { 4351 if (UNLIKELY(info.Length() < 1)) {
4352 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 4352 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4353 exceptionState.throwIfNeeded(); 4353 exceptionState.throwIfNeeded();
4354 return; 4354 return;
4355 } 4355 }
4356 TestObj* imp = V8TestObject::toNative(info.Holder()); 4356 TestObj* imp = V8TestObject::toNative(info.Holder());
4357 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[0], info.Ge tIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0) ; 4357 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::toNativeWithTypeCheck(info.G etIsolate(), info[0]));
4358 if (UNLIKELY(info.Length() <= 1)) { 4358 if (UNLIKELY(info.Length() <= 1)) {
4359 imp->overloadedMethodA(objArg); 4359 imp->overloadedMethodA(objArg);
4360 return; 4360 return;
4361 } 4361 }
4362 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[1], exceptionState), ex ceptionState); 4362 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[1], exceptionState), ex ceptionState);
4363 imp->overloadedMethodA(objArg, longArg); 4363 imp->overloadedMethodA(objArg, longArg);
4364 } 4364 }
4365 4365
4366 static void overloadedMethodA2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 4366 static void overloadedMethodA2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
4367 { 4367 {
4368 if (UNLIKELY(info.Length() < 2)) { 4368 if (UNLIKELY(info.Length() < 2)) {
4369 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodA", " TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), info.GetI solate()); 4369 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodA", " TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), info.GetI solate());
4370 return; 4370 return;
4371 } 4371 }
4372 TestObj* imp = V8TestObject::toNative(info.Holder()); 4372 TestObj* imp = V8TestObject::toNative(info.Holder());
4373 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[0], info.Ge tIsolate()) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0) ; 4373 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::toNativeWithTypeCheck(info.G etIsolate(), info[0]));
4374 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]); 4374 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]);
4375 imp->overloadedMethodA(objArg, strArg); 4375 imp->overloadedMethodA(objArg, strArg);
4376 } 4376 }
4377 4377
4378 static void overloadedMethodAMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 4378 static void overloadedMethodAMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
4379 { 4379 {
4380 if (((info.Length() == 1) && (info[0]->IsNull() || V8TestObject::hasInstance (info[0], info.GetIsolate()))) || ((info.Length() == 2) && (info[0]->IsNull() || V8TestObject::hasInstance(info[0], info.GetIsolate())))) { 4380 if (((info.Length() == 1) && (info[0]->IsNull() || V8TestObject::hasInstance (info[0], info.GetIsolate()))) || ((info.Length() == 2) && (info[0]->IsNull() || V8TestObject::hasInstance(info[0], info.GetIsolate())))) {
4381 overloadedMethodA1Method(info); 4381 overloadedMethodA1Method(info);
4382 return; 4382 return;
4383 } 4383 }
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
4651 4651
4652 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value >& info) 4652 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value >& info)
4653 { 4653 {
4654 ExceptionState exceptionState(ExceptionState::ExecutionContext, "domStringLi stFunction", "TestObject", info.Holder(), info.GetIsolate()); 4654 ExceptionState exceptionState(ExceptionState::ExecutionContext, "domStringLi stFunction", "TestObject", info.Holder(), info.GetIsolate());
4655 if (UNLIKELY(info.Length() < 1)) { 4655 if (UNLIKELY(info.Length() < 1)) {
4656 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 4656 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4657 exceptionState.throwIfNeeded(); 4657 exceptionState.throwIfNeeded();
4658 return; 4658 return;
4659 } 4659 }
4660 TestObj* imp = V8TestObject::toNative(info.Holder()); 4660 TestObj* imp = V8TestObject::toNative(info.Holder());
4661 V8TRYCATCH_VOID(DOMStringList*, values, V8DOMStringList::hasInstance(info[0] , info.GetIsolate()) ? V8DOMStringList::toNative(v8::Handle<v8::Object>::Cast(in fo[0])) : 0); 4661 V8TRYCATCH_VOID(DOMStringList*, values, V8DOMStringList::toNativeWithTypeChe ck(info.GetIsolate(), info[0]));
4662 RefPtr<DOMStringList> result = imp->domStringListFunction(values, exceptionS tate); 4662 RefPtr<DOMStringList> result = imp->domStringListFunction(values, exceptionS tate);
4663 if (exceptionState.throwIfNeeded()) 4663 if (exceptionState.throwIfNeeded())
4664 return; 4664 return;
4665 v8SetReturnValue(info, result.release()); 4665 v8SetReturnValue(info, result.release());
4666 } 4666 }
4667 4667
4668 static void domStringListFunctionMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& info) 4668 static void domStringListFunctionMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& info)
4669 { 4669 {
4670 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4670 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4671 TestObjV8Internal::domStringListFunctionMethod(info); 4671 TestObjV8Internal::domStringListFunctionMethod(info);
4672 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 4672 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
4673 } 4673 }
4674 4674
4675 static void convert1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 4675 static void convert1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
4676 { 4676 {
4677 if (UNLIKELY(info.Length() < 1)) { 4677 if (UNLIKELY(info.Length() < 1)) {
4678 throwTypeError(ExceptionMessages::failedToExecute("convert1", "TestObjec t", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()) ; 4678 throwTypeError(ExceptionMessages::failedToExecute("convert1", "TestObjec t", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()) ;
4679 return; 4679 return;
4680 } 4680 }
4681 TestObj* imp = V8TestObject::toNative(info.Holder()); 4681 TestObj* imp = V8TestObject::toNative(info.Holder());
4682 V8TRYCATCH_VOID(TestNode*, value, V8TestNode::hasInstance(info[0], info.GetI solate()) ? V8TestNode::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); 4682 V8TRYCATCH_VOID(TestNode*, value, V8TestNode::toNativeWithTypeCheck(info.Get Isolate(), info[0]));
4683 imp->convert1(value); 4683 imp->convert1(value);
4684 } 4684 }
4685 4685
4686 static void convert1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo) 4686 static void convert1MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo)
4687 { 4687 {
4688 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4688 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4689 TestObjV8Internal::convert1Method(info); 4689 TestObjV8Internal::convert1Method(info);
4690 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 4690 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
4691 } 4691 }
4692 4692
4693 static void convert2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 4693 static void convert2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
4694 { 4694 {
4695 if (UNLIKELY(info.Length() < 1)) { 4695 if (UNLIKELY(info.Length() < 1)) {
4696 throwTypeError(ExceptionMessages::failedToExecute("convert2", "TestObjec t", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()) ; 4696 throwTypeError(ExceptionMessages::failedToExecute("convert2", "TestObjec t", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()) ;
4697 return; 4697 return;
4698 } 4698 }
4699 TestObj* imp = V8TestObject::toNative(info.Holder()); 4699 TestObj* imp = V8TestObject::toNative(info.Holder());
4700 V8TRYCATCH_VOID(TestNode*, value, V8TestNode::hasInstance(info[0], info.GetI solate()) ? V8TestNode::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); 4700 V8TRYCATCH_VOID(TestNode*, value, V8TestNode::toNativeWithTypeCheck(info.Get Isolate(), info[0]));
4701 imp->convert2(value); 4701 imp->convert2(value);
4702 } 4702 }
4703 4703
4704 static void convert2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo) 4704 static void convert2MethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo)
4705 { 4705 {
4706 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4706 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4707 TestObjV8Internal::convert2Method(info); 4707 TestObjV8Internal::convert2Method(info);
4708 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 4708 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
4709 } 4709 }
4710 4710
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4784 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 4784 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
4785 } 4785 }
4786 4786
4787 static void variadicNodeMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 4787 static void variadicNodeMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
4788 { 4788 {
4789 if (UNLIKELY(info.Length() < 1)) { 4789 if (UNLIKELY(info.Length() < 1)) {
4790 throwTypeError(ExceptionMessages::failedToExecute("variadicNodeMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Get Isolate()); 4790 throwTypeError(ExceptionMessages::failedToExecute("variadicNodeMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Get Isolate());
4791 return; 4791 return;
4792 } 4792 }
4793 TestObj* imp = V8TestObject::toNative(info.Holder()); 4793 TestObj* imp = V8TestObject::toNative(info.Holder());
4794 V8TRYCATCH_VOID(Node*, head, V8Node::hasInstance(info[0], info.GetIsolate()) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); 4794 V8TRYCATCH_VOID(Node*, head, V8Node::toNativeWithTypeCheck(info.GetIsolate() , info[0]));
4795 Vector<RefPtr<Node> > tail; 4795 Vector<RefPtr<Node> > tail;
4796 for (int i = 1; i < info.Length(); ++i) { 4796 for (int i = 1; i < info.Length(); ++i) {
4797 if (!V8Node::hasInstance(info[i], info.GetIsolate())) { 4797 if (!V8Node::hasInstance(info[i], info.GetIsolate())) {
4798 throwTypeError(ExceptionMessages::failedToExecute("variadicNodeMetho d", "TestObject", "parameter 2 is not of type 'Node'."), info.GetIsolate()); 4798 throwTypeError(ExceptionMessages::failedToExecute("variadicNodeMetho d", "TestObject", "parameter 2 is not of type 'Node'."), info.GetIsolate());
4799 return; 4799 return;
4800 } 4800 }
4801 tail.append(V8Node::toNative(v8::Handle<v8::Object>::Cast(info[i]))); 4801 tail.append(V8Node::toNative(v8::Handle<v8::Object>::Cast(info[i])));
4802 } 4802 }
4803 imp->variadicNodeMethod(head, tail); 4803 imp->variadicNodeMethod(head, tail);
4804 } 4804 }
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
5546 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 5546 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
5547 return handleScope.Escape(templ); 5547 return handleScope.Escape(templ);
5548 } 5548 }
5549 5549
5550 bool V8TestObject::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola te) 5550 bool V8TestObject::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola te)
5551 { 5551 {
5552 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 5552 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
5553 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 5553 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
5554 } 5554 }
5555 5555
5556 TestObj* V8TestObject::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8 ::Value> value)
5557 {
5558 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
5559 }
5560
5556 void V8TestObject::installPerContextEnabledProperties(v8::Handle<v8::Object> ins tanceTemplate, TestObj* impl, v8::Isolate* isolate) 5561 void V8TestObject::installPerContextEnabledProperties(v8::Handle<v8::Object> ins tanceTemplate, TestObj* impl, v8::Isolate* isolate)
5557 { 5562 {
5558 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan ceTemplate->GetPrototype()); 5563 v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instan ceTemplate->GetPrototype());
5559 if (ContextFeatures::featureNameEnabled(impl->document())) { 5564 if (ContextFeatures::featureNameEnabled(impl->document())) {
5560 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 5565 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
5561 {"enabledPerContextAttr", TestObjV8Internal::enabledPerContextAttrAttrib uteGetterCallback, TestObjV8Internal::enabledPerContextAttrAttributeSetterCallba ck, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Proper tyAttribute>(v8::None), 0 /* on instance */}; 5566 {"enabledPerContextAttr", TestObjV8Internal::enabledPerContextAttrAttrib uteGetterCallback, TestObjV8Internal::enabledPerContextAttrAttributeSetterCallba ck, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::Proper tyAttribute>(v8::None), 0 /* on instance */};
5562 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate); 5567 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
5563 } 5568 }
5564 } 5569 }
5565 5570
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
5602 fromInternalPointer(object)->deref(); 5607 fromInternalPointer(object)->deref();
5603 } 5608 }
5604 5609
5605 template<> 5610 template<>
5606 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate) 5611 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
5607 { 5612 {
5608 return toV8(impl, creationContext, isolate); 5613 return toV8(impl, creationContext, isolate);
5609 } 5614 }
5610 5615
5611 } // namespace WebCore 5616 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.h ('k') | Source/bindings/tests/results/V8TestObjectPython.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698