[GTK][WPE][Nicosia] Add name for Nicosia Painting Threads
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Jun 2018 09:00:27 +0000 (09:00 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Jun 2018 09:00:27 +0000 (09:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186836

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Use "PaintingThread" name.

* platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
(Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):

Source/WTF:

AutomaticThread can take a name for the generated threads now.
This patch adds the above ability to WorkerPool.

* wtf/WorkerPool.cpp:
(WTF::WorkerPool::WorkerPool):
* wtf/WorkerPool.h:
(WTF::WorkerPool::create):
(WTF::WorkerPool::name const):

Tools:

* TestWebKitAPI/Tests/WTF/WorkerPool.cpp:
(TestWebKitAPI::TEST):

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

Source/WTF/ChangeLog
Source/WTF/wtf/WorkerPool.cpp
Source/WTF/wtf/WorkerPool.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/WorkerPool.cpp

index a9c791b..63c500a 100644 (file)
@@ -1,3 +1,19 @@
+2018-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [GTK][WPE][Nicosia] Add name for Nicosia Painting Threads
+        https://bugs.webkit.org/show_bug.cgi?id=186836
+
+        Reviewed by Carlos Garcia Campos.
+
+        AutomaticThread can take a name for the generated threads now.
+        This patch adds the above ability to WorkerPool.
+
+        * wtf/WorkerPool.cpp:
+        (WTF::WorkerPool::WorkerPool):
+        * wtf/WorkerPool.h:
+        (WTF::WorkerPool::create):
+        (WTF::WorkerPool::name const):
+
 2018-06-18  Jiewen Tan  <jiewen_tan@apple.com>
 
         Add a graceful exit for AuthenticationManager::initializeConnection
index 3ccb7a2..bdbdfc5 100644 (file)
@@ -75,7 +75,7 @@ public:
 
     const char* name() const override
     {
-        return "Worker Pool";
+        return m_pool.name();
     }
 
 private:
@@ -83,10 +83,11 @@ private:
     Function<void()> m_task;
 };
 
-WorkerPool::WorkerPool(unsigned numberOfWorkers, Seconds timeout)
+WorkerPool::WorkerPool(ASCIILiteral name, unsigned numberOfWorkers, Seconds timeout)
     : m_lock(Box<Lock>::create())
     , m_condition(AutomaticThreadCondition::create())
     , m_timeout(timeout)
+    , m_name(name)
 {
     LockHolder locker(*m_lock);
     for (unsigned i = 0; i < numberOfWorkers; ++i)
index b5f4d34..7676ac9 100644 (file)
@@ -30,6 +30,7 @@
 #include <wtf/Function.h>
 #include <wtf/NumberOfCores.h>
 #include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
 
 namespace WTF {
 
@@ -40,17 +41,19 @@ public:
     WTF_EXPORT_PRIVATE ~WorkerPool();
 
     // If timeout is infinity, it means AutomaticThread will be never automatically destroyed.
-    static Ref<WorkerPool> create(unsigned numberOfWorkers  = WTF::numberOfProcessorCores(), Seconds timeout = Seconds::infinity())
+    static Ref<WorkerPool> create(ASCIILiteral name, unsigned numberOfWorkers  = WTF::numberOfProcessorCores(), Seconds timeout = Seconds::infinity())
     {
         ASSERT(numberOfWorkers >= 1);
-        return adoptRef(*new WorkerPool(numberOfWorkers, timeout));
+        return adoptRef(*new WorkerPool(name, numberOfWorkers, timeout));
     }
 
+    ASCIILiteral name() const { return m_name; }
+
 private:
     class Worker;
     friend class Worker;
 
-    WTF_EXPORT_PRIVATE WorkerPool(unsigned numberOfWorkers, Seconds timeout);
+    WTF_EXPORT_PRIVATE WorkerPool(ASCIILiteral name, unsigned numberOfWorkers, Seconds timeout);
 
     bool shouldSleep(const AbstractLocker&);
 
@@ -61,6 +64,7 @@ private:
     unsigned m_numberOfActiveWorkers { 0 };
     Vector<Ref<Worker>> m_workers;
     Deque<Function<void()>> m_tasks;
+    ASCIILiteral m_name;
 };
 
 }
index 18ba925..8d2bd52 100644 (file)
@@ -1,3 +1,15 @@
+2018-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        [GTK][WPE][Nicosia] Add name for Nicosia Painting Threads
+        https://bugs.webkit.org/show_bug.cgi?id=186836
+
+        Reviewed by Carlos Garcia Campos.
+
+        Use "PaintingThread" name.
+
+        * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
+        (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
+
 2018-06-19  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Make imported/mozilla/css-animations/test_pseudoElement-get-animations.html pass reliably
index 609d1c3..d24b7c2 100644 (file)
@@ -60,7 +60,7 @@ static void paintLayer(GraphicsContext& context, GraphicsLayer& layer, const Int
 }
 
 PaintingEngineThreaded::PaintingEngineThreaded(unsigned numThreads)
-    : m_workerPool(WorkerPool::create(numThreads))
+    : m_workerPool(WorkerPool::create(ASCIILiteral("PaintingThread"), numThreads))
 {
 }
 
index 0aedfb7..102d32e 100644 (file)
@@ -1,5 +1,15 @@
 2018-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
 
+        [GTK][WPE][Nicosia] Add name for Nicosia Painting Threads
+        https://bugs.webkit.org/show_bug.cgi?id=186836
+
+        Reviewed by Carlos Garcia Campos.
+
+        * TestWebKitAPI/Tests/WTF/WorkerPool.cpp:
+        (TestWebKitAPI::TEST):
+
+2018-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
+
         [WPE] Remove warnings by setting nullptr for unused listeners
         https://bugs.webkit.org/show_bug.cgi?id=186835
 
index f98e28a..3f9b74e 100644 (file)
@@ -36,7 +36,7 @@ TEST(WTF, WorkerPoolDecrease)
 {
     std::atomic<unsigned> counter { 0 };
     {
-        Ref<WorkerPool> pool = WorkerPool::create();
+        Ref<WorkerPool> pool = WorkerPool::create(ASCIILiteral("Worker Pool"));
         for (int i = 0; i < 10000; ++i) {
             pool->postTask([&] {
                 ++counter;