| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 namespace TestInterfaceConstructorV8Internal { | 75 namespace TestInterfaceConstructorV8Internal { |
| 76 | 76 |
| 77 template <typename T> void V8_USE(T) { } | 77 template <typename T> void V8_USE(T) { } |
| 78 | 78 |
| 79 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) | 79 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 80 { | 80 { |
| 81 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); | 81 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); |
| 82 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); | 82 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); |
| 83 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; | 83 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; |
| 84 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(con
text, document, exceptionState); | 84 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(con
text, document, exceptionState); |
| 85 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 86 if (exceptionState.throwIfNeeded()) | 85 if (exceptionState.throwIfNeeded()) |
| 87 return; | 86 return; |
| 88 | 87 |
| 89 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re
lease(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(
), WrapperConfiguration::Dependent); | 88 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 89 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re
lease(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(
), WrapperConfiguration::Independent); |
| 90 v8SetReturnValue(info, wrapper); | 90 v8SetReturnValue(info, wrapper); |
| 91 } | 91 } |
| 92 | 92 |
| 93 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) | 93 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 94 { | 94 { |
| 95 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); | 95 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte
rfaceConstructor", info.Holder(), info.GetIsolate()); |
| 96 V8TRYCATCH_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue(
))); | 96 V8TRYCATCH_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue(
))); |
| 97 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[1])
; | 97 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[1])
; |
| 98 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE
mpty::toNativeWithTypeCheck(info.GetIsolate(), info[2])); | 98 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE
mpty::toNativeWithTypeCheck(info.GetIsolate(), info[2])); |
| 99 V8TRYCATCH_VOID(Dictionary, dictionaryArg, Dictionary(info[3], info.GetIsola
te())); | 99 V8TRYCATCH_VOID(Dictionary, dictionaryArg, Dictionary(info[3], info.GetIsola
te())); |
| 100 if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) { | 100 if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) { |
| 101 exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an o
bject."); | 101 exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an o
bject."); |
| 102 exceptionState.throwIfNeeded(); | 102 exceptionState.throwIfNeeded(); |
| 103 return; | 103 return; |
| 104 } | 104 } |
| 105 V8TRYCATCH_VOID(Vector<String>, sequenceStringArg, toNativeArray<String>(inf
o[4], 5, info.GetIsolate())); | 105 V8TRYCATCH_VOID(Vector<String>, sequenceStringArg, toNativeArray<String>(inf
o[4], 5, info.GetIsolate())); |
| 106 V8TRYCATCH_VOID(Vector<Dictionary>, sequenceDictionaryArg, toNativeArray<Dic
tionary>(info[5], 6, info.GetIsolate())); | 106 V8TRYCATCH_VOID(Vector<Dictionary>, sequenceDictionaryArg, toNativeArray<Dic
tionary>(info[5], 6, info.GetIsolate())); |
| 107 V8TRYCATCH_VOID(Dictionary, optionalDictionaryArg, Dictionary(info[6], info.
GetIsolate())); | 107 V8TRYCATCH_VOID(Dictionary, optionalDictionaryArg, Dictionary(info[6], info.
GetIsolate())); |
| 108 if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isO
bject()) { | 108 if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isO
bject()) { |
| 109 exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is
not an object."); | 109 exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is
not an object."); |
| 110 exceptionState.throwIfNeeded(); | 110 exceptionState.throwIfNeeded(); |
| 111 return; | 111 return; |
| 112 } | 112 } |
| 113 V8TRYCATCH_VOID(TestInterfaceEmpty*, optionalTestInterfaceEmptyArg, V8TestIn
terfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[7])); | 113 V8TRYCATCH_VOID(TestInterfaceEmpty*, optionalTestInterfaceEmptyArg, V8TestIn
terfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[7])); |
| 114 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); | 114 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); |
| 115 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; | 115 Document& document = *toDocument(currentExecutionContext(info.GetIsolate()))
; |
| 116 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(con
text, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionaryArg, sequ
enceStringArg, sequenceDictionaryArg, optionalDictionaryArg, optionalTestInterfa
ceEmptyArg, exceptionState); | 116 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(con
text, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionaryArg, sequ
enceStringArg, sequenceDictionaryArg, optionalDictionaryArg, optionalTestInterfa
ceEmptyArg, exceptionState); |
| 117 v8::Handle<v8::Object> wrapper = info.Holder(); | |
| 118 if (exceptionState.throwIfNeeded()) | 117 if (exceptionState.throwIfNeeded()) |
| 119 return; | 118 return; |
| 120 | 119 |
| 121 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re
lease(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(
), WrapperConfiguration::Dependent); | 120 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 121 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re
lease(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(
), WrapperConfiguration::Independent); |
| 122 v8SetReturnValue(info, wrapper); | 122 v8SetReturnValue(info, wrapper); |
| 123 } | 123 } |
| 124 | 124 |
| 125 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 125 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 126 { | 126 { |
| 127 if (((info.Length() == 0))) { | 127 if (((info.Length() == 0))) { |
| 128 TestInterfaceConstructorV8Internal::constructor1(info); | 128 TestInterfaceConstructorV8Internal::constructor1(info); |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 if (((info.Length() == 6) && (V8TestInterfaceEmpty::hasInstance(info[2], inf
o.GetIsolate())) && (info[3]->IsObject()) && (info[4]->IsArray()) && (info[5]->I
sArray())) || ((info.Length() == 7) && (V8TestInterfaceEmpty::hasInstance(info[2
], info.GetIsolate())) && (info[3]->IsObject()) && (info[4]->IsArray()) && (info
[5]->IsArray()) && (info[6]->IsUndefined() || info[6]->IsObject())) || ((info.Le
ngth() == 8) && (V8TestInterfaceEmpty::hasInstance(info[2], info.GetIsolate()))
&& (info[3]->IsObject()) && (info[4]->IsArray()) && (info[5]->IsArray()) && (inf
o[6]->IsUndefined() || info[6]->IsObject()) && (V8TestInterfaceEmpty::hasInstanc
e(info[7], info.GetIsolate())))) { | 131 if (((info.Length() == 6) && (V8TestInterfaceEmpty::hasInstance(info[2], inf
o.GetIsolate())) && (info[3]->IsObject()) && (info[4]->IsArray()) && (info[5]->I
sArray())) || ((info.Length() == 7) && (V8TestInterfaceEmpty::hasInstance(info[2
], info.GetIsolate())) && (info[3]->IsObject()) && (info[4]->IsArray()) && (info
[5]->IsArray()) && (info[6]->IsUndefined() || info[6]->IsObject())) || ((info.Le
ngth() == 8) && (V8TestInterfaceEmpty::hasInstance(info[2], info.GetIsolate()))
&& (info[3]->IsObject()) && (info[4]->IsArray()) && (info[5]->IsArray()) && (inf
o[6]->IsUndefined() || info[6]->IsObject()) && (V8TestInterfaceEmpty::hasInstanc
e(info[7], info.GetIsolate())))) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 fromInternalPointer(object)->deref(); | 227 fromInternalPointer(object)->deref(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 template<> | 230 template<> |
| 231 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 231 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 232 { | 232 { |
| 233 return toV8(impl, creationContext, isolate); | 233 return toV8(impl, creationContext, isolate); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace WebCore | 236 } // namespace WebCore |
| OLD | NEW |