Title: [124718] trunk/Source/WebCore
Revision
124718
Author
[email protected]
Date
2012-08-05 11:40:23 -0700 (Sun, 05 Aug 2012)

Log Message

[V8] Move V8Proxy methods that set DOM attributes/callbacks to V8Binding
https://bugs.webkit.org/show_bug.cgi?id=93103

Reviewed by Adam Barth.

To remove V8Proxy, we can move V8Proxy methods that set DOM
attributes/callbacks to V8Binding.

No tests. No change in behavior.

* bindings/v8/V8Binding.cpp:
(WebCore::batchConfigureAttributes):
(WebCore):
(WebCore::batchConfigureCallbacks):
(WebCore::batchConfigureConstants):
* bindings/v8/V8Binding.h:
(BatchedAttribute):
(WebCore):
(WebCore::configureAttribute):
(BatchedConstant):
(BatchedCallback):
* bindings/v8/V8Proxy.cpp:
* bindings/v8/V8Proxy.h:
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124717 => 124718)


--- trunk/Source/WebCore/ChangeLog	2012-08-05 16:28:42 UTC (rev 124717)
+++ trunk/Source/WebCore/ChangeLog	2012-08-05 18:40:23 UTC (rev 124718)
@@ -1,5 +1,32 @@
 2012-08-05  Kentaro Hara  <[email protected]>
 
+        [V8] Move V8Proxy methods that set DOM attributes/callbacks to V8Binding
+        https://bugs.webkit.org/show_bug.cgi?id=93103
+
+        Reviewed by Adam Barth.
+
+        To remove V8Proxy, we can move V8Proxy methods that set DOM
+        attributes/callbacks to V8Binding.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/V8Binding.cpp:
+        (WebCore::batchConfigureAttributes):
+        (WebCore):
+        (WebCore::batchConfigureCallbacks):
+        (WebCore::batchConfigureConstants):
+        * bindings/v8/V8Binding.h:
+        (BatchedAttribute):
+        (WebCore):
+        (WebCore::configureAttribute):
+        (BatchedConstant):
+        (BatchedCallback):
+        * bindings/v8/V8Proxy.cpp:
+        * bindings/v8/V8Proxy.h:
+        (WebCore):
+
+2012-08-05  Kentaro Hara  <[email protected]>
+
         [V8] Remove V8Proxy::registerExtensionWithV8()
         https://bugs.webkit.org/show_bug.cgi?id=93115
 

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (124717 => 124718)


--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2012-08-05 16:28:42 UTC (rev 124717)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2012-08-05 18:40:23 UTC (rev 124718)
@@ -621,4 +621,40 @@
     return ret.release();
 }
 
+void batchConfigureAttributes(v8::Handle<v8::ObjectTemplate> instance, 
+                              v8::Handle<v8::ObjectTemplate> proto, 
+                              const BatchedAttribute* attributes, 
+                              size_t attributeCount)
+{
+    for (size_t i = 0; i < attributeCount; ++i)
+        configureAttribute(instance, proto, attributes[i]);
+}
+
+void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate> proto, 
+                             v8::Handle<v8::Signature> signature, 
+                             v8::PropertyAttribute attributes,
+                             const BatchedCallback* callbacks,
+                             size_t callbackCount)
+{
+    for (size_t i = 0; i < callbackCount; ++i) {
+        proto->Set(v8::String::New(callbacks[i].name),
+                   v8::FunctionTemplate::New(callbacks[i].callback, 
+                                             v8::Handle<v8::Value>(),
+                                             signature),
+                   attributes);
+    }
+}
+
+void batchConfigureConstants(v8::Handle<v8::FunctionTemplate> functionDescriptor,
+                             v8::Handle<v8::ObjectTemplate> proto,
+                             const BatchedConstant* constants,
+                             size_t constantCount)
+{
+    for (size_t i = 0; i < constantCount; ++i) {
+        const BatchedConstant* constant = &constants[i];
+        functionDescriptor->Set(v8::String::New(constant->name), v8Integer(constant->value), v8::ReadOnly);
+        proto->Set(v8::String::New(constant->name), v8Integer(constant->value), v8::ReadOnly);
+    }
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (124717 => 124718)


--- trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-08-05 16:28:42 UTC (rev 124717)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-08-05 18:40:23 UTC (rev 124718)
@@ -723,6 +723,57 @@
         DefaultIsNullString
     };
 
+    // The following Batch structs and methods are used for setting multiple
+    // properties on an ObjectTemplate, used from the generated bindings
+    // initialization (ConfigureXXXTemplate). This greatly reduces the binary
+    // size by moving from code driven setup to data table driven setup.
+
+    // BatchedAttribute translates into calls to SetAccessor() on either the
+    // instance or the prototype ObjectTemplate, based on |onProto|.
+    struct BatchedAttribute {
+        const char* const name;
+        v8::AccessorGetter getter;
+        v8::AccessorSetter setter;
+        WrapperTypeInfo* data;
+        v8::AccessControl settings;
+        v8::PropertyAttribute attribute;
+        bool onProto;
+    };
+
+    void batchConfigureAttributes(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::ObjectTemplate>, const BatchedAttribute*, size_t attributeCount);
+
+    template<class ObjectOrTemplate>
+    inline void configureAttribute(v8::Handle<ObjectOrTemplate> instance, v8::Handle<ObjectOrTemplate> proto, const BatchedAttribute& attribute)
+    {
+        (attribute.onProto ? proto : instance)->SetAccessor(v8::String::New(attribute.name),
+            attribute.getter,
+            attribute.setter,
+            v8::External::Wrap(attribute.data),
+            attribute.settings,
+            attribute.attribute);
+    }
+
+    // BatchedConstant translates into calls to Set() for setting up an object's
+    // constants. It sets the constant on both the FunctionTemplate and the
+    // ObjectTemplate. PropertyAttributes is always ReadOnly.
+    struct BatchedConstant {
+        const char* const name;
+        int value;
+    };
+
+    void batchConfigureConstants(v8::Handle<v8::FunctionTemplate>, v8::Handle<v8::ObjectTemplate>, const BatchedConstant*, size_t constantCount);
+
+    struct BatchedCallback {
+        const char* const name;
+        v8::InvocationCallback callback;
+    };
+
+    void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate>, 
+                                 v8::Handle<v8::Signature>,
+                                 v8::PropertyAttribute,
+                                 const BatchedCallback*, 
+                                 size_t callbackCount);
+
 } // namespace WebCore
 
 #endif // V8Binding_h

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (124717 => 124718)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2012-08-05 16:28:42 UTC (rev 124717)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2012-08-05 18:40:23 UTC (rev 124718)
@@ -78,42 +78,6 @@
 
 namespace WebCore {
 
-void batchConfigureAttributes(v8::Handle<v8::ObjectTemplate> instance, 
-                              v8::Handle<v8::ObjectTemplate> proto, 
-                              const BatchedAttribute* attributes, 
-                              size_t attributeCount)
-{
-    for (size_t i = 0; i < attributeCount; ++i)
-        configureAttribute(instance, proto, attributes[i]);
-}
-
-void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate> proto, 
-                             v8::Handle<v8::Signature> signature, 
-                             v8::PropertyAttribute attributes,
-                             const BatchedCallback* callbacks,
-                             size_t callbackCount)
-{
-    for (size_t i = 0; i < callbackCount; ++i) {
-        proto->Set(v8::String::New(callbacks[i].name),
-                   v8::FunctionTemplate::New(callbacks[i].callback, 
-                                             v8::Handle<v8::Value>(),
-                                             signature),
-                   attributes);
-    }
-}
-
-void batchConfigureConstants(v8::Handle<v8::FunctionTemplate> functionDescriptor,
-                             v8::Handle<v8::ObjectTemplate> proto,
-                             const BatchedConstant* constants,
-                             size_t constantCount)
-{
-    for (size_t i = 0; i < constantCount; ++i) {
-        const BatchedConstant* constant = &constants[i];
-        functionDescriptor->Set(v8::String::New(constant->name), v8Integer(constant->value), v8::ReadOnly);
-        proto->Set(v8::String::New(constant->name), v8Integer(constant->value), v8::ReadOnly);
-    }
-}
-
 void V8Proxy::reportUnsafeAccessTo(Document* targetDocument)
 {
     if (!targetDocument)

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (124717 => 124718)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.h	2012-08-05 16:28:42 UTC (rev 124717)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h	2012-08-05 18:40:23 UTC (rev 124718)
@@ -66,57 +66,6 @@
     class V8IsolatedContext;
     class WorldContextHandle;
 
-    // The following Batch structs and methods are used for setting multiple
-    // properties on an ObjectTemplate, used from the generated bindings
-    // initialization (ConfigureXXXTemplate). This greatly reduces the binary
-    // size by moving from code driven setup to data table driven setup.
-
-    // BatchedAttribute translates into calls to SetAccessor() on either the
-    // instance or the prototype ObjectTemplate, based on |onProto|.
-    struct BatchedAttribute {
-        const char* const name;
-        v8::AccessorGetter getter;
-        v8::AccessorSetter setter;
-        WrapperTypeInfo* data;
-        v8::AccessControl settings;
-        v8::PropertyAttribute attribute;
-        bool onProto;
-    };
-
-    void batchConfigureAttributes(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::ObjectTemplate>, const BatchedAttribute*, size_t attributeCount);
-
-    template<class ObjectOrTemplate>
-    inline void configureAttribute(v8::Handle<ObjectOrTemplate> instance, v8::Handle<ObjectOrTemplate> proto, const BatchedAttribute& attribute)
-    {
-        (attribute.onProto ? proto : instance)->SetAccessor(v8::String::New(attribute.name),
-            attribute.getter,
-            attribute.setter,
-            v8::External::Wrap(attribute.data),
-            attribute.settings,
-            attribute.attribute);
-    }
-
-    // BatchedConstant translates into calls to Set() for setting up an object's
-    // constants. It sets the constant on both the FunctionTemplate and the
-    // ObjectTemplate. PropertyAttributes is always ReadOnly.
-    struct BatchedConstant {
-        const char* const name;
-        int value;
-    };
-
-    void batchConfigureConstants(v8::Handle<v8::FunctionTemplate>, v8::Handle<v8::ObjectTemplate>, const BatchedConstant*, size_t constantCount);
-
-    struct BatchedCallback {
-        const char* const name;
-        v8::InvocationCallback callback;
-    };
-
-    void batchConfigureCallbacks(v8::Handle<v8::ObjectTemplate>, 
-                                 v8::Handle<v8::Signature>,
-                                 v8::PropertyAttribute,
-                                 const BatchedCallback*, 
-                                 size_t callbackCount);
-
     const int kMaxRecursionDepth = 22;
 
     // The list of extensions that are registered for use with V8.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to