Title: [136794] trunk/Source/WebCore
Revision
136794
Author
[email protected]
Date
2012-12-05 20:54:09 -0800 (Wed, 05 Dec 2012)

Log Message

[V8] Remove addImplicitReferencesForNodeWithEventListeners()
https://bugs.webkit.org/show_bug.cgi?id=104203

Reviewed by Adam Barth.

We can use opaqueRootForGC() instead. By this change, we can remove
all AddImplicitReferences() from V8 bindings.

Tests: fast/dom/gc-image-element.html
       fast/dom/gc-image-element-2.html
       fast/dom/inline-event-attributes-lookup-removed.html

* bindings/v8/V8GCController.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136793 => 136794)


--- trunk/Source/WebCore/ChangeLog	2012-12-06 03:47:00 UTC (rev 136793)
+++ trunk/Source/WebCore/ChangeLog	2012-12-06 04:54:09 UTC (rev 136794)
@@ -1,3 +1,19 @@
+2012-12-05  Kentaro Hara  <[email protected]>
+
+        [V8] Remove addImplicitReferencesForNodeWithEventListeners()
+        https://bugs.webkit.org/show_bug.cgi?id=104203
+
+        Reviewed by Adam Barth.
+
+        We can use opaqueRootForGC() instead. By this change, we can remove
+        all AddImplicitReferences() from V8 bindings.
+
+        Tests: fast/dom/gc-image-element.html
+               fast/dom/gc-image-element-2.html
+               fast/dom/inline-event-attributes-lookup-removed.html
+
+        * bindings/v8/V8GCController.cpp:
+
 2012-12-05  Andrei Bucur  <[email protected]>
 
         [CSS Regions] Blocks don't relayout children if the width of a region changes

Modified: trunk/Source/WebCore/bindings/v8/V8GCController.cpp (136793 => 136794)


--- trunk/Source/WebCore/bindings/v8/V8GCController.cpp	2012-12-06 03:47:00 UTC (rev 136793)
+++ trunk/Source/WebCore/bindings/v8/V8GCController.cpp	2012-12-06 04:54:09 UTC (rev 136794)
@@ -113,29 +113,6 @@
     Vector<ImplicitConnection> m_connections;
 };
 
-// FIXME: This should use opaque GC roots.
-static void addImplicitReferencesForNodeWithEventListeners(Node* node, v8::Persistent<v8::Object> wrapper)
-{
-    ASSERT(node->hasEventListeners());
-
-    Vector<v8::Persistent<v8::Value> > listeners;
-
-    EventListenerIterator iterator(node);
-    while (EventListener* listener = iterator.nextListener()) {
-        if (listener->type() != EventListener::JSEventListenerType)
-            continue;
-        V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListener*>(listener);
-        if (!v8listener->hasExistingListenerObject())
-            continue;
-        listeners.append(v8listener->existingListenerObjectPersistentHandle());
-    }
-
-    if (listeners.isEmpty())
-        return;
-
-    v8::V8::AddImplicitReferences(wrapper, listeners.data(), listeners.size());
-}
-
 void* V8GCController::opaqueRootForGC(Node* node)
 {
     if (node->inDocument() || (node->hasTagName(HTMLNames::imgTag) && static_cast<HTMLImageElement*>(node)->hasPendingActivity()))
@@ -202,11 +179,21 @@
             ASSERT(!wrapper.IsIndependent());
 
             Node* node = static_cast<Node*>(object);
+            void* root = V8GCController::opaqueRootForGC(node);
 
-            if (node->hasEventListeners())
-                addImplicitReferencesForNodeWithEventListeners(node, wrapper);
+            if (node->hasEventListeners()) {
+                EventListenerIterator iterator(node);
+                while (EventListener* listener = iterator.nextListener()) {
+                    if (listener->type() != EventListener::JSEventListenerType)
+                        continue;
+                    V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListener*>(listener);
+                    if (!v8listener->hasExistingListenerObject())
+                        continue;
+                    m_grouper.addToGroup(root, v8listener->existingListenerObjectPersistentHandle());
+                }
+            }
 
-            m_grouper.addToGroup(V8GCController::opaqueRootForGC(node), wrapper);
+            m_grouper.addToGroup(root, wrapper);
         } else if (classId == v8DOMObjectClassId) {
             m_grouper.addToGroup(type->opaqueRootForGC(object, wrapper), wrapper);
         } else {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to