Remove unused ThreadSpecificInspectorCounters.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Feb 2014 23:17:08 +0000 (23:17 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Feb 2014 23:17:08 +0000 (23:17 +0000)
<https://webkit.org/b/129337>

We were keeping count of all the JS event listeners in every thread
to support an old Chromium feature that's no longer relevant.

Removing this gets rid of expensive thread-local storage lookups.

Reviewed by Anders Carlsson.

* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::JSEventListener):
(WebCore::JSEventListener::~JSEventListener):
* inspector/InspectorCounters.cpp:
* inspector/InspectorCounters.h:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::setDOMCounters):
* inspector/protocol/Timeline.json:
* platform/ThreadGlobalData.cpp:
(WebCore::ThreadGlobalData::ThreadGlobalData):
(WebCore::ThreadGlobalData::destroy):
* platform/ThreadGlobalData.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164677 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSEventListener.cpp
Source/WebCore/inspector/InspectorCounters.cpp
Source/WebCore/inspector/InspectorCounters.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/protocol/Timeline.json
Source/WebCore/platform/ThreadGlobalData.cpp
Source/WebCore/platform/ThreadGlobalData.h

index ec1a6bf1a0d5bce321c72796c8971c1f1af6a118..f19ef24e69f00a09b97b389bd4b4bbe0f54d724b 100644 (file)
@@ -1,3 +1,28 @@
+2014-02-25  Andreas Kling  <akling@apple.com>
+
+        Remove unused ThreadSpecificInspectorCounters.
+        <https://webkit.org/b/129337>
+
+        We were keeping count of all the JS event listeners in every thread
+        to support an old Chromium feature that's no longer relevant.
+
+        Removing this gets rid of expensive thread-local storage lookups.
+
+        Reviewed by Anders Carlsson.
+
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSEventListener::JSEventListener):
+        (WebCore::JSEventListener::~JSEventListener):
+        * inspector/InspectorCounters.cpp:
+        * inspector/InspectorCounters.h:
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::setDOMCounters):
+        * inspector/protocol/Timeline.json:
+        * platform/ThreadGlobalData.cpp:
+        (WebCore::ThreadGlobalData::ThreadGlobalData):
+        (WebCore::ThreadGlobalData::destroy):
+        * platform/ThreadGlobalData.h:
+
 2014-02-25  Laszlo Vidacs  <lvidacs.u-szeged@partner.samsung.com>
 
         display:table with padding and/or borders in border-box calculates height incorrectly
index 9a4bf000b5d49658ea2efdc52b5ad45ab101b484..4d3f1f0144bb819c4830b10510dfa0746f67fe36 100644 (file)
@@ -51,16 +51,10 @@ JSEventListener::JSEventListener(JSObject* function, JSObject* wrapper, bool isA
         m_jsFunction = JSC::Weak<JSC::JSObject>(function);
     } else
         ASSERT(!function);
-#if ENABLE(INSPECTOR)
-    ThreadLocalInspectorCounters::current().incrementCounter(ThreadLocalInspectorCounters::JSEventListenerCounter);
-#endif
 }
 
 JSEventListener::~JSEventListener()
 {
-#if ENABLE(INSPECTOR)
-    ThreadLocalInspectorCounters::current().decrementCounter(ThreadLocalInspectorCounters::JSEventListenerCounter);
-#endif
 }
 
 JSObject* JSEventListener::initializeJSFunction(ScriptExecutionContext*) const
index 6f85f876241d1d9ff3502b923bbaa4cab56821ba..6078734c9d7b3d0b010f892e70d8a93df911284c 100644 (file)
@@ -34,8 +34,6 @@
 
 #include "InspectorCounters.h"
 
-#include "ThreadGlobalData.h"
-
 namespace WebCore {
 
 int InspectorCounters::s_counters[CounterTypeLength];
@@ -45,22 +43,6 @@ int InspectorCounters::counterValue(CounterType type)
     return s_counters[type];
 }
 
-ThreadLocalInspectorCounters::ThreadLocalInspectorCounters()
-{
-    for (size_t i = 0; i < CounterTypeLength; i++)
-        m_counters[i] = 0;
-}
-
-int ThreadLocalInspectorCounters::counterValue(CounterType type)
-{
-    return m_counters[type];
-}
-
-ThreadLocalInspectorCounters& ThreadLocalInspectorCounters::current()
-{
-    return threadGlobalData().inspectorCounters();
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index 29bd1bd62de8fddb1790c202d50633b1579cbd28..e216c1c2c0cc1dcf8b3e6bfd838acc2c1a65156e 100644 (file)
@@ -83,36 +83,6 @@ private:
 #endif
 };
 
