[Threaded Compositor] Remove ThreadedCompositor::setNeedsDisplay()
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jun 2016 12:07:38 +0000 (12:07 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Jun 2016 12:07:38 +0000 (12:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158523

Reviewed by Michael Catanzaro.

ThreadedCompositor::setNeedsDisplay() is always called from the main thread and schedules a task to the
compositing thread to schedule an immediate update. But RunLoop::Timer is thread-safe so we don't really need to
schedule a task to the update the timer in the compositing thread, we can do that directly in the main
thread. And that's exactly what scheduleDisplayImmediately() does, so we can use it instead of setNeedsDisplay().

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::setNeedsDisplay(): Deleted.
(WebKit::ThreadedCompositor::updateSceneState):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h

index 2c46f24..2b624ab 100644 (file)
@@ -1,3 +1,20 @@
+2016-06-09  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [Threaded Compositor] Remove ThreadedCompositor::setNeedsDisplay()
+        https://bugs.webkit.org/show_bug.cgi?id=158523
+
+        Reviewed by Michael Catanzaro.
+
+        ThreadedCompositor::setNeedsDisplay() is always called from the main thread and schedules a task to the
+        compositing thread to schedule an immediate update. But RunLoop::Timer is thread-safe so we don't really need to
+        schedule a task to the update the timer in the compositing thread, we can do that directly in the main
+        thread. And that's exactly what scheduleDisplayImmediately() does, so we can use it instead of setNeedsDisplay().
+
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::setNeedsDisplay(): Deleted.
+        (WebKit::ThreadedCompositor::updateSceneState):
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+
 2016-06-08  Antti Koivisto  <antti@apple.com>
 
         Increase disk cache capacity when there is lots of free space
index dd2c67d..0850679 100644 (file)
@@ -61,14 +61,6 @@ ThreadedCompositor::~ThreadedCompositor()
     terminateCompositingThread();
 }
 
-void ThreadedCompositor::setNeedsDisplay()
-{
-    RefPtr<ThreadedCompositor> protector(this);
-    callOnCompositingThread([protector] {
-        protector->scheduleDisplayImmediately();
-    });
-}
-
 void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle)
 {
     RefPtr<ThreadedCompositor> protector(this);
@@ -221,7 +213,7 @@ void ThreadedCompositor::updateSceneState(const CoordinatedGraphicsState& state)
         scene->commitSceneState(state);
     });
 
-    setNeedsDisplay();
+    scheduleDisplayImmediately();
 }
 
 void ThreadedCompositor::callOnCompositingThread(std::function<void()>&& function)
index 3835252..7392560 100644 (file)
@@ -64,8 +64,6 @@ public:
     static Ref<ThreadedCompositor> create(Client*);
     virtual ~ThreadedCompositor();
 
-    void setNeedsDisplay();
-
     void setNativeSurfaceHandleForCompositing(uint64_t);
     void setDeviceScaleFactor(float);