Title: [187672] branches/safari-601.1-branch/Source/WebCore
Revision
187672
Author
[email protected]
Date
2015-07-31 13:15:29 -0700 (Fri, 31 Jul 2015)

Log Message

Merge r187630. rdar://problem/18835799

Modified Paths

Diff

Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (187671 => 187672)


--- branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-31 20:15:26 UTC (rev 187671)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-31 20:15:29 UTC (rev 187672)
@@ -1,3 +1,26 @@
+2015-07-31  Matthew Hanson  <[email protected]>
+
+        Merge r187630. rdar://problem/18835799
+
+    2015-07-30  Andreas Kling  <[email protected]>
+
+            [CF] Web process continually eating memory on simple, shared Google Docs spreadsheet.
+            <https://webkit.org/b/147403>
+            <rdar://problem/18835799>
+
+            Reviewed by Geoffrey Garen.
+
+            Make sure we service the CFRunLoop on worker threads, since ports using CoreFoundation
+            will be scheduling garbage collections and heap sweeps using CFRunLoop timers.
+
+            This fix is a stopgap. Long term we need a better design for integrating GC tasks with
+            with the web worker run loop.
+
+            * workers/WorkerRunLoop.cpp:
+            (WebCore::WorkerRunLoop::runInMode): Instead of sleeping forever, calculate a better
+            wakeup deadline by asking the CFRunLoop when its next timer will fire. Then, when a
+            timeout occurs, call CFRunLoopRunInMode (with seconds=0) to service pending timers.
+
 2015-07-31  Lucas Forschler  <[email protected]>
 
         Merge r187557

Modified: branches/safari-601.1-branch/Source/WebCore/workers/WorkerRunLoop.cpp (187671 => 187672)


--- branches/safari-601.1-branch/Source/WebCore/workers/WorkerRunLoop.cpp	2015-07-31 20:15:26 UTC (rev 187671)
+++ branches/safari-601.1-branch/Source/WebCore/workers/WorkerRunLoop.cpp	2015-07-31 20:15:29 UTC (rev 187672)
@@ -148,9 +148,21 @@
     ASSERT(context);
     ASSERT(context->thread().threadID() == currentThread());
 
+    double deadline = MessageQueue<Task>::infiniteTime();
+
+#if USE(CF)
+    CFAbsoluteTime nextCFRunLoopTimerFireDate = CFRunLoopGetNextTimerFireDate(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+    double timeUntilNextCFRunLoopTimerInSeconds = nextCFRunLoopTimerFireDate - CFAbsoluteTimeGetCurrent();
+    deadline = currentTime() + std::max(0.0, timeUntilNextCFRunLoopTimerInSeconds);
+#endif
+
     double absoluteTime = 0.0;
-    if (waitMode == WaitForMessage)
-        absoluteTime = (predicate.isDefaultMode() && m_sharedTimer->isActive()) ? m_sharedTimer->fireTime() : MessageQueue<Task>::infiniteTime();
+    if (waitMode == WaitForMessage) {
+        if (predicate.isDefaultMode() && m_sharedTimer->isActive())
+            absoluteTime = std::min(deadline, m_sharedTimer->fireTime());
+        else
+            absoluteTime = deadline;
+    }
     MessageQueueWaitResult result;
     auto task = m_messageQueue.waitForMessageFilteredWithTimeout(result, predicate, absoluteTime);
 
@@ -167,6 +179,10 @@
     case MessageQueueTimeout:
         if (!context->isClosing())
             m_sharedTimer->fire();
+#if USE(CF)
+        if (nextCFRunLoopTimerFireDate <= CFAbsoluteTimeGetCurrent())
+            CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, /*returnAfterSourceHandled*/ false);
+#endif
         break;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to