Title: [88357] trunk/Source/WebCore
Revision
88357
Author
commit-qu...@webkit.org
Date
2011-06-08 10:31:03 -0700 (Wed, 08 Jun 2011)

Log Message

2011-06-08  Dmitry Lomov  <dslo...@google.com>

        Reviewed by Adam Barth.

        https://bugs.webkit.org/show_bug.cgi?id=62164
        Remove "multi-threaded" logic in V8 DOMData, DOMDataStore and friends
        This functionality is untested and unused:
        This is an old code from Lockers-based implementation of WebWorkers in
        V8 bindings, to make sure that DOM objects are released on the right thread
        even though GC could have happened on any thread. It is currently unused (since
        current model is one worker per process) and is being removed because new implementation
        of WebWorkers will be using V8 isolates.

        * WebCore.gypi:
        * WebCore.pro:
        * bindings/v8/ChildThreadDOMData.cpp: Removed.
        * bindings/v8/ChildThreadDOMData.h: Removed.
        * bindings/v8/DOMData.cpp:
        (WebCore::DOMData::DOMData):
        (WebCore::DOMData::getCurrent):
        (WebCore::DOMData::getMainThreadStore):
        * bindings/v8/DOMData.h:
        (WebCore::DOMData::getStore):
        (WebCore::DOMData::getCurrentMainThreadStore):
        (WebCore::DOMData::handleWeakObject):
        * bindings/v8/DOMDataStore.cpp:
        (WebCore::DOMDataStore::DOMDataStore):
        (WebCore::DOMDataStore::~DOMDataStore):
        (WebCore::DOMDataStore::weakNodeCallback):
        * bindings/v8/DOMDataStore.h:
        * bindings/v8/MainThreadDOMData.cpp: Removed.
        * bindings/v8/MainThreadDOMData.h: Removed.
        * bindings/v8/V8DOMMap.cpp:
        (WebCore::getDOMDataStore):
        (WebCore::removeAllDOMObjects):
        (WebCore::visitDOMNodes):
        (WebCore::visitDOMObjects):
        (WebCore::visitActiveDOMObjects):
        (WebCore::visitDOMSVGElementInstances):
        * bindings/v8/V8DOMMap.h:
        * bindings/v8/V8GCController.cpp:
        (WebCore::V8GCController::gcPrologue):
        (WebCore::V8GCController::gcEpilogue):
        * bindings/v8/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::~WorkerScriptController):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88356 => 88357)


--- trunk/Source/WebCore/ChangeLog	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/ChangeLog	2011-06-08 17:31:03 UTC (rev 88357)
@@ -1,3 +1,49 @@
+2011-06-08  Dmitry Lomov  <dslo...@google.com>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=62164
+        Remove "multi-threaded" logic in V8 DOMData, DOMDataStore and friends
+        This functionality is untested and unused:
+        This is an old code from Lockers-based implementation of WebWorkers in
+        V8 bindings, to make sure that DOM objects are released on the right thread
+        even though GC could have happened on any thread. It is currently unused (since
+        current model is one worker per process) and is being removed because new implementation
+        of WebWorkers will be using V8 isolates.
+
+        * WebCore.gypi:
+        * WebCore.pro:
+        * bindings/v8/ChildThreadDOMData.cpp: Removed.
+        * bindings/v8/ChildThreadDOMData.h: Removed.
+        * bindings/v8/DOMData.cpp:
+        (WebCore::DOMData::DOMData):
+        (WebCore::DOMData::getCurrent):
+        (WebCore::DOMData::getMainThreadStore):
+        * bindings/v8/DOMData.h:
+        (WebCore::DOMData::getStore):
+        (WebCore::DOMData::getCurrentMainThreadStore):
+        (WebCore::DOMData::handleWeakObject):
+        * bindings/v8/DOMDataStore.cpp:
+        (WebCore::DOMDataStore::DOMDataStore):
+        (WebCore::DOMDataStore::~DOMDataStore):
+        (WebCore::DOMDataStore::weakNodeCallback):
+        * bindings/v8/DOMDataStore.h:
+        * bindings/v8/MainThreadDOMData.cpp: Removed.
+        * bindings/v8/MainThreadDOMData.h: Removed.
+        * bindings/v8/V8DOMMap.cpp:
+        (WebCore::getDOMDataStore):
+        (WebCore::removeAllDOMObjects):
+        (WebCore::visitDOMNodes):
+        (WebCore::visitDOMObjects):
+        (WebCore::visitActiveDOMObjects):
+        (WebCore::visitDOMSVGElementInstances):
+        * bindings/v8/V8DOMMap.h:
+        * bindings/v8/V8GCController.cpp:
+        (WebCore::V8GCController::gcPrologue):
+        (WebCore::V8GCController::gcEpilogue):
+        * bindings/v8/WorkerScriptController.cpp:
+        (WebCore::WorkerScriptController::~WorkerScriptController):
+
 2011-06-08  Yael Aharon  <yael.aha...@nokia.com>
 
         Reviewed by Andreas Kling.

Modified: trunk/Source/WebCore/WebCore.gypi (88356 => 88357)


--- trunk/Source/WebCore/WebCore.gypi	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/WebCore.gypi	2011-06-08 17:31:03 UTC (rev 88357)
@@ -1953,8 +1953,6 @@
             'bindings/objc/ObjCNodeFilterCondition.mm',
             'bindings/objc/PublicDOMInterfaces.h',
             'bindings/objc/WebScriptObject.mm',
-            'bindings/v8/ChildThreadDOMData.cpp',
-            'bindings/v8/ChildThreadDOMData.h',
             'bindings/v8/DOMData.cpp',
             'bindings/v8/DOMData.h',
             'bindings/v8/DOMDataStore.cpp',
@@ -1970,8 +1968,6 @@
             'bindings/v8/IsolatedWorld.h',
             'bindings/v8/_javascript_CallFrame.cpp',
             'bindings/v8/_javascript_CallFrame.h',
-            'bindings/v8/MainThreadDOMData.cpp',
-            'bindings/v8/MainThreadDOMData.h',
             'bindings/v8/NPV8Object.cpp',
             'bindings/v8/NPV8Object.h',
             'bindings/v8/OptionsObject.cpp',

Modified: trunk/Source/WebCore/WebCore.pro (88356 => 88357)


--- trunk/Source/WebCore/WebCore.pro	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/WebCore.pro	2011-06-08 17:31:03 UTC (rev 88357)
@@ -88,11 +88,9 @@
         bindings/v8/custom/V8Uint16ArrayCustom.cpp \
         bindings/v8/custom/V8Uint32ArrayCustom.cpp \
         \
-        bindings/v8/ChildThreadDOMData.cpp \
         bindings/v8/DateExtension.cpp \
         bindings/v8/DOMData.cpp \
         bindings/v8/DOMDataStore.cpp \
-        bindings/v8/MainThreadDOMData.cpp \
         bindings/v8/NPV8Object.cpp \
         bindings/v8/PageScriptDebugServer.cpp \
         bindings/v8/RetainedDOMInfo.cpp \

