Title: [115665] trunk/Source/WebCore
- Revision
- 115665
- Author
- [email protected]
- Date
- 2012-04-30 14:10:21 -0700 (Mon, 30 Apr 2012)
Log Message
Add a barrier-style dispatch member function to ScrollingThread
https://bugs.webkit.org/show_bug.cgi?id=85228
Reviewed by Sam Weinig.
Add a ScrollingThread::dispatchBarrier function which takes a WTF::Function and dispatches it to the main thread
once all the currently scheduled scrolling thread functions have run. This is to be used for synchronization between the
scrolling thread and the main thread.
* page/scrolling/ScrollingThread.cpp:
(WebCore::callFunctionOnMainThread):
(WebCore):
(WebCore::ScrollingThread::dispatchBarrier):
* page/scrolling/ScrollingThread.h:
(ScrollingThread):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (115664 => 115665)
--- trunk/Source/WebCore/ChangeLog 2012-04-30 21:04:04 UTC (rev 115664)
+++ trunk/Source/WebCore/ChangeLog 2012-04-30 21:10:21 UTC (rev 115665)
@@ -1,3 +1,21 @@
+2012-04-30 Anders Carlsson <[email protected]>
+
+ Add a barrier-style dispatch member function to ScrollingThread
+ https://bugs.webkit.org/show_bug.cgi?id=85228
+
+ Reviewed by Sam Weinig.
+
+ Add a ScrollingThread::dispatchBarrier function which takes a WTF::Function and dispatches it to the main thread
+ once all the currently scheduled scrolling thread functions have run. This is to be used for synchronization between the
+ scrolling thread and the main thread.
+
+ * page/scrolling/ScrollingThread.cpp:
+ (WebCore::callFunctionOnMainThread):
+ (WebCore):
+ (WebCore::ScrollingThread::dispatchBarrier):
+ * page/scrolling/ScrollingThread.h:
+ (ScrollingThread):
+
2012-04-30 Min Qin <[email protected]>
Expose a flag so that fullscreen video on android can work with FULLSCREEN_API
Modified: trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp (115664 => 115665)
--- trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp 2012-04-30 21:04:04 UTC (rev 115664)
+++ trunk/Source/WebCore/page/scrolling/ScrollingThread.cpp 2012-04-30 21:10:21 UTC (rev 115665)
@@ -28,6 +28,8 @@
#if ENABLE(THREADED_SCROLLING)
+#include <wtf/MainThread.h>
+
namespace WebCore {
ScrollingThread::ScrollingThread()
@@ -55,6 +57,17 @@
shared().wakeUpRunLoop();
}
+static void callFunctionOnMainThread(const Function<void()>* function)
+{
+ callOnMainThread(*function);
+ delete function;
+}
+
+void ScrollingThread::dispatchBarrier(const Function<void()>& function)
+{
+ dispatch(bind(callFunctionOnMainThread, new Function<void()>(function)));
+}
+
ScrollingThread& ScrollingThread::shared()
{
DEFINE_STATIC_LOCAL(ScrollingThread, scrollingThread, ());
Modified: trunk/Source/WebCore/page/scrolling/ScrollingThread.h (115664 => 115665)
--- trunk/Source/WebCore/page/scrolling/ScrollingThread.h 2012-04-30 21:04:04 UTC (rev 115664)
+++ trunk/Source/WebCore/page/scrolling/ScrollingThread.h 2012-04-30 21:10:21 UTC (rev 115665)
@@ -46,6 +46,10 @@
static bool isCurrentThread();
static void dispatch(const Function<void()>&);
+ // Will dispatch the given function on the main thread once all pending functions
+ // on the scrolling thread have finished executing. Used for synchronization purposes.
+ static void dispatchBarrier(const Function<void()>&);
+
private:
ScrollingThread();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes