Changeset 91081 in webkit


Ignore:
Timestamp:
Jul 15, 2011 11:38:14 AM (13 years ago)
Author:
psolanki@apple.com
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:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r91077 r91081  
     12011-07-15  Pratik Solanki  <psolanki@apple.com>
     2
     3        Part of https://bugs.webkit.org/show_bug.cgi?id=63674
     4        Get webkit to compile with USE(CFNETWORK) enabled on Mac
     5
     6        Reviewed by David Kilzer.
     7
     8        Get LoaderRunLoop to work on Mac when USE(CFNETWORK) is enabled. Although we could use the
     9        main run loop, it's better to have a separate thread handling the loads so that it can work
     10        in parallel to the main thread. This is similar to what NSURLConnection does for us
     11        internally when we use the NS APIs.
     12
     13        No new tests because no change in functionality and option is not enabled on Mac.
     14
     15        * platform/network/cf/LoaderRunLoopCF.cpp:
     16        (WebCore::runLoaderThread): Create an autorelease pool for objc code that might be called in
     17        the run loop.
     18        (WebCore::loaderRunLoop):
     19        * platform/network/cf/LoaderRunLoopCF.h:
     20
    1212011-07-15  Xiaomei Ji  <xji@chromium.org>
    222
  • trunk/Source/WebCore/platform/network/cf/LoaderRunLoopCF.cpp

    r77937 r91081  
    2929#if USE(CFNETWORK)
    3030
     31#include "AutodrainedPool.h"
    3132#include <CoreFoundation/CoreFoundation.h>
     33#include <limits>
    3234#include <wtf/Threading.h>
    3335
     
    4951    CFRunLoopAddSource(loaderRunLoopObject, bogusSource, kCFRunLoopDefaultMode);
    5052
    51     CFRunLoopRun();
     53    SInt32 result;
     54    do {
     55        AutodrainedPool pool;
     56        result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, std::numeric_limits<double>::max(), true);
     57    } while (result != kCFRunLoopRunStopped && result != kCFRunLoopRunFinished);
    5258
    5359    return 0;
     
    6066        createThread(runLoaderThread, 0, "WebCore: CFNetwork Loader");
    6167        while (!loaderRunLoopObject) {
    62             // FIXME: Sleep 10? that can't be right...
     68            // FIXME: <http://webkit.org/b/55402> - loaderRunLoop() should use synchronization instead of while loop
     69#if PLATFORM(WIN)
    6370            Sleep(10);
     71#else
     72            struct timespec sleepTime = { 0, 10 * 1000 * 1000 };
     73            nanosleep(&sleepTime, 0);
     74#endif
    6475        }
    6576    }
  • trunk/Source/WebCore/platform/network/cf/LoaderRunLoopCF.h

    r82308 r91081  
    2929#if USE(CFNETWORK)
    3030
    31 #if !PLATFORM(WIN)
    32 #error This code is not needed on platforms other than Windows, because the CFRunLoop from the main thread can be used.
    33 #endif
    34 
    3531typedef struct __CFRunLoop* CFRunLoopRef;
    3632
Note: See TracChangeset for help on using the changeset viewer.