Skip to content
  • dimich@chromium.org's avatar
    JavaScriptCore: · 4b43290e
    dimich@chromium.org authored
    2009-05-07  Dmitry Titov  <dimich@chromium.org>
    
            Reviewed by Alexey Proskuryakov and Adam Roben.
    
            https://bugs.webkit.org/show_bug.cgi?id=25348
            Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap.
    
            * wtf/Threading.h:
            (WTF::ThreadIdentifier::ThreadIdentifier):
            (WTF::ThreadIdentifier::isValid):
            (WTF::ThreadIdentifier::invalidate):
            (WTF::ThreadIdentifier::platformId):
            ThreadIdentifier is now a class, containing a PlatformThreadIdentifier and
            methods that are used across the code on thread ids: construction, comparisons,
            check for 'valid' state etc. '0' is used as invalid id, which happens to just work
            with all platform-specific thread id implementations.
    
            All the following files repeatedly reflect the new ThreadIdentifier for each platform.
            We remove ThreadMap and threadMapMutex from all of them, remove the functions that
            populated/searched/cleared the map and add platform-specific comparison operators
            for ThreadIdentifier.
    
            * wtf/gtk/ThreadingGtk.cpp:
            (WTF::ThreadIdentifier::operator==):
            (WTF::ThreadIdentifier::operator!=):
            (WTF::initializeThreading):
            (WTF::createThreadInternal):
            (WTF::waitForThreadCompletion):
            (WTF::currentThread):
    
            * wtf/ThreadingNone.cpp:
            (WTF::ThreadIdentifier::operator==):
            (WTF::ThreadIdentifier::operator!=):
    
            * wtf/ThreadingPthreads.cpp:
            (WTF::ThreadIdentifier::operator==):
            (WTF::ThreadIdentifier::operator!=):
            (WTF::initializeThreading):
            (WTF::createThreadInternal):
            (WTF::waitForThreadCompletion):
            (WTF::detachThread):
            (WTF::currentThread):
    
            * wtf/qt/ThreadingQt.cpp:
            (WTF::ThreadIdentifier::operator==):
            (WTF::ThreadIdentifier::operator!=):
            (WTF::initializeThreading):
            (WTF::createThreadInternal):
            (WTF::waitForThreadCompletion):
            (WTF::currentThread):
    
            * wtf/ThreadingWin.cpp:
            (WTF::ThreadIdentifier::operator==):
            (WTF::ThreadIdentifier::operator!=):
            (WTF::initializeThreading):
            (WTF::createThreadInternal): All the platforms (except Windows) used a sequential
            counter as a thread ID and mapped it into platform ID. Windows was using native thread
            id and mapped it into thread handle. Since we can always obtain a thread handle
            by thread id, createThread now closes the handle.
            (WTF::waitForThreadCompletion): obtains another one using OpenThread(id) API. If can not obtain a handle,
            it means the thread already exited.
            (WTF::detachThread):
            (WTF::currentThread):
            (WTF::detachThreadDeprecated): old function, renamed (for Win Safari 4 beta which uses it for now).
            (WTF::waitForThreadCompletionDeprecated): same.
            (WTF::currentThreadDeprecated): same.
            (WTF::createThreadDeprecated): same.
    
            * bytecode/SamplingTool.h:
            * bytecode/SamplingTool.cpp: Use DEFINE_STATIC_LOCAL for a static ThreadIdentifier variable, to avoid static constructor.
    
            * JavaScriptCore.exp: export lists - updated the WTF threading functions decorated names
            since they now take a different type as a parameter.
            * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: ditto for Windows, plus added "deprecated" functions
            that take old parameter type - turns out public beta of Safari 4 uses those, so they need to be kept along for a while.
            * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: ditto.
    
    WebCore:
    
    2009-05-07  Dmitry Titov  <dimich@chromium.org>
    
            Reviewed by Alexey Proskuryakov and Adam Roben.
    
            https://bugs.webkit.org/show_bug.cgi?id=25348
            Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap.
    
            Most of the change is in WTF.
            Unless noted, all the following files changed to use the new ThreadIdentifier::isValid()
            method instead of just doing 'if(m_threadID)' kind of checks, since ThreadIdentifier
            is now a class rather then an integer.
            Also, there is no need to initialize threadID in constructors to 0 now.
    
            * dom/XMLTokenizerLibxml2.cpp:
            (WebCore::libxmlLoaderThread): use DEFINE_STATIC_LOCAL and accessor function for static thread id,
            since now ThreadIdentifier needs construction and we avoid having global initializers.
            (WebCore::matchFunc): use the new accessor function.
            (WebCore::openFunc): ditto.
            (WebCore::createStringParser): ditto.
            (WebCore::createMemoryParser): ditto.
            * loader/icon/IconDatabase.cpp:
            (WebCore::IconDatabase::open):
            * platform/sql/SQLiteDatabase.cpp:
            (WebCore::SQLiteDatabase::SQLiteDatabase):
            (WebCore::SQLiteDatabase::close):
            * storage/DatabaseThread.cpp:
            (WebCore::DatabaseThread::start):
            (WebCore::DatabaseThread::databaseThread): remove m_threadID from debug output.
            * storage/LocalStorageThread.cpp:
            (WebCore::LocalStorageThread::start):
            (WebCore::LocalStorageThread::scheduleImport):
            (WebCore::LocalStorageThread::scheduleSync):
            (WebCore::LocalStorageThread::terminate):
            * workers/WorkerThread.cpp:
            (WebCore::WorkerThread::start):
            (WebCore::WorkerThread::WorkerThread):
            (WebCore::WorkerThread::start):
    
    WebKit/win:
    
    2009-05-07  Dmitry Titov  <dimich@chromium.org>
    
            Reviewed by Alexey Proskuryakov and Adam Roben.
    
            https://bugs.webkit.org/show_bug.cgi?id=25348
            Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap.
    
            Most of the change is in WTF and WebCore.
    
            * WebKit.vcproj/WebKit.def: replaced decorated names of WTF threading functions with new ones.
            Also, aliased the old implementations so the public Safari 4 beta can load the old WTF functions
            which it uses. Next time Safari 4 builds, it will pick up new functions and the deprecated ones
            can be removed.
            * WebKit.vcproj/WebKit_debug.def: same.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    4b43290e