Changeset 51222 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Nov 19, 2009, 4:53:38 PM (16 years ago)
Author:
[email protected]
Message:

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=31690
Make SocketStreamHandleCFNet work on Windows

  • WebCore.vcproj/WebCore.vcproj: Added LoaderRunLoopCF.
  • platform/network/ResourceHandle.h: Removed loaderRunLoop().
  • platform/network/cf/LoaderRunLoopCF.cpp: Added. (WebCore::emptyPerform): (WebCore::runLoaderThread): (WebCore::loaderRunLoop):
  • platform/network/cf/LoaderRunLoopCF.h: Added. Moved the run loop that we use for CFNetwork from ResourceHandle to its own file, because it's needed for more than just resource loading.
  • platform/network/cf/ResourceHandleCFNet.cpp: Use loaderRunLoop() from its new location.
  • platform/network/cf/DNSCFNet.cpp: (WebCore::DNSResolveQueue::resolve): Ditto.
  • platform/network/cf/SocketStreamHandle.h: Added static callbacks for forwarding events to main thread.
  • platform/network/cf/SocketStreamHandleCFNet.cpp: (WebCore::SocketStreamHandle::SocketStreamHandle): Use loaderRunLoop() on Windows instead of inoperable main run loop.

(WebCore::MainThreadEventCallbackInfo::MainThreadEventCallbackInfo):
(WebCore::SocketStreamHandle::readStreamCallback):
(WebCore::SocketStreamHandle::writeStreamCallback):
(WebCore::SocketStreamHandle::readStreamCallbackMainThread):
(WebCore::SocketStreamHandle::writeStreamCallbackMainThread):
Forward stream events to main thread on Windows.

Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r51211 r51222  
     12009-11-19  Alexey Proskuryakov  <[email protected]>
     2
     3        Reviewed by Darin Adler.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=31690
     6        Make SocketStreamHandleCFNet work on Windows
     7
     8        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
     9        * wtf/MainThread.cpp:
     10        (WTF::FunctionWithContext::FunctionWithContext):
     11        (WTF::dispatchFunctionsFromMainThread):
     12        (WTF::callOnMainThreadAndWait):
     13        * wtf/MainThread.h:
     14        Re-add callOnMainThreadAndWait(), which was removed in bug 23926.
     15
    1162009-11-19  Dmitry Titov  <[email protected]>
    217
  • trunk/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r51168 r51222  
    5353    ?call@JSC@@YA?AVJSValue@1@PAVExecState@1@V21@W4CallType@1@ABTCallData@1@1ABVArgList@1@@Z
    5454    ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z
     55    ?callOnMainThreadAndWait@WTF@@YAXP6AXPAX@Z0@Z
    5556    ?changePrototypeTransition@Structure@JSC@@SA?AV?$PassRefPtr@VStructure@JSC@@@WTF@@PAV12@VJSValue@2@@Z
    5657    ?checkSameIdentifierTable@Identifier@JSC@@CAXPAVExecState@2@PAURep@UString@2@@Z
  • trunk/JavaScriptCore/wtf/MainThread.cpp

    r46598 r51222  
    4040    MainThreadFunction* function;
    4141    void* context;
     42    ThreadCondition* syncFlag;
    4243
    43     FunctionWithContext(MainThreadFunction* function = 0, void* context = 0)
     44    FunctionWithContext(MainThreadFunction* function = 0, void* context = 0, ThreadCondition* syncFlag = 0)
    4445        : function(function)
    4546        , context(context)
     47        , syncFlag(syncFlag)
    4648    {
    4749    }
     
    9395
    9496        invocation.function(invocation.context);
     97        if (invocation.syncFlag)
     98            invocation.syncFlag->signal();
    9599
    96100        // If we are running accumulated functions for too long so UI may become unresponsive, we need to
     
    118122}
    119123
     124void callOnMainThreadAndWait(MainThreadFunction* function, void* context)
     125{
     126    ASSERT(function);
     127
     128    if (isMainThread()) {
     129        function(context);
     130        return;
     131    }
     132
     133    ThreadCondition syncFlag;
     134    Mutex& functionQueueMutex = mainThreadFunctionQueueMutex();
     135    MutexLocker locker(functionQueueMutex);
     136    functionQueue().append(FunctionWithContext(function, context, &syncFlag));
     137    if (functionQueue().size() == 1)
     138        scheduleDispatchFunctionsOnMainThread();
     139    syncFlag.wait(functionQueueMutex);
     140}
     141
    120142void setMainThreadCallbacksPaused(bool paused)
    121143{
  • trunk/JavaScriptCore/wtf/MainThread.h

    r40969 r51222  
    3939void callOnMainThread(MainThreadFunction*, void* context);
    4040
     41// Blocks the thread until the call finishes on the main thread. Misusing this can easily cause deadlocks.
     42void callOnMainThreadAndWait(MainThreadFunction*, void* context);
     43
    4144void setMainThreadCallbacksPaused(bool paused);
    4245
     
    5356
    5457using WTF::callOnMainThread;
     58using WTF::callOnMainThreadAndWait;
    5559using WTF::setMainThreadCallbacksPaused;
    5660
Note: See TracChangeset for help on using the changeset viewer.