[GTK][WPE][Nicosia] Add environment variable to enable threaded rendering and set...
authormagomez@igalia.com <magomez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jun 2018 12:05:19 +0000 (12:05 +0000)
committermagomez@igalia.com <magomez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jun 2018 12:05:19 +0000 (12:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186801

Reviewed by Carlos Garcia Campos.

Add and environment variable to enable the usage of the threaded renderer and define the number
of painting threads.

No new tests.

* platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
(Nicosia::PaintingEngine::create):
* platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
(Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
* platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngine.cpp
Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp
Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h

index 5a8027c..6738c9f 100644 (file)
@@ -1,3 +1,21 @@
+2018-06-19  Miguel Gomez  <magomez@igalia.com>
+
+        [GTK][WPE][Nicosia] Add environment variable to enable threaded rendering and set the number of painting threads
+        https://bugs.webkit.org/show_bug.cgi?id=186801
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add and environment variable to enable the usage of the threaded renderer and define the number
+        of painting threads.
+
+        No new tests.
+
+        * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
+        (Nicosia::PaintingEngine::create):
+        * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
+        (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
+        * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
+
 2018-06-19  Youenn Fablet  <youenn@apple.com>
 
         RTCRtpSender.replaceTrack(null) ends current track
index 6de3509..3bd9bf3 100644 (file)
 #include "NicosiaPaintingEngine.h"
 
 #include "NicosiaPaintingEngineBasic.h"
+#include "NicosiaPaintingEngineThreaded.h"
 
 namespace Nicosia {
 
 std::unique_ptr<PaintingEngine> PaintingEngine::create()
 {
+#if ENABLE(DEVELOPER_MODE)
+    if (const char* numThreadsEnv = getenv("WEBKIT_NICOSIA_PAINTING_THREADS")) {
+        unsigned numThreads = 0;
+        if (sscanf(numThreadsEnv, "%u", &numThreads) == 1) {
+            if (numThreads < 1 || numThreads > 8) {
+                WTFLogAlways("The number of Nicosia painting threads is not between 1 and 8. Using the default value 4\n");
+                numThreads = 4;
+            }
+
+            return std::unique_ptr<PaintingEngine>(new PaintingEngineThreaded(numThreads));
+        }
+    }
+#endif
+
     return std::unique_ptr<PaintingEngine>(new PaintingEngineBasic);
 }
 
index 760878b..609d1c3 100644 (file)
@@ -59,8 +59,8 @@ static void paintLayer(GraphicsContext& context, GraphicsLayer& layer, const Int
     context.restore();
 }
 
-PaintingEngineThreaded::PaintingEngineThreaded()
-    : m_workerPool(WorkerPool::create(4))
+PaintingEngineThreaded::PaintingEngineThreaded(unsigned numThreads)
+    : m_workerPool(WorkerPool::create(numThreads))
 {
 }
 
index f5580bb..f08055e 100644 (file)
@@ -37,7 +37,7 @@ namespace Nicosia {
 
 class PaintingEngineThreaded final : public PaintingEngine {
 public:
-    PaintingEngineThreaded();
+    explicit PaintingEngineThreaded(unsigned);
     virtual ~PaintingEngineThreaded();
 
 private: