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

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

Issue 338893004: Extend ScalarValueString handling to include constructors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tweaks 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
Index: Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp
diff --git a/Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp b/Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp
similarity index 54%
copy from Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp
copy to Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp
index fdc4799eeccf1eda7697cd071e10fe0c5a101533..db3d04fc9f9e59d68b4865bfd22cff8b9f14f597 100644
--- a/Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp
+++ b/Source/bindings/tests/results/V8TestInterfaceConstructor4.cpp
@@ -5,8 +5,9 @@
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#include "config.h"
-#include "V8TestInterfaceConstructor3.h"
+#include "V8TestInterfaceConstructor4.h"
+#include "bindings/tests/v8/V8TestInterfaceConstructor4.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8DOMConfiguration.h"
#include "bindings/v8/V8HiddenValue.h"
@@ -21,53 +22,92 @@
namespace WebCore {
-static void initializeScriptWrappableForInterface(TestInterfaceConstructor3* object)
+static void initializeScriptWrappableForInterface(TestInterfaceConstructor4* object)
{
if (ScriptWrappable::wrapperCanBeStoredInObject(object))
- ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterfaceConstructor3::wrapperTypeInfo);
+ ScriptWrappable::fromObject(object)->setTypeInfo(&V8TestInterfaceConstructor4::wrapperTypeInfo);
else
ASSERT_NOT_REACHED();
}
} // namespace WebCore
-void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceConstructor3* object)
+void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceConstructor4* object)
{
WebCore::initializeScriptWrappableForInterface(object);
}
namespace WebCore {
-const WrapperTypeInfo V8TestInterfaceConstructor3::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceConstructor3::domTemplate, V8TestInterfaceConstructor3::derefObject, 0, 0, 0, V8TestInterfaceConstructor3::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
+const WrapperTypeInfo V8TestInterfaceConstructor4::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceConstructor4::domTemplate, V8TestInterfaceConstructor4::derefObject, 0, 0, 0, V8TestInterfaceConstructor4::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
-namespace TestInterfaceConstructor3V8Internal {
+namespace TestInterfaceConstructor4V8Internal {
template <typename T> void V8_USE(T) { }
-static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
+static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Isolate* isolate = info.GetIsolate();
- if (UNLIKELY(info.Length() < 1)) {
- throwMinimumArityTypeErrorForConstructor("TestInterfaceConstructor3", 1, info.Length(), info.GetIsolate());
- return;
+ TestInterfaceConstructor4* testInterface4Arg;
+ {
+ v8::TryCatch block;
+ V8RethrowTryCatchScope rethrow(block);
+ TONATIVE_VOID_INTERNAL(testInterface4Arg, V8TestInterfaceConstructor4::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
}
- V8StringResource<> stringArg;
+ RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(testInterface4Arg);
+
+ v8::Handle<v8::Object> wrapper = info.Holder();
+ V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor4>(impl.release(), &V8TestInterfaceConstructor4::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
+ v8SetReturnValue(info, wrapper);
+}
+
+static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8::Isolate* isolate = info.GetIsolate();
+ ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor4", info.Holder(), isolate);
+ V8StringResource<> scalarValueStringArg;
{
- TOSTRING_VOID_INTERNAL(stringArg, info[0]);
+ v8::TryCatch block;
+ V8RethrowTryCatchScope rethrow(block);
+ TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(scalarValueStringArg, toScalarValueString(info[0], exceptionState), exceptionState);
}
- RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(stringArg);
+ RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(scalarValueStringArg);
v8::Handle<v8::Object> wrapper = info.Holder();
- V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl.release(), &V8TestInterfaceConstructor3::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor4>(impl.release(), &V8TestInterfaceConstructor4::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
v8SetReturnValue(info, wrapper);
}
-} // namespace TestInterfaceConstructor3V8Internal
+static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ v8::Isolate* isolate = info.GetIsolate();
+ ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor4", info.Holder(), isolate);
+ switch (std::min(1, info.Length())) {
+ case 1:
+ if (V8TestInterfaceConstructor4::hasInstance(info[0], isolate)) {
+ TestInterfaceConstructor4V8Internal::constructor1(info);
+ return;
+ }
+ if (true) {
+ TestInterfaceConstructor4V8Internal::constructor2(info);
+ return;
+ }
+ break;
+ default:
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No matching constructor signature.");
+ exceptionState.throwIfNeeded();
+}
+
+} // namespace TestInterfaceConstructor4V8Internal
-void V8TestInterfaceConstructor3::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+void V8TestInterfaceConstructor4::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
if (!info.IsConstructCall()) {
- throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestInterfaceConstructor3"), info.GetIsolate());
+ throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestInterfaceConstructor4"), info.GetIsolate());
return;
}
@@ -76,20 +116,20 @@ void V8TestInterfaceConstructor3::constructorCallback(const v8::FunctionCallback
return;
}
- TestInterfaceConstructor3V8Internal::constructor(info);
+ TestInterfaceConstructor4V8Internal::constructor(info);
}
-static void configureV8TestInterfaceConstructor3Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
+static void configureV8TestInterfaceConstructor4Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
functionTemplate->ReadOnlyPrototype();
v8::Local<v8::Signature> defaultSignature;
- defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceConstructor3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceConstructor3::internalFieldCount,
+ defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceConstructor4", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceConstructor4::internalFieldCount,
0, 0,
0, 0,
0, 0,
isolate);
- functionTemplate->SetCallHandler(V8TestInterfaceConstructor3::constructorCallback);
+ functionTemplate->SetCallHandler(V8TestInterfaceConstructor4::constructorCallback);
functionTemplate->SetLength(1);
v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
@@ -98,37 +138,37 @@ static void configureV8TestInterfaceConstructor3Template(v8::Handle<v8::Function
functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
}
-v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor3::domTemplate(v8::Isolate* isolate)
+v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor4::domTemplate(v8::Isolate* isolate)
{
- return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), configureV8TestInterfaceConstructor3Template);
+ return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), configureV8TestInterfaceConstructor4Template);
}
-bool V8TestInterfaceConstructor3::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
+bool V8TestInterfaceConstructor4::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}
-v8::Handle<v8::Object> V8TestInterfaceConstructor3::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
+v8::Handle<v8::Object> V8TestInterfaceConstructor4::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}
-TestInterfaceConstructor3* V8TestInterfaceConstructor3::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
+TestInterfaceConstructor4* V8TestInterfaceConstructor4::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
{
return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Object>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
}
-v8::Handle<v8::Object> wrap(TestInterfaceConstructor3* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+v8::Handle<v8::Object> wrap(TestInterfaceConstructor4* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor3>(impl, isolate));
- return V8TestInterfaceConstructor3::createWrapper(impl, creationContext, isolate);
+ ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor4>(impl, isolate));
+ return V8TestInterfaceConstructor4::createWrapper(impl, creationContext, isolate);
}
-v8::Handle<v8::Object> V8TestInterfaceConstructor3::createWrapper(PassRefPtr<TestInterfaceConstructor3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+v8::Handle<v8::Object> V8TestInterfaceConstructor4::createWrapper(PassRefPtr<TestInterfaceConstructor4> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
ASSERT(impl);
- ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor3>(impl.get(), isolate));
+ ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor4>(impl.get(), isolate));
if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo();
// Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
@@ -141,17 +181,17 @@ v8::Handle<v8::Object> V8TestInterfaceConstructor3::createWrapper(PassRefPtr<Tes
return wrapper;
installPerContextEnabledProperties(wrapper, impl.get(), isolate);
- V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
+ V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor4>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
return wrapper;
}
-void V8TestInterfaceConstructor3::derefObject(void* object)
+void V8TestInterfaceConstructor4::derefObject(void* object)
{
fromInternalPointer(object)->deref();
}
template<>
-v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor3* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor4* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
return toV8(impl, creationContext, isolate);
}
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceConstructor4.h ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698