Title: [144313] branches/chromium/1425/Source/WebCore/bindings
Revision
144313
Author
kar...@chromium.org
Date
2013-02-28 07:26:19 -0800 (Thu, 28 Feb 2013)

Log Message

Revert 144157
> [V8] Generate a wrapper function for named constructor callbacks
> https://bugs.webkit.org/show_bug.cgi?id=110794
> 
> Reviewed by Adam Barth.
> 
> This would be the final step of generating wrapper functions.
> The patch generates the following wrapper function for named
> constructor callbacks.
> 
> Handle<Value> namedConstructorCallback(...)
> {
>     return namedConstructor(...);
> }
> 
> No tests. No change in behavior.
> 
> * bindings/scripts/CodeGeneratorV8.pm:
> (GenerateNamedConstructor):
> * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
> (WebCore::namedConstructor):
> (WebCore::namedConstructorCallback):
> (WebCore):
> (WebCore::V8TestNamedConstructorConstructor::GetTemplate):
> * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
> (WebCore::namedConstructor):
> (WebCore::namedConstructorCallback):
> (WebCore):
> (WebCore::V8HTMLImageElementConstructor::GetTemplate):
> 

TBR=hara...@chromium.org
Review URL: https://codereview.chromium.org/12377018

Modified Paths

Diff

Modified: branches/chromium/1425/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (144312 => 144313)


--- branches/chromium/1425/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2013-02-28 15:25:19 UTC (rev 144312)
+++ branches/chromium/1425/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2013-02-28 15:26:19 UTC (rev 144313)
@@ -2147,8 +2147,11 @@
         }
     }
 
+    my $maybeObserveFeature = GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"});
+
     my @beforeArgumentList;
     my @afterArgumentList;
+
     my $toActiveDOMObject = "0";
     if ($codeGenerator->InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
         $toActiveDOMObject = "${v8InterfaceName}::toActiveDOMObject";
@@ -2163,10 +2166,10 @@
     push(@implContent, <<END);
 WrapperTypeInfo ${v8InterfaceName}Constructor::info = { ${v8InterfaceName}Constructor::GetTemplate, ${v8InterfaceName}::derefObject, $toActiveDOMObject, $toEventTarget, 0, ${v8InterfaceName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
 
-static v8::Handle<v8::Value> namedConstructor(const v8::Arguments& args)
+static v8::Handle<v8::Value> ${v8InterfaceName}ConstructorCallback(const v8::Arguments& args)
 {
+    ${maybeObserveFeature}
 END
-    push(@implContent, GenerateFeatureObservation($function->signature->extendedAttributes->{"V8MeasureAs"}));
     push(@implContent, GenerateConstructorHeader());
     push(@implContent, <<END);
     Document* document = currentDocument(BindingState::instance());
@@ -2221,18 +2224,16 @@
     V8DOMWrapper::associateObjectWithWrapper(impl.release(), &${v8InterfaceName}Constructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
     return wrapper;
 END
+
     if ($raisesExceptions) {
         push(@implContent, "    fail:\n");
         push(@implContent, "    return setDOMException(ec, args.GetIsolate());\n");
     }
+
+    push(@implContent, "}\n");
+
     push(@implContent, <<END);
-}
 
-static v8::Handle<v8::Value> namedConstructorCallback(const v8::Arguments& args)
-{
-    return namedConstructor(args);
-}
-
 v8::Persistent<v8::FunctionTemplate> ${v8InterfaceName}Constructor::GetTemplate(v8::Isolate* isolate)
 {
     static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
@@ -2240,7 +2241,7 @@
         return cachedTemplate;
 
     v8::HandleScope scope;
-    v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(namedConstructorCallback);
+    v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(${v8InterfaceName}ConstructorCallback);
 
     v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
     instance->SetInternalFieldCount(${v8InterfaceName}::internalFieldCount);

Modified: branches/chromium/1425/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp (144312 => 144313)


--- branches/chromium/1425/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp	2013-02-28 15:25:19 UTC (rev 144312)
+++ branches/chromium/1425/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp	2013-02-28 15:26:19 UTC (rev 144313)
@@ -74,8 +74,9 @@
 
 WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
 
-static v8::Handle<v8::Value> namedConstructor(const v8::Arguments& args)
+static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8::Arguments& args)
 {
+    
     if (!args.IsConstructCall())
         return throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
 
@@ -107,11 +108,6 @@
     return setDOMException(ec, args.GetIsolate());
 }
 
-static v8::Handle<v8::Value> namedConstructorCallback(const v8::Arguments& args)
-{
-    return namedConstructor(args);
-}
-
 v8::Persistent<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTemplate(v8::Isolate* isolate)
 {
     static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
@@ -119,7 +115,7 @@
         return cachedTemplate;
 
     v8::HandleScope scope;
-    v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(namedConstructorCallback);
+    v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(V8TestNamedConstructorConstructorCallback);
 
     v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
     instance->SetInternalFieldCount(V8TestNamedConstructor::internalFieldCount);

Modified: branches/chromium/1425/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp (144312 => 144313)


--- branches/chromium/1425/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp	2013-02-28 15:25:19 UTC (rev 144312)
+++ branches/chromium/1425/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp	2013-02-28 15:26:19 UTC (rev 144313)
@@ -45,7 +45,7 @@
 
 WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, V8HTMLImageElement::derefObject, 0, V8HTMLImageElement::toEventTarget, 0, V8HTMLImageElement::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
 
-static v8::Handle<v8::Value> namedConstructor(const v8::Arguments& args)
+static v8::Handle<v8::Value> v8HTMLImageElementConstructorMethodCustom(const v8::Arguments& args)
 {
     if (!args.IsConstructCall())
         return throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
@@ -81,11 +81,6 @@
     return wrapper;
 }
 
-static v8::Handle<v8::Value> namedConstructorCallback(const v8::Arguments& args)
-{
-    return namedConstructor(args);
-}
-
 v8::Persistent<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate(v8::Isolate* isolate)
 {
     static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
@@ -93,7 +88,7 @@
         return cachedTemplate;
 
     v8::HandleScope scope;
-    v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(namedConstructorCallback);
+    v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(v8HTMLImageElementConstructorMethodCustom);
 
     v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate();
     instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to