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 4708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4719 exceptionState.throwIfNeeded(); | 4719 exceptionState.throwIfNeeded(); |
4720 } | 4720 } |
4721 | 4721 |
4722 static void overloadedMethodBMethodCallback(const v8::FunctionCallbackInfo<v8::V
alue>& info) | 4722 static void overloadedMethodBMethodCallback(const v8::FunctionCallbackInfo<v8::V
alue>& info) |
4723 { | 4723 { |
4724 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 4724 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
4725 TestObjV8Internal::overloadedMethodBMethod(info); | 4725 TestObjV8Internal::overloadedMethodBMethod(info); |
4726 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 4726 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
4727 } | 4727 } |
4728 | 4728 |
| 4729 static void overloadedMethodC1Method(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 4730 { |
| 4731 if (UNLIKELY(info.Length() < 1)) { |
| 4732 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodC", "
TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI
solate()); |
| 4733 return; |
| 4734 } |
| 4735 TestObj* imp = V8TestObject::toNative(info.Holder()); |
| 4736 V8TRYCATCH_VOID(Dictionary, dictionaryArg, Dictionary(info[0], info.GetIsola
te())); |
| 4737 if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) { |
| 4738 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodC", "
TestObject", "parameter 1 ('dictionaryArg') is not an object."), info.GetIsolate
()); |
| 4739 return; |
| 4740 } |
| 4741 imp->overloadedMethodC(dictionaryArg); |
| 4742 } |
| 4743 |
| 4744 static void overloadedMethodC2Method(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 4745 { |
| 4746 if (UNLIKELY(info.Length() < 1)) { |
| 4747 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodC", "
TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI
solate()); |
| 4748 return; |
| 4749 } |
| 4750 TestObj* imp = V8TestObject::toNative(info.Holder()); |
| 4751 V8TRYCATCH_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue(
))); |
| 4752 imp->overloadedMethodC(doubleArg); |
| 4753 } |
| 4754 |
| 4755 static void overloadedMethodCMethod(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 4756 { |
| 4757 if (((info.Length() == 1) && (info[0]->IsObject()))) { |
| 4758 overloadedMethodC1Method(info); |
| 4759 return; |
| 4760 } |
| 4761 if (((info.Length() == 1))) { |
| 4762 overloadedMethodC2Method(info); |
| 4763 return; |
| 4764 } |
| 4765 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM
ethodC", "TestObject", info.Holder(), info.GetIsolate()); |
| 4766 if (UNLIKELY(info.Length() < 1)) { |
| 4767 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); |
| 4768 exceptionState.throwIfNeeded(); |
| 4769 return; |
| 4770 } |
| 4771 exceptionState.throwTypeError("No function was found that matched the signat
ure provided."); |
| 4772 exceptionState.throwIfNeeded(); |
| 4773 } |
| 4774 |
| 4775 static void overloadedMethodCMethodCallback(const v8::FunctionCallbackInfo<v8::V
alue>& info) |
| 4776 { |
| 4777 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
| 4778 TestObjV8Internal::overloadedMethodCMethod(info); |
| 4779 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 4780 } |
| 4781 |
4729 static void classMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 4782 static void classMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
4730 { | 4783 { |
4731 TestObj::classMethod(); | 4784 TestObj::classMethod(); |
4732 } | 4785 } |
4733 | 4786 |
4734 static void classMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 4787 static void classMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
4735 { | 4788 { |
4736 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 4789 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
4737 TestObjV8Internal::classMethodMethod(info); | 4790 TestObjV8Internal::classMethodMethod(info); |
4738 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 4791 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5727 {"conditionalMethod2", TestObjV8Internal::conditionalMethod2MethodCallback,
0, 0}, | 5780 {"conditionalMethod2", TestObjV8Internal::conditionalMethod2MethodCallback,
0, 0}, |
5728 #endif // ENABLE(Condition1) && ENABLE(Condition2) | 5781 #endif // ENABLE(Condition1) && ENABLE(Condition2) |
5729 #if ENABLE(Condition1) || ENABLE(Condition2) | 5782 #if ENABLE(Condition1) || ENABLE(Condition2) |
5730 {"conditionalMethod3", TestObjV8Internal::conditionalMethod3MethodCallback,
0, 0}, | 5783 {"conditionalMethod3", TestObjV8Internal::conditionalMethod3MethodCallback,
0, 0}, |
5731 #endif // ENABLE(Condition1) || ENABLE(Condition2) | 5784 #endif // ENABLE(Condition1) || ENABLE(Condition2) |
5732 {"callbackFunctionReturnValue", TestObjV8Internal::callbackFunctionReturnVal
ueMethodCallback, 0, 0}, | 5785 {"callbackFunctionReturnValue", TestObjV8Internal::callbackFunctionReturnVal
ueMethodCallback, 0, 0}, |
5733 {"callbackFunctionArgument", TestObjV8Internal::callbackFunctionArgumentMeth
odCallback, 0, 1}, | 5786 {"callbackFunctionArgument", TestObjV8Internal::callbackFunctionArgumentMeth
odCallback, 0, 1}, |
5734 {"overloadedMethod", TestObjV8Internal::overloadedMethodMethodCallback, 0, 1
}, | 5787 {"overloadedMethod", TestObjV8Internal::overloadedMethodMethodCallback, 0, 1
}, |
5735 {"overloadedMethodA", TestObjV8Internal::overloadedMethodAMethodCallback, 0,
1}, | 5788 {"overloadedMethodA", TestObjV8Internal::overloadedMethodAMethodCallback, 0,
1}, |
5736 {"overloadedMethodB", TestObjV8Internal::overloadedMethodBMethodCallback, 0,
1}, | 5789 {"overloadedMethodB", TestObjV8Internal::overloadedMethodBMethodCallback, 0,
1}, |
| 5790 {"overloadedMethodC", TestObjV8Internal::overloadedMethodCMethodCallback, 0,
1}, |
5737 {"classMethodWithClamp", TestObjV8Internal::classMethodWithClampMethodCallba
ck, 0, 2}, | 5791 {"classMethodWithClamp", TestObjV8Internal::classMethodWithClampMethodCallba
ck, 0, 2}, |
5738 {"methodWithUnsignedLongSequence", TestObjV8Internal::methodWithUnsignedLong
SequenceMethodCallback, 0, 1}, | 5792 {"methodWithUnsignedLongSequence", TestObjV8Internal::methodWithUnsignedLong
SequenceMethodCallback, 0, 1}, |
5739 {"stringArrayFunction", TestObjV8Internal::stringArrayFunctionMethodCallback
, 0, 1}, | 5793 {"stringArrayFunction", TestObjV8Internal::stringArrayFunctionMethodCallback
, 0, 1}, |
5740 {"domStringListFunction", TestObjV8Internal::domStringListFunctionMethodCall
back, 0, 1}, | 5794 {"domStringListFunction", TestObjV8Internal::domStringListFunctionMethodCall
back, 0, 1}, |
5741 {"convert1", TestObjV8Internal::convert1MethodCallback, 0, 1}, | 5795 {"convert1", TestObjV8Internal::convert1MethodCallback, 0, 1}, |
5742 {"convert2", TestObjV8Internal::convert2MethodCallback, 0, 1}, | 5796 {"convert2", TestObjV8Internal::convert2MethodCallback, 0, 1}, |
5743 {"orange", TestObjV8Internal::orangeMethodCallback, 0, 0}, | 5797 {"orange", TestObjV8Internal::orangeMethodCallback, 0, 0}, |
5744 {"strictFunction", TestObjV8Internal::strictFunctionMethodCallback, 0, 3}, | 5798 {"strictFunction", TestObjV8Internal::strictFunctionMethodCallback, 0, 3}, |
5745 {"variadicStringMethod", TestObjV8Internal::variadicStringMethodMethodCallba
ck, 0, 2}, | 5799 {"variadicStringMethod", TestObjV8Internal::variadicStringMethodMethodCallba
ck, 0, 2}, |
5746 {"variadicDoubleMethod", TestObjV8Internal::variadicDoubleMethodMethodCallba
ck, 0, 2}, | 5800 {"variadicDoubleMethod", TestObjV8Internal::variadicDoubleMethodMethodCallba
ck, 0, 2}, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5872 fromInternalPointer(object)->deref(); | 5926 fromInternalPointer(object)->deref(); |
5873 } | 5927 } |
5874 | 5928 |
5875 template<> | 5929 template<> |
5876 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) | 5930 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio
nContext, v8::Isolate* isolate) |
5877 { | 5931 { |
5878 return toV8(impl, creationContext, isolate); | 5932 return toV8(impl, creationContext, isolate); |
5879 } | 5933 } |
5880 | 5934 |
5881 } // namespace WebCore | 5935 } // namespace WebCore |
OLD | NEW |