-
-#if ENABLE(INSPECTOR)
-class ThreadLocalInspectorCounters {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    enum CounterType {
-        JSEventListenerCounter,
-        CounterTypeLength
-    };
-    ThreadLocalInspectorCounters();
-
-    inline void incrementCounter(CounterType type)
-    {
-        ++m_counters[type];
-    }
-
-    inline void decrementCounter(CounterType type)
-    {
-        --m_counters[type];
-    }
-
-    int counterValue(CounterType);
-
-    static ThreadLocalInspectorCounters& current();
-
-private:
-    int m_counters[CounterTypeLength];
-};
-#endif
-
 } // namespace WebCore
 
 #endif // !defined(InspectorCounters_h)
index 77bade78c919489545eafaeacc922a3f59d7ee97..eaf4aac726fbe0bdeef14c18150dd39c35a2e0dc 100644 (file)
@@ -582,11 +582,9 @@ void InspectorTimelineAgent::setDOMCounters(Inspector::TypeBuilder::Timeline::Ti
             documentCount = InspectorCounters::counterValue(InspectorCounters::DocumentCounter);
             nodeCount = InspectorCounters::counterValue(InspectorCounters::NodeCounter);
         }
-        int listenerCount = ThreadLocalInspectorCounters::current().counterValue(ThreadLocalInspectorCounters::JSEventListenerCounter);
         RefPtr<Inspector::TypeBuilder::Timeline::DOMCounters> counters = Inspector::TypeBuilder::Timeline::DOMCounters::create()
             .setDocuments(documentCount)
-            .setNodes(nodeCount)
-            .setJsEventListeners(listenerCount);
+            .setNodes(nodeCount);
         record->setCounters(counters.release());
     }
 }
index f8f07944b5ab72b086dd8b8ac765ee6520ed2bc1..ae4c2a36ce749150a5b29551b6a980f74e50b346 100644 (file)
@@ -7,8 +7,7 @@
             "type": "object",
             "properties": [
                 { "name": "documents", "type": "integer" },
-                { "name": "nodes", "type": "integer" },
-                { "name": "jsEventListeners", "type": "integer" }
+                { "name": "nodes", "type": "integer" }
             ],
             "description": "Current values of DOM counters."
         },
index 9a709e7c128c67ce59b71631c19f7636f9642a97..57e5158144a5fbe9f0c317aff3e0a4ab0b822ea6 100644 (file)
@@ -67,9 +67,6 @@ ThreadGlobalData::ThreadGlobalData()
 #if PLATFORM(MAC)
     , m_cachedConverterTEC(adoptPtr(new TECConverterWrapper))
 #endif
-#if ENABLE(INSPECTOR)
-    , m_inspectorCounters(adoptPtr(new ThreadLocalInspectorCounters()))
-#endif
 {
     // This constructor will have been called on the main thread before being called on
     // any other thread, and is only called once per thread - this makes this a convenient
@@ -91,10 +88,6 @@ void ThreadGlobalData::destroy()
 
     m_cachedConverterICU.clear();
 
-#if ENABLE(INSPECTOR)
-    m_inspectorCounters.clear();
-#endif
-
 #if ENABLE(WEB_REPLAY)
     m_inputTypes = nullptr;
 #endif
index dd22a339cd677e8113b748773ac80a5a0ffd0dc8..539e34db01f30841970f985c114a8822e78807be 100644 (file)
@@ -41,7 +41,6 @@ namespace WebCore {
 
     class EventNames;
     class ReplayInputTypes;
-    class ThreadLocalInspectorCounters;
     class ThreadTimers;
 
     struct CachedResourceRequestInitiators;
@@ -72,10 +71,6 @@ namespace WebCore {
         void setWebCoreThreadData();
 #endif
 
-#if ENABLE(INSPECTOR)
-        ThreadLocalInspectorCounters& inspectorCounters() { return *m_inspectorCounters; }
-#endif
-
     private:
         OwnPtr<CachedResourceRequestInitiators> m_cachedResourceRequestInitiators;
         OwnPtr<EventNames> m_eventNames;
@@ -95,10 +90,6 @@ namespace WebCore {
         OwnPtr<TECConverterWrapper> m_cachedConverterTEC;
 #endif
 
-#if ENABLE(INSPECTOR)
-        OwnPtr<ThreadLocalInspectorCounters> m_inspectorCounters;
-#endif
-
         static ThreadSpecific<ThreadGlobalData>* staticData;
 #if USE(WEB_THREAD)
         static ThreadGlobalData* sharedMainThreadStaticData;