Deleted: trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.cpp (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.cpp	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.cpp	2011-06-08 17:31:03 UTC (rev 88357)
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ChildThreadDOMData.h"
-
-namespace WebCore {
-
-ChildThreadDOMData::ChildThreadDOMData()
-    : m_defaultStore(this)
-{
-}
-
-DOMDataStore& ChildThreadDOMData::getStore()
-{
-    ASSERT(!WTF::isMainThread());
-    // Currently, child threads have only one world.
-    return m_defaultStore;
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.h (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.h	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.h	2011-06-08 17:31:03 UTC (rev 88357)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ChildThreadDOMData_h
-#define ChildThreadDOMData_h
-
-#include "DOMData.h"
-#include "ScopedDOMDataStore.h"
-
-namespace WebCore {
-
-    class ChildThreadDOMData : public DOMData {
-    public:
-        ChildThreadDOMData();
-        DOMDataStore& getStore();
-
-    private:
-        ScopedDOMDataStore m_defaultStore;
-    };
-
-} // namespace WebCore
-
-#endif // ChildThreadDOMData_h

Modified: trunk/Source/WebCore/bindings/v8/DOMData.cpp (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/DOMData.cpp	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/DOMData.cpp	2011-06-08 17:31:03 UTC (rev 88357)
@@ -30,16 +30,14 @@
 
 #include "config.h"
 #include "DOMData.h"
-
-#include "ChildThreadDOMData.h"
-#include "MainThreadDOMData.h"
+#include "V8IsolatedContext.h"
 #include "WebGLContextAttributes.h"
 #include "WebGLUniformLocation.h"
 
 namespace WebCore {
 
 DOMData::DOMData()
-    : m_owningThread(WTF::currentThread())
+    : m_defaultStore(this)
 {
 }
 
@@ -49,11 +47,19 @@
 
 DOMData* DOMData::getCurrent()
 {
-    if (WTF::isMainThread())
-        return MainThreadDOMData::getCurrent();
+    DEFINE_STATIC_LOCAL(DOMData, mainThreadDOMData, ());
+    return &mainThreadDOMData;
+}
 
-    DEFINE_STATIC_LOCAL(WTF::ThreadSpecific<ChildThreadDOMData>, childThreadDOMData, ());
-    return childThreadDOMData;
+DOMDataStore& DOMData::getMainThreadStore()
+{
+    // This is broken out as a separate non-virtual method from getStore()
+    // so that it can be inlined by getCurrentMainThreadStore, which is
+    // a hot spot in Dromaeo DOM tests.
+    V8IsolatedContext* context = V8IsolatedContext::getEntered();
+    if (UNLIKELY(context != 0))
+        return *context->world()->domDataStore();
+    return m_defaultStore;
 }
 
 void DOMData::derefObject(WrapperTypeInfo* type, void* domObject)
@@ -61,4 +67,6 @@
     type->derefObject(domObject);
 }
 
+
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/v8/DOMData.h (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/DOMData.h	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/DOMData.h	2011-06-08 17:31:03 UTC (rev 88357)
@@ -32,6 +32,7 @@
 #define DOMData_h
 
 #include "DOMDataStore.h"
+#include "StaticDOMDataStore.h"
 #include "V8DOMWrapper.h"
 
 namespace WebCore {
@@ -50,7 +51,7 @@
         virtual ~DOMData();
 
         static DOMData* getCurrent();
-        virtual DOMDataStore& getStore() = 0;
+        DOMDataStore& getStore() { return getMainThreadStore(); }
 
         template<typename T>
         static void handleWeakObject(DOMDataStore::DOMWrapperMapType, v8::Persistent<v8::Object>, T* domObject);
@@ -58,7 +59,7 @@
         template<typename T>
         static void removeObjectsFromWrapperMap(DOMDataStore* store, AbstractWeakReferenceMap<T, v8::Object>& domMap);
 
-        ThreadIdentifier owningThread() const { return m_owningThread; }
+        static DOMDataStore& getCurrentMainThreadStore() { return getCurrent()->getMainThreadStore(); }
 
     private:
         static void derefObject(WrapperTypeInfo* type, void* domObject);
@@ -74,7 +75,8 @@
             }
         };
 
-        ThreadIdentifier m_owningThread;
+        DOMDataStore& getMainThreadStore();
+        StaticDOMDataStore m_defaultStore;
     };
 
     template<typename T>
@@ -85,7 +87,6 @@
         bool found = false;
         for (size_t i = 0; i < list.size(); ++i) {
             DOMDataStore* store = list[i];
-            ASSERT(store->domData()->owningThread() == WTF::currentThread());
 
             DOMWrapperMap<T>* domMap = static_cast<DOMWrapperMap<T>*>(store->getDOMWrapperMap(mapType));
             if (domMap->removeIfPresent(domObject, v8Object)) {

Modified: trunk/Source/WebCore/bindings/v8/DOMDataStore.cpp (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/DOMDataStore.cpp	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/DOMDataStore.cpp	2011-06-08 17:31:03 UTC (rev 88357)
@@ -91,13 +91,11 @@
 #endif
     , m_domData(domData)
 {
-    WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
     DOMDataStore::allStores().append(this);
 }
 
 DOMDataStore::~DOMDataStore()
 {
-    WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
     DOMDataStore::allStores().remove(DOMDataStore::allStores().find(this));
 }
 
@@ -107,12 +105,6 @@
   return staticDOMDataList;
 }
 
-WTF::Mutex& DOMDataStore::allStoresMutex()
-{
-    DEFINE_STATIC_LOCAL(WTF::Mutex, staticDOMDataListMutex, ());
-    return staticDOMDataListMutex;
-}
-
 void* DOMDataStore::getDOMWrapperMap(DOMWrapperMapType type)
 {
     switch (type) {
@@ -156,12 +148,10 @@
     // Node wrappers must be JS objects.
     v8::Persistent<v8::Object> v8Object = v8::Persistent<v8::Object>::Cast(value);
 
-    WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
     DOMDataList& list = DOMDataStore::allStores();
     for (size_t i = 0; i < list.size(); ++i) {
         DOMDataStore* store = list[i];
         if (store->domNodeMap().removeIfPresent(node, v8Object)) {
-            ASSERT(store->domData()->owningThread() == WTF::currentThread());
             node->deref(); // Nobody overrides Node::deref so it's safe
             return; // There might be at most one wrapper for the node in world's maps
         }

Modified: trunk/Source/WebCore/bindings/v8/DOMDataStore.h (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/DOMDataStore.h	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/DOMDataStore.h	2011-06-08 17:31:03 UTC (rev 88357)
@@ -77,8 +77,6 @@
 
         // A list of all DOMDataStore objects in the current V8 instance (thread). Normally, each World has a DOMDataStore.
         static DOMDataList& allStores();
-        // Mutex to protect against concurrent access of DOMDataList.
-        static WTF::Mutex& allStoresMutex();
 
         DOMData* domData() const { return m_domData; }
 

Deleted: trunk/Source/WebCore/bindings/v8/MainThreadDOMData.cpp (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/MainThreadDOMData.cpp	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/MainThreadDOMData.cpp	2011-06-08 17:31:03 UTC (rev 88357)
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "MainThreadDOMData.h"
-
-#include "V8IsolatedContext.h"
-
-namespace WebCore {
-
-MainThreadDOMData::MainThreadDOMData()
-    : m_defaultStore(this)
-{
-}
-    
-MainThreadDOMData* MainThreadDOMData::getCurrent()
-{
-    ASSERT(WTF::isMainThread());
-    DEFINE_STATIC_LOCAL(MainThreadDOMData, mainThreadDOMData, ());
-    return &mainThreadDOMData;
-}
-
-DOMDataStore& MainThreadDOMData::getMainThreadStore()
-{
-    // This is broken out as a separate non-virtual method from getStore()
-    // so that it can be inlined by getCurrentMainThreadStore, which is
-    // a hot spot in Dromaeo DOM tests.
-    ASSERT(WTF::isMainThread());
-    V8IsolatedContext* context = V8IsolatedContext::getEntered();
-    if (UNLIKELY(context != 0))
-        return *context->world()->domDataStore();
-    return m_defaultStore;
-}
-
-DOMDataStore& MainThreadDOMData::getCurrentMainThreadStore()
-{
-    return getCurrent()->getMainThreadStore();
-}
-
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/bindings/v8/MainThreadDOMData.h (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/MainThreadDOMData.h	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/MainThreadDOMData.h	2011-06-08 17:31:03 UTC (rev 88357)
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MainThreadDOMData_h
-#define MainThreadDOMData_h
-
-#include "DOMData.h"
-#include "StaticDOMDataStore.h"
-
-namespace WebCore {
-
-    class MainThreadDOMData : public DOMData {
-    public:
-        static MainThreadDOMData* getCurrent(); // Caller must be on the main thread.
-        static DOMDataStore& getCurrentMainThreadStore();
-                
-        virtual DOMDataStore& getStore() { return getMainThreadStore(); }
-        
-
-    private:
-        MainThreadDOMData();
-        DOMDataStore& getMainThreadStore();
-
-        StaticDOMDataStore m_defaultStore;
-        // Note: The DOMDataStores for isolated world are owned by the world object.
-    };
-
-} // namespace WebCore
-
-#endif // MainThreadDOMData_h

Modified: trunk/Source/WebCore/bindings/v8/V8DOMMap.cpp (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/V8DOMMap.cpp	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/V8DOMMap.cpp	2011-06-08 17:31:03 UTC (rev 88357)
@@ -33,7 +33,6 @@
 
 #include "DOMData.h"
 #include "DOMDataStore.h"
-#include "MainThreadDOMData.h"
 #include "ScopedDOMDataStore.h"
 
 namespace WebCore {
@@ -51,12 +50,7 @@
 
 static inline DOMDataStore& getDOMDataStore()
 {
-    if (LIKELY(fasterDOMStoreAccess)) {
-        ASSERT(WTF::isMainThread());
-        return MainThreadDOMData::getCurrentMainThreadStore();
-    }
-
-    return DOMData::getCurrent()->getStore();
+    return DOMData::getCurrentMainThreadStore();
 }
 
 void enableFasterDOMStoreAccess()
@@ -88,7 +82,7 @@
 
 #endif // ENABLE(SVG)
 
-void removeAllDOMObjectsInCurrentThread()
+void removeAllDOMObjects()
 {
     DOMDataStore& store = getDOMDataStore();
 
@@ -112,46 +106,37 @@
     DOMData::removeObjectsFromWrapperMap<void>(&store, store.activeDomObjectMap());
 }
 
-void visitDOMNodesInCurrentThread(DOMWrapperMap<Node>::Visitor* visitor)
+void visitDOMNodes(DOMWrapperMap<Node>::Visitor* visitor)
 {
     v8::HandleScope scope;
 
-    WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
     DOMDataList& list = DOMDataStore::allStores();
     for (size_t i = 0; i < list.size(); ++i) {
         DOMDataStore* store = list[i];
-        if (!store->domData()->owningThread() == WTF::currentThread())
-            continue;
 
         store->domNodeMap().visit(store, visitor);
     }
 }
 
-void visitDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor* visitor)
+void visitDOMObjects(DOMWrapperMap<void>::Visitor* visitor)
 {
     v8::HandleScope scope;
 
-    WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
     DOMDataList& list = DOMDataStore::allStores();
     for (size_t i = 0; i < list.size(); ++i) {
         DOMDataStore* store = list[i];
-        if (!store->domData()->owningThread() == WTF::currentThread())
-            continue;
 
         store->domObjectMap().visit(store, visitor);
     }
 }
 
-void visitActiveDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor* visitor)
+void visitActiveDOMObjects(DOMWrapperMap<void>::Visitor* visitor)
 {
     v8::HandleScope scope;
 
-    WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
     DOMDataList& list = DOMDataStore::allStores();
     for (size_t i = 0; i < list.size(); ++i) {
         DOMDataStore* store = list[i];
-        if (!store->domData()->owningThread() == WTF::currentThread())
-            continue;
 
         store->activeDomObjectMap().visit(store, visitor);
     }
@@ -159,16 +144,13 @@
 
 #if ENABLE(SVG)
 
-void visitDOMSVGElementInstancesInCurrentThread(DOMWrapperMap<SVGElementInstance>::Visitor* visitor)
+void visitDOMSVGElementInstances(DOMWrapperMap<SVGElementInstance>::Visitor* visitor)
 {
     v8::HandleScope scope;
 
-    WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
     DOMDataList& list = DOMDataStore::allStores();
     for (size_t i = 0; i < list.size(); ++i) {
         DOMDataStore* store = list[i];
-        if (!store->domData()->owningThread() == WTF::currentThread())
-            continue;
 
         store->domSvgElementInstanceMap().visit(store, visitor);
     }

Modified: trunk/Source/WebCore/bindings/v8/V8DOMMap.h (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/V8DOMMap.h	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/V8DOMMap.h	2011-06-08 17:31:03 UTC (rev 88357)
@@ -158,23 +158,23 @@
 
     // A map from DOM node to its JS wrapper.
     DOMNodeMapping& getDOMNodeMap();
-    void visitDOMNodesInCurrentThread(DOMWrapperMap<Node>::Visitor*);
+    void visitDOMNodes(DOMWrapperMap<Node>::Visitor*);
 
     // A map from a DOM object (non-node) to its JS wrapper. This map does not contain the DOM objects which can have pending activity (active dom objects).
     DOMWrapperMap<void>& getDOMObjectMap();
-    void visitDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor*);
+    void visitDOMObjects(DOMWrapperMap<void>::Visitor*);
 
     // A map from a DOM object to its JS wrapper for DOM objects which can have pending activity.
     DOMWrapperMap<void>& getActiveDOMObjectMap();
-    void visitActiveDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor*);
+    void visitActiveDOMObjects(DOMWrapperMap<void>::Visitor*);
 
     // This should be called to remove all DOM objects associated with the current thread when it is tearing down.
-    void removeAllDOMObjectsInCurrentThread();
+    void removeAllDOMObjects();
 
 #if ENABLE(SVG)
     // A map for SVGElementInstances to its JS wrapper.
     DOMWrapperMap<SVGElementInstance>& getDOMSVGElementInstanceMap();
-    void visitSVGElementInstancesInCurrentThread(DOMWrapperMap<SVGElementInstance>::Visitor*);
+    void visitSVGElementInstances(DOMWrapperMap<SVGElementInstance>::Visitor*);
 #endif
 
     void enableFasterDOMStoreAccess();

Modified: trunk/Source/WebCore/bindings/v8/V8GCController.cpp (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/V8GCController.cpp	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/V8GCController.cpp	2011-06-08 17:31:03 UTC (rev 88357)
@@ -452,18 +452,18 @@
 
 #ifndef NDEBUG
     DOMObjectVisitor domObjectVisitor;
-    visitDOMObjectsInCurrentThread(&domObjectVisitor);
+    visitDOMObjects(&domObjectVisitor);
 #endif
 
     // Run through all objects with possible pending activity making their
     // wrappers non weak if there is pending activity.
     GCPrologueVisitor prologueVisitor;
-    visitActiveDOMObjectsInCurrentThread(&prologueVisitor);
+    visitActiveDOMObjects(&prologueVisitor);
 
     // Create object groups.
     GrouperVisitor grouperVisitor;
-    visitDOMNodesInCurrentThread(&grouperVisitor);
-    visitDOMObjectsInCurrentThread(&grouperVisitor);
+    visitDOMNodes(&grouperVisitor);
+    visitDOMObjects(&grouperVisitor);
     grouperVisitor.applyGrouping();
 
     // Clean single element cache for string conversions.
@@ -529,17 +529,17 @@
     // Run through all objects with pending activity making their wrappers weak
     // again.
     GCEpilogueVisitor epilogueVisitor;
-    visitActiveDOMObjectsInCurrentThread(&epilogueVisitor);
+    visitActiveDOMObjects(&epilogueVisitor);
 
     workingSetEstimateMB = getActualMemoryUsageInMB();
 
 #ifndef NDEBUG
     // Check all survivals are weak.
     DOMObjectVisitor domObjectVisitor;
-    visitDOMObjectsInCurrentThread(&domObjectVisitor);
+    visitDOMObjects(&domObjectVisitor);
 
     EnsureWeakDOMNodeVisitor weakDOMNodeVisitor;
-    visitDOMNodesInCurrentThread(&weakDOMNodeVisitor);
+    visitDOMNodes(&weakDOMNodeVisitor);
 
     enumerateGlobalHandles();
 #endif

Modified: trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp (88356 => 88357)


--- trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp	2011-06-08 17:27:13 UTC (rev 88356)
+++ trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp	2011-06-08 17:31:03 UTC (rev 88357)
@@ -58,7 +58,7 @@
 
 WorkerScriptController::~WorkerScriptController()
 {
-    removeAllDOMObjectsInCurrentThread();
+    removeAllDOMObjects();
 }
 
 ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to