Diff
Modified: trunk/Source/WebCore/ChangeLog (88220 => 88221)
--- trunk/Source/WebCore/ChangeLog 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/ChangeLog 2011-06-07 06:19:10 UTC (rev 88221)
@@ -1,3 +1,47 @@
+2011-06-06 Dmitry Lomov <[email protected]>
+
+ 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:
+ * 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::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-06 Nico Weber <[email protected]>
Reviewed by Adam Barth.
Modified: trunk/Source/WebCore/WebCore.gypi (88220 => 88221)
--- trunk/Source/WebCore/WebCore.gypi 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/WebCore.gypi 2011-06-07 06:19:10 UTC (rev 88221)
@@ -1951,8 +1951,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',
@@ -1968,8 +1966,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',
Deleted: trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.cpp (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.cpp 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.cpp 2011-06-07 06:19:10 UTC (rev 88221)
@@ -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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.h 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/ChildThreadDOMData.h 2011-06-07 06:19:10 UTC (rev 88221)
@@ -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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/DOMData.cpp 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/DOMData.cpp 2011-06-07 06:19:10 UTC (rev 88221)
@@ -30,17 +30,16 @@
#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)
{
+ ASSERT(WTF::isMainThread());
}
DOMData::~DOMData()
@@ -49,11 +48,21 @@
DOMData* DOMData::getCurrent()
{
- if (WTF::isMainThread())
- return MainThreadDOMData::getCurrent();
+ ASSERT(WTF::isMainThread());
+ 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.
+ ASSERT(WTF::isMainThread());
+ V8IsolatedContext* context = V8IsolatedContext::getEntered();
+ if (UNLIKELY(context != 0))
+ return *context->world()->domDataStore();
+ return m_defaultStore;
}
void DOMData::derefObject(WrapperTypeInfo* type, void* domObject)
@@ -61,4 +70,6 @@
type->derefObject(domObject);
}
+
+
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/DOMData.h (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/DOMData.h 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/DOMData.h 2011-06-07 06:19:10 UTC (rev 88221)
@@ -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,18 +75,19 @@
}
};
- ThreadIdentifier m_owningThread;
+ DOMDataStore& getMainThreadStore();
+ StaticDOMDataStore m_defaultStore;
};
template<typename T>
void DOMData::handleWeakObject(DOMDataStore::DOMWrapperMapType mapType, v8::Persistent<v8::Object> v8Object, T* domObject)
{
+ ASSERT(WTF::isMainThread());
WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(v8Object);
DOMDataList& list = DOMDataStore::allStores();
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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/DOMDataStore.cpp 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/DOMDataStore.cpp 2011-06-07 06:19:10 UTC (rev 88221)
@@ -61,27 +61,10 @@
// object groups in GC prologue callbacks. The mark-compact
// collector will remove these groups after each GC.
//
-// DOM objects should be deref-ed from the owning thread, not the GC thread
-// that does not own them. In V8, GC can kick in from any thread. To ensure
-// that DOM objects are always deref-ed from the owning thread when running
-// V8 in multi-threading environment, we do following:
-// 1. Maintain a thread specific DOM wrapper map for each object map.
-// (We're using TLS support from WTF instead of base since V8Bindings
-// does not depend on base. We further assume that all child threads
-// running V8 instances are created by WTF and thus a destructor will
-// be called to clean up all thread specific data.)
-// 2. When GC happens:
-// 2.1. If the dead object is in GC thread's map, remove the JS reference
-// and deref the DOM object.
-// 2.2. Otherwise, go through all thread maps to find the owning thread.
-// Remove the JS reference from the owning thread's map and move the
-// DOM object to a delayed queue. Post a task to the owning thread
-// to have it deref-ed from the owning thread at later time.
-// 3. When a thread is tearing down, invoke a cleanup routine to go through
-// all objects in the delayed queue and the thread map and deref all of
-// them.
+// DOM objects are accessed and deref-ed from the main thread. All V8 accesses
+// to DOM objects happen on the main thread.
+// When GC happens, we remove the JS reference and deref the DOM object.
-
DOMDataStore::DOMDataStore(DOMData* domData)
: m_domNodeMap(0)
, m_domObjectMap(0)
@@ -91,13 +74,13 @@
#endif
, m_domData(domData)
{
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
+ ASSERT(WTF::isMainThread());
DOMDataStore::allStores().append(this);
}
DOMDataStore::~DOMDataStore()
{
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
+ ASSERT(WTF::isMainThread());
DOMDataStore::allStores().remove(DOMDataStore::allStores().find(this));
}
@@ -107,12 +90,6 @@
return staticDOMDataList;
}
-WTF::Mutex& DOMDataStore::allStoresMutex()
-{
- DEFINE_STATIC_LOCAL(WTF::Mutex, staticDOMDataListMutex, ());
- return staticDOMDataListMutex;
-}
-
void* DOMDataStore::getDOMWrapperMap(DOMWrapperMapType type)
{
switch (type) {
@@ -156,12 +133,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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/DOMDataStore.h 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/DOMDataStore.h 2011-06-07 06:19:10 UTC (rev 88221)
@@ -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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/MainThreadDOMData.cpp 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/MainThreadDOMData.cpp 2011-06-07 06:19:10 UTC (rev 88221)
@@ -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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/MainThreadDOMData.h 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/MainThreadDOMData.h 2011-06-07 06:19:10 UTC (rev 88221)
@@ -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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/V8DOMMap.cpp 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/V8DOMMap.cpp 2011-06-07 06:19:10 UTC (rev 88221)
@@ -33,7 +33,6 @@
#include "DOMData.h"
#include "DOMDataStore.h"
-#include "MainThreadDOMData.h"
#include "ScopedDOMDataStore.h"
namespace WebCore {
@@ -51,12 +50,8 @@
static inline DOMDataStore& getDOMDataStore()
{
- if (LIKELY(fasterDOMStoreAccess)) {
- ASSERT(WTF::isMainThread());
- return MainThreadDOMData::getCurrentMainThreadStore();
- }
-
- return DOMData::getCurrent()->getStore();
+ ASSERT(WTF::isMainThread());
+ return DOMData::getCurrentMainThreadStore();
}
void enableFasterDOMStoreAccess()
@@ -112,46 +107,40 @@
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());
+ ASSERT(WTF::isMainThread());
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());
+ ASSERT(WTF::isMainThread());
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());
+ ASSERT(WTF::isMainThread());
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 +148,14 @@
#if ENABLE(SVG)
-void visitDOMSVGElementInstancesInCurrentThread(DOMWrapperMap<SVGElementInstance>::Visitor* visitor)
+void visitDOMSVGElementInstances(DOMWrapperMap<SVGElementInstance>::Visitor* visitor)
{
v8::HandleScope scope;
- WTF::MutexLocker locker(DOMDataStore::allStoresMutex());
+ ASSERT(WTF::isMainThread());
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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/V8DOMMap.h 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/V8DOMMap.h 2011-06-07 06:19:10 UTC (rev 88221)
@@ -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 (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/V8GCController.cpp 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/V8GCController.cpp 2011-06-07 06:19:10 UTC (rev 88221)
@@ -458,12 +458,12 @@
// 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,7 +529,7 @@
// Run through all objects with pending activity making their wrappers weak
// again.
GCEpilogueVisitor epilogueVisitor;
- visitActiveDOMObjectsInCurrentThread(&epilogueVisitor);
+ visitActiveDOMObjects(&epilogueVisitor);
workingSetEstimateMB = getActualMemoryUsageInMB();
@@ -539,7 +539,7 @@
visitDOMObjectsInCurrentThread(&domObjectVisitor);
EnsureWeakDOMNodeVisitor weakDOMNodeVisitor;
- visitDOMNodesInCurrentThread(&weakDOMNodeVisitor);
+ visitDOMNodes(&weakDOMNodeVisitor);
enumerateGlobalHandles();
#endif
Modified: trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp (88220 => 88221)
--- trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp 2011-06-07 06:11:06 UTC (rev 88220)
+++ trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp 2011-06-07 06:19:10 UTC (rev 88221)
@@ -58,7 +58,7 @@
WorkerScriptController::~WorkerScriptController()
{
- removeAllDOMObjectsInCurrentThread();
+ removeAllDOMObjects();
}
ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode)