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

Unified Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 299203002: Support per-overload [RuntimeEnabled] extended attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move comment Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestObject.cpp
diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp
index c85503898c50b59830b3700acaae7bcf6b7d5d72..0cff9257a382c9df1f207760589381f7b8e1180c 100644
--- a/Source/bindings/tests/results/V8TestObject.cpp
+++ b/Source/bindings/tests/results/V8TestObject.cpp
@@ -6915,6 +6915,10 @@ static void overloadedMethodBMethod(const v8::FunctionCallbackInfo<v8::Value>& i
overloadedMethodB2Method(info);
return;
}
+ if (true) {
haraken 2014/06/12 13:32:57 This branch will never hit. Shall we use a better
Jens Widell 2014/06/12 13:40:07 Avoid overloading between DOMString/enum and numer
haraken 2014/06/12 13:44:53 ah, makes sense!
Nils Barth (inactive) 2014/06/13 01:42:47 This code is intentional, to keep the CG simpler.
+ overloadedMethodB1Method(info);
+ return;
+ }
break;
case 2:
if (true) {
@@ -7160,6 +7164,10 @@ static void overloadedMethodFMethod(const v8::FunctionCallbackInfo<v8::Value>& i
overloadedMethodF1Method(info);
return;
}
+ if (true) {
haraken 2014/06/12 13:32:57 Ditto.
+ overloadedMethodF2Method(info);
+ return;
+ }
break;
default:
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length()));
@@ -7328,6 +7336,10 @@ static void overloadedMethodIMethod(const v8::FunctionCallbackInfo<v8::Value>& i
overloadedMethodI1Method(info);
return;
}
+ if (true) {
haraken 2014/06/12 13:32:57 Ditto.
+ overloadedMethodI2Method(info);
+ return;
+ }
break;
default:
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
@@ -8782,6 +8794,142 @@ static void perWorldBindingsRuntimeEnabledVoidMethodMethodCallbackForMainWorld(c
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
+static void runtimeEnabledOverloadedVoidMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TestObject* impl = V8TestObject::toNative(info.Holder());
+ V8StringResource<> stringArg;
+ {
+ TOSTRING_VOID_INTERNAL(stringArg, info[0]);
+ }
+ impl->runtimeEnabledOverloadedVoidMethod(stringArg);
+}
+
+static void runtimeEnabledOverloadedVoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "runtimeEnabledOverloadedVoidMethod", "TestObject", info.Holder(), info.GetIsolate());
+ TestObject* impl = V8TestObject::toNative(info.Holder());
+ int longArg;
+ {
+ v8::TryCatch block;
+ V8RethrowTryCatchScope rethrow(block);
+ TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState);
+ }
+ impl->runtimeEnabledOverloadedVoidMethod(longArg);
+}
+
+static void runtimeEnabledOverloadedVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8::Isolate* isolate = info.GetIsolate();
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "runtimeEnabledOverloadedVoidMethod", "TestObject", info.Holder(), isolate);
+ switch (std::min(1, info.Length())) {
+ case 1:
+ if (info[0]->IsNumber()) {
+ runtimeEnabledOverloadedVoidMethod2Method(info);
+ return;
+ }
+ if (true) {
+ runtimeEnabledOverloadedVoidMethod1Method(info);
+ return;
+ }
+ if (true) {
+ runtimeEnabledOverloadedVoidMethod2Method(info);
+ return;
+ }
+ break;
+ default:
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No function was found that matched the signature provided.");
+ exceptionState.throwIfNeeded();
+}
+
+static void runtimeEnabledOverloadedVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
+ TestObjectV8Internal::runtimeEnabledOverloadedVoidMethodMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+}
+
+static void partiallyRuntimeEnabledOverloadedVoidMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TestObject* impl = V8TestObject::toNative(info.Holder());
+ V8StringResource<> stringArg;
+ {
+ TOSTRING_VOID_INTERNAL(stringArg, info[0]);
+ }
+ impl->partiallyRuntimeEnabledOverloadedVoidMethod(stringArg);
+}
+
+static void partiallyRuntimeEnabledOverloadedVoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TestObject* impl = V8TestObject::toNative(info.Holder());
+ TestInterfaceImplementation* testInterface;
+ {
+ v8::TryCatch block;
+ V8RethrowTryCatchScope rethrow(block);
+ TONATIVE_VOID_INTERNAL(testInterface, V8TestInterface::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
+ }
+ impl->partiallyRuntimeEnabledOverloadedVoidMethod(testInterface);
+}
+
+static void partiallyRuntimeEnabledOverloadedVoidMethod3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "partiallyRuntimeEnabledOverloadedVoidMethod", "TestObject", info.Holder(), info.GetIsolate());
+ TestObject* impl = V8TestObject::toNative(info.Holder());
+ int longArg;
+ {
+ v8::TryCatch block;
+ V8RethrowTryCatchScope rethrow(block);
+ TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState);
+ }
+ impl->partiallyRuntimeEnabledOverloadedVoidMethod(longArg);
+}
+
+static void partiallyRuntimeEnabledOverloadedVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8::Isolate* isolate = info.GetIsolate();
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "partiallyRuntimeEnabledOverloadedVoidMethod", "TestObject", info.Holder(), isolate);
+ switch (std::min(1, info.Length())) {
+ case 1:
+ if (RuntimeEnabledFeatures::featureName2Enabled()) {
+ if (V8TestInterface::hasInstance(info[0], isolate)) {
+ partiallyRuntimeEnabledOverloadedVoidMethod2Method(info);
+ return;
+ }
+ }
+ if (info[0]->IsNumber()) {
+ partiallyRuntimeEnabledOverloadedVoidMethod3Method(info);
+ return;
+ }
+ if (RuntimeEnabledFeatures::featureName1Enabled()) {
+ if (true) {
+ partiallyRuntimeEnabledOverloadedVoidMethod1Method(info);
+ return;
+ }
+ }
+ if (true) {
+ partiallyRuntimeEnabledOverloadedVoidMethod3Method(info);
+ return;
+ }
+ break;
+ default:
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No function was found that matched the signature provided.");
+ exceptionState.throwIfNeeded();
+}
+
+static void partiallyRuntimeEnabledOverloadedVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
+ TestObjectV8Internal::partiallyRuntimeEnabledOverloadedVoidMethodMethod(info);
+ TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
+}
+
static void treatReturnedNullStringAsNullStringMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TestObject* impl = V8TestObject::toNative(info.Holder());
@@ -9351,6 +9499,7 @@ static const V8DOMConfiguration::MethodConfiguration V8TestObjectMethods[] = {
{"raisesExceptionVoidMethodOptionalTestCallbackInterfaceArg", TestObjectV8Internal::raisesExceptionVoidMethodOptionalTestCallbackInterfaceArgMethodCallback, 0, 0},
{"raisesExceptionTestInterfaceEmptyVoidMethod", TestObjectV8Internal::raisesExceptionTestInterfaceEmptyVoidMethodMethodCallback, 0, 0},
{"callWithExecutionContextRaisesExceptionVoidMethodLongArg", TestObjectV8Internal::callWithExecutionContextRaisesExceptionVoidMethodLongArgMethodCallback, 0, 1},
+ {"partiallyRuntimeEnabledOverloadedVoidMethod", TestObjectV8Internal::partiallyRuntimeEnabledOverloadedVoidMethodMethodCallback, 0, 1},
{"treatReturnedNullStringAsNullStringMethod", TestObjectV8Internal::treatReturnedNullStringAsNullStringMethodMethodCallback, 0, 0},
{"treatReturnedNullStringAsUndefinedStringMethod", TestObjectV8Internal::treatReturnedNullStringAsUndefinedStringMethodMethodCallback, 0, 0},
{"typeCheckingInterfaceVoidMethodTestInterfaceEmptyArg", TestObjectV8Internal::typeCheckingInterfaceVoidMethodTestInterfaceEmptyArgMethodCallback, 0, 1},
@@ -9438,14 +9587,18 @@ static void configureV8TestObjectTemplate(v8::Handle<v8::FunctionTemplate> funct
prototypeTemplate->Set(v8AtomicString(isolate, "notEnumerableVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::notEnumerableVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0), static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum));
prototypeTemplate->Set(v8AtomicString(isolate, "readOnlyVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::readOnlyVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0), static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly));
prototypeTemplate->Set(v8AtomicString(isolate, "notEnumerableReadOnlyVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::notEnumerableReadOnlyVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0), static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum | v8::ReadOnly));
- if (RuntimeEnabledFeatures::featureNameEnabled())
+ if (RuntimeEnabledFeatures::featureNameEnabled()) {
prototypeTemplate->Set(v8AtomicString(isolate, "runtimeEnabledVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::runtimeEnabledVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0));
- if (DOMWrapperWorld::current(isolate).isMainWorld()) {
- if (RuntimeEnabledFeatures::featureNameEnabled())
+ }
+ if (RuntimeEnabledFeatures::featureNameEnabled()) {
+ if (DOMWrapperWorld::current(isolate).isMainWorld()) {
prototypeTemplate->Set(v8AtomicString(isolate, "perWorldBindingsRuntimeEnabledVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::perWorldBindingsRuntimeEnabledVoidMethodMethodCallbackForMainWorld, v8Undefined(), defaultSignature, 0));
- } else {
- if (RuntimeEnabledFeatures::featureNameEnabled())
+ } else {
prototypeTemplate->Set(v8AtomicString(isolate, "perWorldBindingsRuntimeEnabledVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::perWorldBindingsRuntimeEnabledVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0));
+ }
+ }
+ if (RuntimeEnabledFeatures::featureNameEnabled()) {
+ prototypeTemplate->Set(v8AtomicString(isolate, "runtimeEnabledOverloadedVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::runtimeEnabledOverloadedVoidMethodMethodCallback, v8Undefined(), defaultSignature, 1));
}
instanceTemplate->Set(v8AtomicString(isolate, "unforgeableVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::unforgeableVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0));
functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "staticStringAttribute"), TestObjectV8Internal::staticStringAttributeAttributeGetterCallback, TestObjectV8Internal::staticStringAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698