Title: [91081] trunk/Source/WebCore
Revision
91081
Author
psola...@apple.com
Date
2011-07-15 11:38:14 -0700 (Fri, 15 Jul 2011)

Log Message

Part of https://bugs.webkit.org/show_bug.cgi?id=63674
Get webkit to compile with USE(CFNETWORK) enabled on Mac

Reviewed by David Kilzer.

Get LoaderRunLoop to work on Mac when USE(CFNETWORK) is enabled. Although we could use the
main run loop, it's better to have a separate thread handling the loads so that it can work
in parallel to the main thread. This is similar to what NSURLConnection does for us
internally when we use the NS APIs.

No new tests because no change in functionality and option is not enabled on Mac.

* platform/network/cf/LoaderRunLoopCF.cpp:
(WebCore::runLoaderThread): Create an autorelease pool for objc code that might be called in
the run loop.
(WebCore::loaderRunLoop):
* platform/network/cf/LoaderRunLoopCF.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91080 => 91081)


--- trunk/Source/WebCore/ChangeLog	2011-07-15 18:34:37 UTC (rev 91080)
+++ trunk/Source/WebCore/ChangeLog	2011-07-15 18:38:14 UTC (rev 91081)
@@ -1,3 +1,23 @@
+2011-07-15  Pratik Solanki  <psola...@apple.com>
+
+        Part of https://bugs.webkit.org/show_bug.cgi?id=63674
+        Get webkit to compile with USE(CFNETWORK) enabled on Mac
+
+        Reviewed by David Kilzer.
+
+        Get LoaderRunLoop to work on Mac when USE(CFNETWORK) is enabled. Although we could use the
+        main run loop, it's better to have a separate thread handling the loads so that it can work
+        in parallel to the main thread. This is similar to what NSURLConnection does for us
+        internally when we use the NS APIs.
+
+        No new tests because no change in functionality and option is not enabled on Mac.
+
+        * platform/network/cf/LoaderRunLoopCF.cpp:
+        (WebCore::runLoaderThread): Create an autorelease pool for objc code that might be called in
+        the run loop.
+        (WebCore::loaderRunLoop):
+        * platform/network/cf/LoaderRunLoopCF.h:
+
 2011-07-15  Xiaomei Ji  <x...@chromium.org>
 
         --webkit-visual-word crash on mixed editability

Modified: trunk/Source/WebCore/platform/network/cf/LoaderRunLoopCF.cpp (91080 => 91081)


--- trunk/Source/WebCore/platform/network/cf/LoaderRunLoopCF.cpp	2011-07-15 18:34:37 UTC (rev 91080)
+++ trunk/Source/WebCore/platform/network/cf/LoaderRunLoopCF.cpp	2011-07-15 18:38:14 UTC (rev 91081)
@@ -28,7 +28,9 @@
 
 #if USE(CFNETWORK)
 
+#include "AutodrainedPool.h"
 #include <CoreFoundation/CoreFoundation.h>
+#include <limits>
 #include <wtf/Threading.h>
 
 namespace WebCore {
@@ -48,7 +50,11 @@
     CFRunLoopSourceRef bogusSource = CFRunLoopSourceCreate(0, 0, &ctxt);
     CFRunLoopAddSource(loaderRunLoopObject, bogusSource, kCFRunLoopDefaultMode);
 
-    CFRunLoopRun();
+    SInt32 result;
+    do {
+        AutodrainedPool pool;
+        result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, std::numeric_limits<double>::max(), true);
+    } while (result != kCFRunLoopRunStopped && result != kCFRunLoopRunFinished);
 
     return 0;
 }
@@ -59,8 +65,13 @@
     if (!loaderRunLoopObject) {
         createThread(runLoaderThread, 0, "WebCore: CFNetwork Loader");
         while (!loaderRunLoopObject) {
-            // FIXME: Sleep 10? that can't be right...
+            // FIXME: <http://webkit.org/b/55402> - loaderRunLoop() should use synchronization instead of while loop
+#if PLATFORM(WIN)
             Sleep(10);
+#else
+            struct timespec sleepTime = { 0, 10 * 1000 * 1000 };
+            nanosleep(&sleepTime, 0);
+#endif
         }
     }
     return loaderRunLoopObject;

Modified: trunk/Source/WebCore/platform/network/cf/LoaderRunLoopCF.h (91080 => 91081)


--- trunk/Source/WebCore/platform/network/cf/LoaderRunLoopCF.h	2011-07-15 18:34:37 UTC (rev 91080)
+++ trunk/Source/WebCore/platform/network/cf/LoaderRunLoopCF.h	2011-07-15 18:38:14 UTC (rev 91081)
@@ -28,10 +28,6 @@
 
 #if USE(CFNETWORK)
 
-#if !PLATFORM(WIN)
-#error This code is not needed on platforms other than Windows, because the CFRunLoop from the main thread can be used.
-#endif
-
 typedef struct __CFRunLoop* CFRunLoopRef;
 
 namespace WebCore {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to