<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213858] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213858">213858</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2017-03-13 11:56:54 -0700 (Mon, 13 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WTF] Clean up RunLoop and WorkQueue with Seconds and Function
https://bugs.webkit.org/show_bug.cgi?id=169537
Reviewed by Sam Weinig.
Source/JavaScriptCore:
* runtime/Watchdog.cpp:
(JSC::Watchdog::startTimer):
Source/WebKit2:
* Shared/ChildProcess.cpp:
(WebKit::didCloseOnConnectionWorkQueue):
* UIProcess/Storage/LocalStorageDatabase.cpp:
* WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:
(WebKit::AcceleratedSurfaceX11::resize):
Source/WTF:
This patch modernizes RunLoop and WorkQueue.
1. Use Ref<> aggressively
2. Use Seconds instead of chrono times
3. Use Function<> instead of std::function
* wtf/MainThread.cpp:
(WTF::dispatchFunctionsFromMainThread):
* wtf/RunLoop.h:
* wtf/WorkQueue.h:
* wtf/cocoa/WorkQueueCocoa.cpp:
(WTF::WorkQueue::dispatch):
(WTF::WorkQueue::dispatchAfter):
(WTF::WorkQueue::concurrentApply):
* wtf/generic/MainThreadGeneric.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::TimerBase::ScheduledTask::create):
(WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
(WTF::RunLoop::populateTasks):
(WTF::RunLoop::runImpl):
(WTF::RunLoop::schedule):
(WTF::RunLoop::scheduleAndWakeUp):
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::start):
* wtf/generic/WorkQueueGeneric.cpp:
(WorkQueue::dispatch):
(WorkQueue::dispatchAfter):
* wtf/glib/RunLoopGLib.cpp:
(WTF::DispatchAfterContext::DispatchAfterContext):
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::updateReadyTime):
(WTF::RunLoop::TimerBase::start):
* wtf/win/WorkQueueWin.cpp:
(WTF::WorkQueue::performWorkOnRegisteredWorkThread):
(WTF::WorkQueue::dispatch):
(WTF::WorkQueue::dispatchAfter):
Tools:
* TestWebKitAPI/Tests/WTF/WorkQueue.cpp:
(TestWebKitAPI::TEST):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeWatchdogcpp">trunk/Source/JavaScriptCore/runtime/Watchdog.cpp</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfMainThreadcpp">trunk/Source/WTF/wtf/MainThread.cpp</a></li>
<li><a href="#trunkSourceWTFwtfRunLooph">trunk/Source/WTF/wtf/RunLoop.h</a></li>
<li><a href="#trunkSourceWTFwtfWorkQueueh">trunk/Source/WTF/wtf/WorkQueue.h</a></li>
<li><a href="#trunkSourceWTFwtfcocoaWorkQueueCocoacpp">trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp</a></li>
<li><a href="#trunkSourceWTFwtfgenericMainThreadGenericcpp">trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp</a></li>
<li><a href="#trunkSourceWTFwtfgenericRunLoopGenericcpp">trunk/Source/WTF/wtf/generic/RunLoopGeneric.cpp</a></li>
<li><a href="#trunkSourceWTFwtfgenericWorkQueueGenericcpp">trunk/Source/WTF/wtf/generic/WorkQueueGeneric.cpp</a></li>
<li><a href="#trunkSourceWTFwtfglibRunLoopGLibcpp">trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp</a></li>
<li><a href="#trunkSourceWTFwtfwinWorkQueueWincpp">trunk/Source/WTF/wtf/win/WorkQueueWin.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedChildProcesscpp">trunk/Source/WebKit2/Shared/ChildProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessStorageLocalStorageDatabasecpp">trunk/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagegtkAcceleratedSurfaceX11cpp">trunk/Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFWorkQueuecpp">trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-03-13 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
+ https://bugs.webkit.org/show_bug.cgi?id=169537
+
+ Reviewed by Sam Weinig.
+
+ * runtime/Watchdog.cpp:
+ (JSC::Watchdog::startTimer):
+
</ins><span class="cx"> 2017-03-11 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> FTL should not flush strict arguments unless it really needs to
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeWatchdogcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Watchdog.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Watchdog.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/JavaScriptCore/runtime/Watchdog.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -158,7 +158,7 @@
</span><span class="cx"> // So, we always need to null check m_vm before using it. The VM will notify the Watchdog
</span><span class="cx"> // via willDestroyVM() before it goes away.
</span><span class="cx"> RefPtr<Watchdog> protectedThis = this;
</span><del>- m_timerQueue->dispatchAfter(std::chrono::nanoseconds(timeLimit), [this, protectedThis] {
</del><ins>+ m_timerQueue->dispatchAfter(Seconds::fromMicroseconds(timeLimit.count()), [this, protectedThis] {
</ins><span class="cx"> LockHolder locker(m_lock);
</span><span class="cx"> if (m_vm)
</span><span class="cx"> m_vm->notifyNeedWatchdogCheck();
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/ChangeLog        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2017-03-13 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
+ https://bugs.webkit.org/show_bug.cgi?id=169537
+
+ Reviewed by Sam Weinig.
+
+ This patch modernizes RunLoop and WorkQueue.
+
+ 1. Use Ref<> aggressively
+ 2. Use Seconds instead of chrono times
+ 3. Use Function<> instead of std::function
+
+ * wtf/MainThread.cpp:
+ (WTF::dispatchFunctionsFromMainThread):
+ * wtf/RunLoop.h:
+ * wtf/WorkQueue.h:
+ * wtf/cocoa/WorkQueueCocoa.cpp:
+ (WTF::WorkQueue::dispatch):
+ (WTF::WorkQueue::dispatchAfter):
+ (WTF::WorkQueue::concurrentApply):
+ * wtf/generic/MainThreadGeneric.cpp:
+ (WTF::scheduleDispatchFunctionsOnMainThread):
+ * wtf/generic/RunLoopGeneric.cpp:
+ (WTF::RunLoop::TimerBase::ScheduledTask::create):
+ (WTF::RunLoop::TimerBase::ScheduledTask::EarliestSchedule::operator()):
+ (WTF::RunLoop::populateTasks):
+ (WTF::RunLoop::runImpl):
+ (WTF::RunLoop::schedule):
+ (WTF::RunLoop::scheduleAndWakeUp):
+ (WTF::RunLoop::dispatchAfter):
+ (WTF::RunLoop::TimerBase::start):
+ * wtf/generic/WorkQueueGeneric.cpp:
+ (WorkQueue::dispatch):
+ (WorkQueue::dispatchAfter):
+ * wtf/glib/RunLoopGLib.cpp:
+ (WTF::DispatchAfterContext::DispatchAfterContext):
+ (WTF::RunLoop::dispatchAfter):
+ (WTF::RunLoop::TimerBase::updateReadyTime):
+ (WTF::RunLoop::TimerBase::start):
+ * wtf/win/WorkQueueWin.cpp:
+ (WTF::WorkQueue::performWorkOnRegisteredWorkThread):
+ (WTF::WorkQueue::dispatch):
+ (WTF::WorkQueue::dispatchAfter):
+
</ins><span class="cx"> 2017-03-13 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> [WK2] Only report background WebProcesses as unresponsive in the background after 90 seconds
</span></span></pre></div>
<a id="trunkSourceWTFwtfMainThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/MainThread.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/MainThread.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/MainThread.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // 0.1 sec delays in UI is approximate threshold when they become noticeable. Have a limit that's half of that.
</span><del>-static const auto maxRunLoopSuspensionTime = std::chrono::milliseconds(50);
</del><ins>+static const auto maxRunLoopSuspensionTime = 50_ms;
</ins><span class="cx">
</span><span class="cx"> void dispatchFunctionsFromMainThread()
</span><span class="cx"> {
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx"> if (callbacksPaused)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- auto startTime = std::chrono::steady_clock::now();
</del><ins>+ auto startTime = MonotonicTime::now();
</ins><span class="cx">
</span><span class="cx"> Function<void ()> function;
</span><span class="cx">
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx"> // yield so the user input can be processed. Otherwise user may not be able to even close the window.
</span><span class="cx"> // This code has effect only in case the scheduleDispatchFunctionsOnMainThread() is implemented in a way that
</span><span class="cx"> // allows input events to be processed before we are back here.
</span><del>- if (std::chrono::steady_clock::now() - startTime > maxRunLoopSuspensionTime) {
</del><ins>+ if (MonotonicTime::now() - startTime > maxRunLoopSuspensionTime) {
</ins><span class="cx"> scheduleDispatchFunctionsOnMainThread();
</span><span class="cx"> break;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWTFwtfRunLooph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/RunLoop.h (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/RunLoop.h        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/RunLoop.h        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #include <wtf/FunctionDispatcher.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><ins>+#include <wtf/Seconds.h>
</ins><span class="cx"> #include <wtf/Threading.h>
</span><span class="cx">
</span><span class="cx"> #if USE(GLIB_EVENT_LOOP)
</span><span class="lines">@@ -54,7 +55,7 @@
</span><span class="cx"> WTF_EXPORT_PRIVATE static bool isMain();
</span><span class="cx"> ~RunLoop();
</span><span class="cx">
</span><del>- void dispatch(Function<void ()>&&) override;
</del><ins>+ void dispatch(Function<void()>&&) override;
</ins><span class="cx">
</span><span class="cx"> WTF_EXPORT_PRIVATE static void run();
</span><span class="cx"> WTF_EXPORT_PRIVATE void stop();
</span><span class="lines">@@ -74,7 +75,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if USE(GLIB_EVENT_LOOP) || USE(GENERIC_EVENT_LOOP)
</span><del>- WTF_EXPORT_PRIVATE void dispatchAfter(std::chrono::nanoseconds, Function<void ()>&&);
</del><ins>+ WTF_EXPORT_PRIVATE void dispatchAfter(Seconds, Function<void()>&&);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> class TimerBase {
</span><span class="lines">@@ -115,7 +116,7 @@
</span><span class="cx"> void updateReadyTime();
</span><span class="cx"> GRefPtr<GSource> m_source;
</span><span class="cx"> bool m_isRepeating { false };
</span><del>- std::chrono::microseconds m_fireInterval { 0 };
</del><ins>+ Seconds m_fireInterval { 0 };
</ins><span class="cx"> #elif USE(GENERIC_EVENT_LOOP)
</span><span class="cx"> class ScheduledTask;
</span><span class="cx"> RefPtr<ScheduledTask> m_scheduledTask;
</span><span class="lines">@@ -149,7 +150,7 @@
</span><span class="cx"> void performWork();
</span><span class="cx">
</span><span class="cx"> Mutex m_functionQueueLock;
</span><del>- Deque<Function<void ()>> m_functionQueue;
</del><ins>+ Deque<Function<void()>> m_functionQueue;
</ins><span class="cx">
</span><span class="cx"> #if USE(WINDOWS_EVENT_LOOP)
</span><span class="cx"> static bool registerRunLoopMessageWindowClass();
</span><span class="lines">@@ -168,10 +169,10 @@
</span><span class="cx"> Vector<GRefPtr<GMainLoop>> m_mainLoops;
</span><span class="cx"> GRefPtr<GSource> m_source;
</span><span class="cx"> #elif USE(GENERIC_EVENT_LOOP)
</span><del>- void schedule(RefPtr<TimerBase::ScheduledTask>&&);
- void schedule(const AbstractLocker&, RefPtr<TimerBase::ScheduledTask>&&);
</del><ins>+ void schedule(Ref<TimerBase::ScheduledTask>&&);
+ void schedule(const AbstractLocker&, Ref<TimerBase::ScheduledTask>&&);
</ins><span class="cx"> void wakeUp(const AbstractLocker&);
</span><del>- void scheduleAndWakeUp(RefPtr<TimerBase::ScheduledTask>);
</del><ins>+ void scheduleAndWakeUp(Ref<TimerBase::ScheduledTask>&&);
</ins><span class="cx">
</span><span class="cx"> enum class RunMode {
</span><span class="cx"> Iterate,
</span><span class="lines">@@ -183,12 +184,12 @@
</span><span class="cx"> Stopping,
</span><span class="cx"> };
</span><span class="cx"> void runImpl(RunMode);
</span><del>- bool populateTasks(RunMode, Status&, Deque<RefPtr<TimerBase::ScheduledTask>>&);
</del><ins>+ bool populateTasks(RunMode, Status&, Deque<Ref<TimerBase::ScheduledTask>>&);
</ins><span class="cx">
</span><span class="cx"> Lock m_loopLock;
</span><span class="cx"> Condition m_readyToRun;
</span><span class="cx"> Condition m_stopCondition;
</span><del>- Vector<RefPtr<TimerBase::ScheduledTask>> m_schedules;
</del><ins>+ Vector<Ref<TimerBase::ScheduledTask>> m_schedules;
</ins><span class="cx"> Vector<Status*> m_mainLoops;
</span><span class="cx"> bool m_shutdown { false };
</span><span class="cx"> bool m_pendingTasks { false };
</span></span></pre></div>
<a id="trunkSourceWTFwtfWorkQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/WorkQueue.h (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/WorkQueue.h        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/WorkQueue.h        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -27,11 +27,11 @@
</span><span class="cx"> #ifndef WorkQueue_h
</span><span class="cx"> #define WorkQueue_h
</span><span class="cx">
</span><del>-#include <chrono>
</del><span class="cx"> #include <functional>
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/FunctionDispatcher.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><ins>+#include <wtf/Seconds.h>
</ins><span class="cx"> #include <wtf/Threading.h>
</span><span class="cx">
</span><span class="cx"> #if USE(COCOA_EVENT_LOOP)
</span><span class="lines">@@ -66,10 +66,10 @@
</span><span class="cx"> WTF_EXPORT_PRIVATE static Ref<WorkQueue> create(const char* name, Type = Type::Serial, QOS = QOS::Default);
</span><span class="cx"> virtual ~WorkQueue();
</span><span class="cx">
</span><del>- WTF_EXPORT_PRIVATE void dispatch(Function<void ()>&&) override;
- WTF_EXPORT_PRIVATE void dispatchAfter(std::chrono::nanoseconds, Function<void ()>&&);
</del><ins>+ WTF_EXPORT_PRIVATE void dispatch(Function<void()>&&) override;
+ WTF_EXPORT_PRIVATE void dispatchAfter(Seconds, Function<void()>&&);
</ins><span class="cx">
</span><del>- WTF_EXPORT_PRIVATE static void concurrentApply(size_t iterations, const std::function<void (size_t index)>&);
</del><ins>+ WTF_EXPORT_PRIVATE static void concurrentApply(size_t iterations, const std::function<void(size_t index)>&);
</ins><span class="cx">
</span><span class="cx"> #if USE(COCOA_EVENT_LOOP)
</span><span class="cx"> dispatch_queue_t dispatchQueue() const { return m_dispatchQueue; }
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> volatile LONG m_isWorkThreadRegistered;
</span><span class="cx">
</span><span class="cx"> Mutex m_functionQueueLock;
</span><del>- Vector<Function<void ()>> m_functionQueue;
</del><ins>+ Vector<Function<void()>> m_functionQueue;
</ins><span class="cx">
</span><span class="cx"> HANDLE m_timerQueue;
</span><span class="cx"> #elif USE(GLIB_EVENT_LOOP) || USE(GENERIC_EVENT_LOOP)
</span></span></pre></div>
<a id="trunkSourceWTFwtfcocoaWorkQueueCocoacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -30,16 +30,16 @@
</span><span class="cx">
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><del>-void WorkQueue::dispatch(Function<void ()>&& function)
</del><ins>+void WorkQueue::dispatch(Function<void()>&& function)
</ins><span class="cx"> {
</span><del>- dispatch_async(m_dispatchQueue, BlockPtr<void ()>::fromCallable([protectedThis = makeRef(*this), function = WTFMove(function)] {
</del><ins>+ dispatch_async(m_dispatchQueue, BlockPtr<void()>::fromCallable([protectedThis = makeRef(*this), function = WTFMove(function)] {
</ins><span class="cx"> function();
</span><span class="cx"> }).get());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::dispatchAfter(std::chrono::nanoseconds duration, Function<void ()>&& function)
</del><ins>+void WorkQueue::dispatchAfter(Seconds duration, Function<void()>&& function)
</ins><span class="cx"> {
</span><del>- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, duration.count()), m_dispatchQueue, BlockPtr<void ()>::fromCallable([protectedThis = makeRef(*this), function = WTFMove(function)] {
</del><ins>+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, duration.nanoseconds()), m_dispatchQueue, BlockPtr<void()>::fromCallable([protectedThis = makeRef(*this), function = WTFMove(function)] {
</ins><span class="cx"> function();
</span><span class="cx"> }).get());
</span><span class="cx"> }
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx"> dispatch_release(m_dispatchQueue);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::concurrentApply(size_t iterations, const std::function<void (size_t index)>& function)
</del><ins>+void WorkQueue::concurrentApply(size_t iterations, const std::function<void(size_t index)>& function)
</ins><span class="cx"> {
</span><span class="cx"> dispatch_apply(iterations, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t index) {
</span><span class="cx"> function(index);
</span></span></pre></div>
<a id="trunkSourceWTFwtfgenericMainThreadGenericcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/generic/MainThreadGeneric.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx">
</span><span class="cx"> void scheduleDispatchFunctionsOnMainThread()
</span><span class="cx"> {
</span><del>- RunLoop::main().dispatch(std::function<void()>(dispatchFunctionsFromMainThread));
</del><ins>+ RunLoop::main().dispatch(Function<void()>(&dispatchFunctionsFromMainThread));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWTFwtfgenericRunLoopGenericcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/generic/RunLoopGeneric.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/generic/RunLoopGeneric.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/generic/RunLoopGeneric.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -32,9 +32,9 @@
</span><span class="cx"> class RunLoop::TimerBase::ScheduledTask : public ThreadSafeRefCounted<ScheduledTask> {
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(ScheduledTask);
</span><span class="cx"> public:
</span><del>- static RefPtr<ScheduledTask> create(Function<void()>&& function, Seconds interval, bool repeating)
</del><ins>+ static Ref<ScheduledTask> create(Function<void()>&& function, Seconds interval, bool repeating)
</ins><span class="cx"> {
</span><del>- return adoptRef(new ScheduledTask(WTFMove(function), interval, repeating));
</del><ins>+ return adoptRef(*new ScheduledTask(WTFMove(function), interval, repeating));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ScheduledTask(Function<void()>&& function, Seconds interval, bool repeating)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> struct EarliestSchedule {
</span><del>- bool operator()(const RefPtr<ScheduledTask>& lhs, const RefPtr<ScheduledTask>& rhs)
</del><ins>+ bool operator()(const Ref<ScheduledTask>& lhs, const Ref<ScheduledTask>& rhs)
</ins><span class="cx"> {
</span><span class="cx"> return lhs->scheduledTimePoint() > rhs->scheduledTimePoint();
</span><span class="cx"> }
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx"> m_stopCondition.wait(m_loopLock);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline bool RunLoop::populateTasks(RunMode runMode, Status& statusOfThisLoop, Deque<RefPtr<TimerBase::ScheduledTask>>& firedTimers)
</del><ins>+inline bool RunLoop::populateTasks(RunMode runMode, Status& statusOfThisLoop, Deque<Ref<TimerBase::ScheduledTask>>& firedTimers)
</ins><span class="cx"> {
</span><span class="cx"> LockHolder locker(m_loopLock);
</span><span class="cx">
</span><span class="lines">@@ -139,12 +139,12 @@
</span><span class="cx"> // Check expired timers.
</span><span class="cx"> MonotonicTime now = MonotonicTime::now();
</span><span class="cx"> while (!m_schedules.isEmpty()) {
</span><del>- RefPtr<TimerBase::ScheduledTask> earliest = m_schedules.first();
</del><ins>+ Ref<TimerBase::ScheduledTask> earliest = m_schedules.first().copyRef();
</ins><span class="cx"> if (earliest->scheduledTimePoint() > now)
</span><span class="cx"> break;
</span><span class="cx"> std::pop_heap(m_schedules.begin(), m_schedules.end(), TimerBase::ScheduledTask::EarliestSchedule());
</span><span class="cx"> m_schedules.removeLast();
</span><del>- firedTimers.append(earliest);
</del><ins>+ firedTimers.append(WTFMove(earliest));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return true;
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx"> m_mainLoops.append(&statusOfThisLoop);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Deque<RefPtr<TimerBase::ScheduledTask>> firedTimers;
</del><ins>+ Deque<Ref<TimerBase::ScheduledTask>> firedTimers;
</ins><span class="cx"> while (true) {
</span><span class="cx"> if (!populateTasks(runMode, statusOfThisLoop, firedTimers))
</span><span class="cx"> return;
</span><span class="lines">@@ -167,7 +167,7 @@
</span><span class="cx">
</span><span class="cx"> // Dispatch scheduled timers.
</span><span class="cx"> while (!firedTimers.isEmpty()) {
</span><del>- RefPtr<TimerBase::ScheduledTask> task = firedTimers.takeFirst();
</del><ins>+ Ref<TimerBase::ScheduledTask> task = firedTimers.takeFirst();
</ins><span class="cx"> if (task->fired()) {
</span><span class="cx"> // Reschedule because the timer requires repeating.
</span><span class="cx"> // Since we will query the timers' time points before sleeping,
</span><span class="lines">@@ -218,19 +218,19 @@
</span><span class="cx"> wakeUp(locker);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RunLoop::schedule(const AbstractLocker&, RefPtr<TimerBase::ScheduledTask>&& task)
</del><ins>+void RunLoop::schedule(const AbstractLocker&, Ref<TimerBase::ScheduledTask>&& task)
</ins><span class="cx"> {
</span><span class="cx"> m_schedules.append(WTFMove(task));
</span><span class="cx"> std::push_heap(m_schedules.begin(), m_schedules.end(), TimerBase::ScheduledTask::EarliestSchedule());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RunLoop::schedule(RefPtr<TimerBase::ScheduledTask>&& task)
</del><ins>+void RunLoop::schedule(Ref<TimerBase::ScheduledTask>&& task)
</ins><span class="cx"> {
</span><span class="cx"> LockHolder locker(m_loopLock);
</span><span class="cx"> schedule(locker, WTFMove(task));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RunLoop::scheduleAndWakeUp(RefPtr<TimerBase::ScheduledTask> task)
</del><ins>+void RunLoop::scheduleAndWakeUp(Ref<TimerBase::ScheduledTask>&& task)
</ins><span class="cx"> {
</span><span class="cx"> LockHolder locker(m_loopLock);
</span><span class="cx"> schedule(locker, WTFMove(task));
</span><span class="lines">@@ -237,11 +237,11 @@
</span><span class="cx"> wakeUp(locker);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RunLoop::dispatchAfter(std::chrono::nanoseconds delay, Function<void ()>&& function)
</del><ins>+void RunLoop::dispatchAfter(Seconds delay, Function<void()>&& function)
</ins><span class="cx"> {
</span><span class="cx"> LockHolder locker(m_loopLock);
</span><span class="cx"> bool repeating = false;
</span><del>- schedule(locker, TimerBase::ScheduledTask::create(WTFMove(function), Seconds(delay.count() / 1000.0 / 1000.0 / 1000.0), repeating));
</del><ins>+ schedule(locker, TimerBase::ScheduledTask::create(WTFMove(function), delay, repeating));
</ins><span class="cx"> wakeUp(locker);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -269,7 +269,7 @@
</span><span class="cx"> m_scheduledTask = ScheduledTask::create([this] {
</span><span class="cx"> fired();
</span><span class="cx"> }, Seconds(interval), repeating);
</span><del>- m_runLoop.scheduleAndWakeUp(m_scheduledTask);
</del><ins>+ m_runLoop.scheduleAndWakeUp(*m_scheduledTask);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void RunLoop::TimerBase::stop()
</span></span></pre></div>
<a id="trunkSourceWTFwtfgenericWorkQueueGenericcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/generic/WorkQueueGeneric.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/generic/WorkQueueGeneric.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/generic/WorkQueueGeneric.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::dispatch(Function<void ()>&& function)
</del><ins>+void WorkQueue::dispatch(Function<void()>&& function)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<WorkQueue> protect(this);
</span><span class="cx"> m_runLoop->dispatch([protect, function = WTFMove(function)] {
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::dispatchAfter(std::chrono::nanoseconds delay, Function<void ()>&& function)
</del><ins>+void WorkQueue::dispatchAfter(Seconds delay, Function<void()>&& function)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<WorkQueue> protect(this);
</span><span class="cx"> m_runLoop->dispatchAfter(delay, [protect, function = WTFMove(function)] {
</span></span></pre></div>
<a id="trunkSourceWTFwtfglibRunLoopGLibcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx"> class DispatchAfterContext {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- DispatchAfterContext(Function<void ()>&& function)
</del><ins>+ DispatchAfterContext(Function<void()>&& function)
</ins><span class="cx"> : m_function(WTFMove(function))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -135,12 +135,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- Function<void ()> m_function;
</del><ins>+ Function<void()> m_function;
</ins><span class="cx"> };
</span><span class="cx">
</span><del>-void RunLoop::dispatchAfter(std::chrono::nanoseconds duration, Function<void ()>&& function)
</del><ins>+void RunLoop::dispatchAfter(Seconds duration, Function<void()>&& function)
</ins><span class="cx"> {
</span><del>- GRefPtr<GSource> source = adoptGRef(g_timeout_source_new(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count()));
</del><ins>+ GRefPtr<GSource> source = adoptGRef(g_timeout_source_new(duration.milliseconds()));
</ins><span class="cx"> g_source_set_name(source.get(), "[WebKit] RunLoop dispatchAfter");
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<DispatchAfterContext> context = std::make_unique<DispatchAfterContext>(WTFMove(function));
</span><span class="lines">@@ -179,13 +179,13 @@
</span><span class="cx">
</span><span class="cx"> void RunLoop::TimerBase::updateReadyTime()
</span><span class="cx"> {
</span><del>- if (!m_fireInterval.count()) {
</del><ins>+ if (!m_fireInterval) {
</ins><span class="cx"> g_source_set_ready_time(m_source.get(), 0);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> gint64 currentTime = g_get_monotonic_time();
</span><del>- gint64 targetTime = currentTime + std::min<gint64>(G_MAXINT64 - currentTime, m_fireInterval.count());
</del><ins>+ gint64 targetTime = currentTime + std::min<gint64>(G_MAXINT64 - currentTime, m_fireInterval.microseconds());
</ins><span class="cx"> ASSERT(targetTime >= currentTime);
</span><span class="cx"> g_source_set_ready_time(m_source.get(), targetTime);
</span><span class="cx"> }
</span><span class="lines">@@ -192,12 +192,7 @@
</span><span class="cx">
</span><span class="cx"> void RunLoop::TimerBase::start(double fireInterval, bool repeat)
</span><span class="cx"> {
</span><del>- auto intervalDuration = std::chrono::duration<double>(fireInterval);
- auto safeDuration = std::chrono::microseconds::max();
- if (intervalDuration < safeDuration)
- safeDuration = std::chrono::duration_cast<std::chrono::microseconds>(intervalDuration);
-
- m_fireInterval = safeDuration;
</del><ins>+ m_fireInterval = Seconds(fireInterval);
</ins><span class="cx"> m_isRepeating = repeat;
</span><span class="cx"> updateReadyTime();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWTFwtfwinWorkQueueWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/win/WorkQueueWin.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/win/WorkQueueWin.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WTF/wtf/win/WorkQueueWin.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> m_functionQueueLock.lock();
</span><span class="cx">
</span><span class="cx"> while (!m_functionQueue.isEmpty()) {
</span><del>- Vector<Function<void ()>> functionQueue;
</del><ins>+ Vector<Function<void()>> functionQueue;
</ins><span class="cx"> m_functionQueue.swap(functionQueue);
</span><span class="cx">
</span><span class="cx"> // Allow more work to be scheduled while we're not using the queue directly.
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx"> ::DeleteTimerQueueEx(m_timerQueue, 0);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::dispatch(Function<void ()>&& function)
</del><ins>+void WorkQueue::dispatch(Function<void()>&& function)
</ins><span class="cx"> {
</span><span class="cx"> MutexLocker locker(m_functionQueueLock);
</span><span class="cx"> ref();
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx"> static RefPtr<TimerContext> create() { return adoptRef(new TimerContext); }
</span><span class="cx">
</span><span class="cx"> WorkQueue* queue;
</span><del>- Function<void ()> function;
</del><ins>+ Function<void()> function;
</ins><span class="cx"> Mutex timerMutex;
</span><span class="cx"> HANDLE timer;
</span><span class="cx">
</span><span class="lines">@@ -149,7 +149,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::dispatchAfter(std::chrono::nanoseconds duration, Function<void ()>&& function)
</del><ins>+void WorkQueue::dispatchAfter(Seconds duration, Function<void()>&& function)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(m_timerQueue);
</span><span class="cx"> ref();
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx"> // timer handle has been stored in it.
</span><span class="cx"> MutexLocker lock(context->timerMutex);
</span><span class="cx">
</span><del>- int64_t milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
</del><ins>+ int64_t milliseconds = duration.milliseconds();
</ins><span class="cx">
</span><span class="cx"> // From empirical testing, we've seen CreateTimerQueueTimer() sometimes fire up to 5+ ms early.
</span><span class="cx"> // This causes havoc for clients of this code that expect to not be called back until the
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-03-13 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
+ https://bugs.webkit.org/show_bug.cgi?id=169537
+
+ Reviewed by Sam Weinig.
+
+ * Shared/ChildProcess.cpp:
+ (WebKit::didCloseOnConnectionWorkQueue):
+ * UIProcess/Storage/LocalStorageDatabase.cpp:
+ * WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp:
+ (WebKit::AcceleratedSurfaceX11::resize):
+
</ins><span class="cx"> 2017-03-13 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Allow termination of background WebProcesses that go over a given CPU usage threshold
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedChildProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ChildProcess.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ChildProcess.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WebKit2/Shared/ChildProcess.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> {
</span><span class="cx"> // If the connection has been closed and we haven't responded in the main thread for 10 seconds
</span><span class="cx"> // the process will exit forcibly.
</span><del>- auto watchdogDelay = std::chrono::seconds(10);
</del><ins>+ auto watchdogDelay = 10_s;
</ins><span class="cx">
</span><span class="cx"> WorkQueue::create("com.apple.WebKit.ChildProcess.WatchDogQueue")->dispatchAfter(watchdogDelay, [] {
</span><span class="cx"> // We use _exit here since the watchdog callback is called from another thread and we don't want
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessStorageLocalStorageDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WebKit2/UIProcess/Storage/LocalStorageDatabase.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><del>-static const auto databaseUpdateInterval = std::chrono::seconds(1);
</del><ins>+static const auto databaseUpdateInterval = 1_s;
</ins><span class="cx">
</span><span class="cx"> static const int maximumItemsToUpdate = 100;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagegtkAcceleratedSurfaceX11cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/AcceleratedSurfaceX11.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx"> XFlush(m_display);
</span><span class="cx">
</span><span class="cx"> // Release the previous pixmap later to give some time to the UI process to update.
</span><del>- RunLoop::main().dispatchAfter(std::chrono::seconds(5), [pixmap = WTFMove(m_pixmap)] { });
</del><ins>+ RunLoop::main().dispatchAfter(5_s, [pixmap = WTFMove(m_pixmap)] { });
</ins><span class="cx"> createPixmap();
</span><span class="cx"> return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Tools/ChangeLog        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-03-13 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [WTF] Clean up RunLoop and WorkQueue with Seconds and Function
+ https://bugs.webkit.org/show_bug.cgi?id=169537
+
+ Reviewed by Sam Weinig.
+
+ * TestWebKitAPI/Tests/WTF/WorkQueue.cpp:
+ (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2017-03-13 Carlos Alberto Lopez Perez <clopez@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Remove dead code from previous autotools build in build-jsc
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFWorkQueuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp (213857 => 213858)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp        2017-03-13 18:09:30 UTC (rev 213857)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WorkQueue.cpp        2017-03-13 18:56:54 UTC (rev 213858)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">
</span><span class="cx"> queue->dispatch([&](void) {
</span><span class="cx"> m_functionCallOrder.append(longTestLabel);
</span><del>- std::this_thread::sleep_for(std::chrono::nanoseconds(100));
</del><ins>+ std::this_thread::sleep_for(100ns);
</ins><span class="cx"> calledLongTest = true;
</span><span class="cx"> });
</span><span class="cx">
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> queue2->dispatch([&](void) {
</span><del>- std::this_thread::sleep_for(std::chrono::milliseconds(50));
</del><ins>+ std::this_thread::sleep_for(50ms);
</ins><span class="cx">
</span><span class="cx"> LockHolder locker(m_lock);
</span><span class="cx">
</span><span class="lines">@@ -178,7 +178,7 @@
</span><span class="cx"> m_testCompleted.notifyOne();
</span><span class="cx"> });
</span><span class="cx">
</span><del>- queue->dispatchAfter(std::chrono::milliseconds(500), [&](void) {
</del><ins>+ queue->dispatchAfter(500_ms, [&](void) {
</ins><span class="cx"> LockHolder locker(m_lock);
</span><span class="cx"> m_functionCallOrder.append(dispatchAfterLabel);
</span><span class="cx"> calledDispatchAfterTest = true;
</span><span class="lines">@@ -212,7 +212,7 @@
</span><span class="cx"> LockHolder locker(lock);
</span><span class="cx"> {
</span><span class="cx"> auto queue = WorkQueue::create("com.apple.WebKit.Test.dispatchAfter");
</span><del>- queue->dispatchAfter(std::chrono::milliseconds(500), [&](void) {
</del><ins>+ queue->dispatchAfter(500_ms, [&](void) {
</ins><span class="cx"> LockHolder locker(lock);
</span><span class="cx"> dispatchAfterTestStarted.wait(lock, [&] {
</span><span class="cx"> return started;
</span></span></pre>
</div>
</div>
</body>
</html>