Changeset 101477 in webkit


Ignore:
Timestamp:
Nov 30, 2011 3:17:46 AM (12 years ago)
Author:
Simon Hausmann
Message:

.: Replace Qt QThread threading back-end with pthread/Win32 threading back-ends
https://bugs.webkit.org/show_bug.cgi?id=72155

Patch by Andrew Wason <rectalogic@rectalogic.com> on 2011-11-30
Reviewed by Simon Hausmann.

Add additional WebCoreSupport files for Qt.

  • Source/api.pri:

Source/JavaScriptCore: Replace Qt QThread threading back-end with pthread/Win32 threading back-ends
https://bugs.webkit.org/show_bug.cgi?id=72155

Patch by Andrew Wason <rectalogic@rectalogic.com> on 2011-11-30
Reviewed by Simon Hausmann.

Use ThreadingPthreads and ThreadingWin instead of ThreadingQt.

  • heap/MachineStackMarker.cpp:
  • wtf/MainThread.cpp:

(WTF::initializeMainThread):

  • wtf/Platform.h:
  • wtf/ThreadSpecific.h: Drop QThreadStorage related code.

(WTF::::destroy):

  • wtf/ThreadingPrimitives.h:
  • wtf/qt/MainThreadQt.cpp: Drop Qt specific isMainThread().

(WTF::initializeMainThreadPlatform): Initialize MainThreadInvoker on main thread to avoid infecting secondary thread with QAdoptedThread.
(WTF::scheduleDispatchFunctionsOnMainThread):

  • wtf/qt/ThreadingQt.cpp: Removed.
  • wtf/wtf.pro:

Source/WebCore: Replace Qt QThread threading back-end with pthread/Win32 threading back-ends
https://bugs.webkit.org/show_bug.cgi?id=72155

Patch by Andrew Wason <rectalogic@rectalogic.com> on 2011-11-30
Reviewed by Simon Hausmann.

Need to include qglobal.h since ThreadingPrimitives.h no longer does.

  • platform/network/NetworkingContext.h:

Source/WebKit/qt: Replace Qt QThread threading back-end with pthread/Win32 threading back-ends
https://bugs.webkit.org/show_bug.cgi?id=72155

Patch by Andrew Wason <rectalogic@rectalogic.com> on 2011-11-30
Reviewed by Simon Hausmann.

Extract WebCore initialization out of QWebPagePrivate into a
separate initialization function. This also needs to be called
from public static QWebSettings methods that call into WebCore,
since those can be used before a QWebPage has been constructed.

  • Api/qwebpage.cpp:

(QWebPagePrivate::QWebPagePrivate):

  • Api/qwebsettings.cpp:

(QWebSettings::globalSettings):
(QWebSettings::setIconDatabasePath):
(QWebSettings::iconDatabasePath):
(QWebSettings::clearIconDatabase):
(QWebSettings::iconForUrl):
(QWebSettings::setWebGraphic):
(QWebSettings::webGraphic):
(QWebSettings::clearMemoryCaches):
(QWebSettings::maximumPagesInCache):
(QWebSettings::setObjectCacheCapacities):
(QWebSettings::setOfflineStoragePath):
(QWebSettings::offlineStoragePath):
(QWebSettings::setOfflineWebApplicationCachePath):
(QWebSettings::offlineWebApplicationCachePath):
(QWebSettings::setOfflineWebApplicationCacheQuota):
(QWebSettings::offlineWebApplicationCacheQuota):
(QWebSettings::enablePersistentStorage):

  • WebCoreSupport/InitWebCoreQt.cpp: Added.

(WebCore::initializeWebCoreQt):

  • WebCoreSupport/InitWebCoreQt.h: Added.

Source/WebKit2: Build fix. The removal of the Qt threading back-end also removed
an implicit QString inclusion/forward-declaration.

  • UIProcess/qt/QtWebContext.h:
Location:
trunk
Files:
2 added
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r101456 r101477  
     12011-11-30  Andrew Wason  <rectalogic@rectalogic.com>
     2
     3        Replace Qt QThread threading back-end with pthread/Win32 threading back-ends
     4        https://bugs.webkit.org/show_bug.cgi?id=72155
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Add additional WebCoreSupport files for Qt.
     9
     10        * Source/api.pri:
     11
    1122011-11-30  Adenilson Cavalcanti  <adenilson.silva@openbossa.org>
    213
  • trunk/Source/JavaScriptCore/ChangeLog

    r101473 r101477  
     12011-11-30  Andrew Wason  <rectalogic@rectalogic.com>
     2
     3        Replace Qt QThread threading back-end with pthread/Win32 threading back-ends
     4        https://bugs.webkit.org/show_bug.cgi?id=72155
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Use ThreadingPthreads and ThreadingWin instead of ThreadingQt.
     9
     10        * heap/MachineStackMarker.cpp:
     11        * wtf/MainThread.cpp:
     12        (WTF::initializeMainThread):
     13        * wtf/Platform.h:
     14        * wtf/ThreadSpecific.h: Drop QThreadStorage related code.
     15        (WTF::::destroy):
     16        * wtf/ThreadingPrimitives.h:
     17        * wtf/qt/MainThreadQt.cpp: Drop Qt specific isMainThread().
     18        (WTF::initializeMainThreadPlatform): Initialize MainThreadInvoker on main thread to avoid infecting secondary thread with QAdoptedThread.
     19        (WTF::scheduleDispatchFunctionsOnMainThread):
     20        * wtf/qt/ThreadingQt.cpp: Removed.
     21        * wtf/wtf.pro:
     22
    1232011-11-30  Csaba Osztrogonác  <ossy@webkit.org>
    224
  • trunk/Source/JavaScriptCore/heap/MachineStackMarker.cpp

    r96722 r101477  
    3131#include <wtf/StdLibExtras.h>
    3232
    33 #if USE(PTHREAD_BASED_QT) && !defined(WTF_USE_PTHREADS)
    34 #define WTF_USE_PTHREADS 1
    35 #endif
    36 
    3733#if OS(DARWIN)
    3834
  • trunk/Source/JavaScriptCore/wtf/MainThread.cpp

    r95555 r101477  
    7171
    7272static bool callbacksPaused; // This global variable is only accessed from main thread.
    73 #if !PLATFORM(MAC) && !PLATFORM(QT)
     73#if !PLATFORM(MAC)
    7474static ThreadIdentifier mainThreadIdentifier;
    7575#endif
     
    9797    initializedMainThread = true;
    9898
    99 #if !PLATFORM(QT)
    10099    mainThreadIdentifier = currentThread();
    101 #endif
    102100
    103101    mainThreadFunctionQueueMutex();
     
    232230}
    233231
    234 #if !PLATFORM(MAC) && !PLATFORM(QT)
     232#if !PLATFORM(MAC)
    235233bool isMainThread()
    236234{
  • trunk/Source/JavaScriptCore/wtf/Platform.h

    r101141 r101477  
    491491#endif
    492492
    493 #if PLATFORM(QT) && OS(UNIX) && !OS(DARWIN)
    494 #define WTF_USE_PTHREAD_BASED_QT 1
    495 #endif
    496 
    497493/* On Windows, use QueryPerformanceCounter by default */
    498494#if OS(WINDOWS)
     
    646642#define HAVE_PTHREAD_RWLOCK 1
    647643#endif
     644#elif PLATFORM(QT) && OS(UNIX)
     645#define WTF_USE_PTHREADS 1
     646#define HAVE_PTHREAD_RWLOCK 1
    648647#endif
    649648
  • trunk/Source/JavaScriptCore/wtf/ThreadSpecific.h

    r98937 r101477  
    4646#if USE(PTHREADS)
    4747#include <pthread.h>
    48 #elif PLATFORM(QT)
    49 #include <QThreadStorage>
    5048#elif PLATFORM(GTK)
    5149#include <glib.h>
     
    9189    public:
    9290        Data(T* value, ThreadSpecific<T>* owner) : value(value), owner(owner) {}
    93 #if PLATFORM(QT)
    94         ~Data() { owner->destroy(this); }
    95 #endif
    9691
    9792        T* value;
     
    105100#if USE(PTHREADS)
    106101    pthread_key_t m_key;
    107 #elif PLATFORM(QT)
    108     QThreadStorage<Data*> m_key;
    109102#elif PLATFORM(GTK)
    110103    GStaticPrivate m_key;
     
    135128    ASSERT(!get());
    136129    pthread_setspecific(m_key, new Data(ptr, this));
    137 }
    138 
    139 #elif PLATFORM(QT)
    140 
    141 template<typename T>
    142 inline ThreadSpecific<T>::ThreadSpecific()
    143 {
    144 }
    145 
    146 template<typename T>
    147 inline T* ThreadSpecific<T>::get()
    148 {
    149     Data* data = static_cast<Data*>(m_key.localData());
    150     return data ? data->value : 0;
    151 }
    152 
    153 template<typename T>
    154 inline void ThreadSpecific<T>::set(T* ptr)
    155 {
    156     ASSERT(!get());
    157     Data* data = new Data(ptr, this);
    158     m_key.setLocalData(data);
    159130}
    160131
     
    251222    g_static_private_set(&data->owner->m_key, data, 0);
    252223#endif
    253 #if PLATFORM(QT)
    254     // See comment as above
    255     data->owner->m_key.setLocalData(data);
    256 #endif
    257224
    258225    data->value->~T();
     
    261228#if USE(PTHREADS)
    262229    pthread_setspecific(data->owner->m_key, 0);
    263 #elif PLATFORM(QT)
    264     // Do nothing here
    265230#elif PLATFORM(GTK)
    266231    g_static_private_set(&data->owner->m_key, 0, 0);
     
    271236#endif
    272237
    273 #if !PLATFORM(QT)
    274238    delete data;
    275 #endif
    276239}
    277240
  • trunk/Source/JavaScriptCore/wtf/ThreadingPrimitives.h

    r97269 r101477  
    4747#endif
    4848
    49 #if PLATFORM(QT)
    50 #include <qglobal.h>
    51 QT_BEGIN_NAMESPACE
    52 class QMutex;
    53 class QWaitCondition;
    54 QT_END_NAMESPACE
    55 #endif
    56 
    5749namespace WTF {
    5850
     
    6557#endif
    6658typedef pthread_cond_t PlatformCondition;
    67 #elif PLATFORM(QT)
    68 typedef QT_PREPEND_NAMESPACE(QMutex)* PlatformMutex;
    69 typedef void* PlatformReadWriteLock; // FIXME: Implement.
    70 typedef QT_PREPEND_NAMESPACE(QWaitCondition)* PlatformCondition;
    7159#elif OS(WINDOWS)
    7260struct PlatformMutex {
  • trunk/Source/JavaScriptCore/wtf/qt/MainThreadQt.cpp

    r101134 r101477  
    6666void initializeMainThreadPlatform()
    6767{
     68    webkit_main_thread_invoker();
    6869}
    6970
    7071void scheduleDispatchFunctionsOnMainThread()
    7172{
    72     QObject* invoker = webkit_main_thread_invoker();
    73     if (invoker->thread() != QCoreApplication::instance()->thread()) {
    74         ASSERT(invoker->thread() == QThread::currentThread());
    75         invoker->moveToThread(QCoreApplication::instance()->thread());
    76     }
    77     QCoreApplication::postEvent(invoker, new QEvent(static_cast<QEvent::Type>(s_mainThreadInvokerEventType)));
    78 }
    79 
    80 bool isMainThread()
    81 {
    82     return QThread::currentThread() == QCoreApplication::instance()->thread();
     73    QCoreApplication::postEvent(webkit_main_thread_invoker(), new QEvent(static_cast<QEvent::Type>(s_mainThreadInvokerEventType)));
    8374}
    8475
  • trunk/Source/JavaScriptCore/wtf/wtf.pro

    r101295 r101477  
    169169
    170170
     171unix: HEADERS += ThreadIdentifierDataPthreads.h
     172
    171173SOURCES += \
    172174    ArrayBuffer.cpp \
     
    199201    qt/MainThreadQt.cpp \
    200202    qt/StringQt.cpp \
    201     qt/ThreadingQt.cpp \
    202203    PageAllocationAligned.cpp \
    203204    PageBlock.cpp \
     
    221222    unicode/UTF8.cpp
    222223
    223 unix: SOURCES += OSAllocatorPosix.cpp
    224 win*|wince*: SOURCES += OSAllocatorWin.cpp
     224unix: SOURCES += \
     225    OSAllocatorPosix.cpp \
     226    ThreadIdentifierDataPthreads.cpp \
     227    ThreadingPthreads.cpp
     228
     229win*|wince*: SOURCES += \
     230    OSAllocatorWin.cpp \
     231    ThreadSpecificWin.cpp \
     232    ThreadingWin.cpp
    225233
    226234*sh4* {
  • trunk/Source/WebCore/ChangeLog

    r101474 r101477  
     12011-11-30  Andrew Wason  <rectalogic@rectalogic.com>
     2
     3        Replace Qt QThread threading back-end with pthread/Win32 threading back-ends
     4        https://bugs.webkit.org/show_bug.cgi?id=72155
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Need to include qglobal.h since ThreadingPrimitives.h no longer does.
     9
     10        * platform/network/NetworkingContext.h:
     11
    1122011-11-30  Jongseok Yang  <js45.yang@samsung.com>
    213
  • trunk/Source/WebCore/platform/network/NetworkingContext.h

    r100731 r101477  
    2828
    2929#if PLATFORM(QT)
     30#include <qglobal.h>
    3031QT_BEGIN_NAMESPACE
    3132class QObject;
  • trunk/Source/WebKit/qt/Api/qwebpage.cpp

    r101307 r101477  
    2323#include "qwebpage.h"
    2424
    25 #include "qwebelement_p.h"
    2625#include "qwebview.h"
    2726#include "qwebframe.h"
     
    7776#include "HitTestResult.h"
    7877#include "Image.h"
     78#include "InitWebCoreQt.h"
    7979#include "InspectorClientQt.h"
    8080#include "InspectorController.h"
     
    8282#include "KURL.h"
    8383#include "LocalizedStrings.h"
    84 #include "Logging.h"
    8584#include "MIMETypeRegistry.h"
    8685#include "NavigationAction.h"
     
    9493#include "Pasteboard.h"
    9594#include "PlatformKeyboardEvent.h"
    96 #include "PlatformStrategiesQt.h"
    9795#include "PlatformTouchEvent.h"
    9896#include "PlatformWheelEvent.h"
     
    108106#include "Scrollbar.h"
    109107#include "SecurityOrigin.h"
    110 #include "SecurityPolicy.h"
    111108#include "Settings.h"
    112109#if defined Q_OS_WIN32
     
    115112#include "TextIterator.h"
    116113#include "UtilsQt.h"
    117 #if USE(QTKIT)
    118 #include "WebSystemInterface.h"
    119 #endif
    120114#include "WindowFeatures.h"
    121115#include "WorkerThread.h"
    122 #include <runtime/InitializeThreading.h>
    123 #include <wtf/MainThread.h>
    124116
    125117#include <QApplication>
     
    319311    , m_lastDropAction(Qt::IgnoreAction)
    320312{
    321     WebCore::InitializeLoggingChannelsIfNecessary();
    322     ScriptController::initializeThreading();
    323     WTF::initializeMainThread();
    324     WebCore::SecurityPolicy::setLocalLoadPolicy(WebCore::SecurityPolicy::AllowLocalLoadsForLocalAndSubstituteData);
    325 
    326     PlatformStrategiesQt::initialize();
    327     QtWebElementRuntime::initialize();
    328 
    329 #if USE(QTKIT)
    330     InitWebCoreSystemInterface();
    331 #endif
     313    WebCore::initializeWebCoreQt();
    332314
    333315    Page::PageClients pageClients;
  • trunk/Source/WebKit/qt/Api/qwebsettings.cpp

    r100614 r101477  
    3232#include "IconDatabaseClientQt.h"
    3333#endif
     34#include "InitWebCoreQt.h"
    3435#include "Page.h"
    3536#include "PageCache.h"
     
    279280{
    280281    static QWebSettings* global = 0;
    281     if (!global)
     282    if (!global) {
     283        WebCore::initializeWebCoreQt();
    282284        global = new QWebSettings;
     285    }
    283286    return global;
    284287}
     
    649652void QWebSettings::setIconDatabasePath(const QString& path)
    650653{
     654    WebCore::initializeWebCoreQt();
    651655#if ENABLE(ICONDATABASE)
    652656    // Make sure that IconDatabaseClientQt is instantiated.
     
    675679QString QWebSettings::iconDatabasePath()
    676680{
     681    WebCore::initializeWebCoreQt();
    677682    if (WebCore::iconDatabase().isEnabled() && WebCore::iconDatabase().isOpen())
    678683        return WebCore::iconDatabase().databasePath();
     
    686691void QWebSettings::clearIconDatabase()
    687692{
     693    WebCore::initializeWebCoreQt();
    688694    if (WebCore::iconDatabase().isEnabled() && WebCore::iconDatabase().isOpen())
    689695        WebCore::iconDatabase().removeAllIcons();
     
    702708QIcon QWebSettings::iconForUrl(const QUrl& url)
    703709{
     710    WebCore::initializeWebCoreQt();
    704711    WebCore::Image* image = WebCore::iconDatabase().synchronousIconForPageURL(WebCore::KURL(url).string(),
    705712                                WebCore::IntSize(16, 16));
     
    719726QWebPluginDatabase *QWebSettings::pluginDatabase()
    720727{
     728    WebCore::initializeWebCoreQt();
    721729    static QWebPluginDatabase* database = 0;
    722730    if (!database)
     
    752760void QWebSettings::setWebGraphic(WebGraphic type, const QPixmap& graphic)
    753761{
     762    WebCore::initializeWebCoreQt();
    754763    WebCore::Image::setPlatformResource(resourceNameForWebGraphic(type), graphic);
    755764}
     
    763772QPixmap QWebSettings::webGraphic(WebGraphic type)
    764773{
     774    WebCore::initializeWebCoreQt();
    765775    RefPtr<WebCore::Image> img = WebCore::Image::loadPlatformResource(resourceNameForWebGraphic(type));
    766776    if (!img)
     
    780790void QWebSettings::clearMemoryCaches()
    781791{
     792    WebCore::initializeWebCoreQt();
    782793    // Turn the cache on and off.  Disabling the object cache will remove all
    783794    // resources from the cache.  They may still live on if they are referenced
     
    823834int QWebSettings::maximumPagesInCache()
    824835{
     836    WebCore::initializeWebCoreQt();
    825837    return WebCore::pageCache()->capacity();
    826838}
     
    844856void QWebSettings::setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity)
    845857{
     858    WebCore::initializeWebCoreQt();
    846859    bool disableCache = !cacheMinDeadCapacity && !cacheMaxDead && !totalCapacity;
    847860    WebCore::memoryCache()->setDisabled(disableCache);
     
    969982void QWebSettings::setOfflineStoragePath(const QString& path)
    970983{
     984    WebCore::initializeWebCoreQt();
    971985#if ENABLE(SQL_DATABASE)
    972986    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(path);
     
    984998QString QWebSettings::offlineStoragePath()
    985999{
     1000    WebCore::initializeWebCoreQt();
    9861001#if ENABLE(SQL_DATABASE)
    9871002    return WebCore::DatabaseTracker::tracker().databaseDirectoryPath();
     
    10361051void QWebSettings::setOfflineWebApplicationCachePath(const QString& path)
    10371052{
     1053    WebCore::initializeWebCoreQt();
    10381054    WebCore::cacheStorage().setCacheDirectory(path);
    10391055}
     
    10491065QString QWebSettings::offlineWebApplicationCachePath()
    10501066{
     1067    WebCore::initializeWebCoreQt();
    10511068    return WebCore::cacheStorage().cacheDirectory();
    10521069}
     
    10601077void QWebSettings::setOfflineWebApplicationCacheQuota(qint64 maximumSize)
    10611078{
     1079    WebCore::initializeWebCoreQt();
    10621080    WebCore::cacheStorage().empty();
    10631081    WebCore::cacheStorage().vacuumDatabaseFile();
     
    10721090qint64 QWebSettings::offlineWebApplicationCacheQuota()
    10731091{
     1092    WebCore::initializeWebCoreQt();
    10741093    return WebCore::cacheStorage().maximumSize();
    10751094}
     
    11201139void QWebSettings::enablePersistentStorage(const QString& path)
    11211140{
     1141    WebCore::initializeWebCoreQt();
    11221142#ifndef QT_NO_DESKTOPSERVICES
    11231143    QString storagePath;
  • trunk/Source/WebKit/qt/ChangeLog

    r101456 r101477  
     12011-11-30  Andrew Wason  <rectalogic@rectalogic.com>
     2
     3        Replace Qt QThread threading back-end with pthread/Win32 threading back-ends
     4        https://bugs.webkit.org/show_bug.cgi?id=72155
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Extract WebCore initialization out of QWebPagePrivate into a
     9        separate initialization function. This also needs to be called
     10        from public static QWebSettings methods that call into WebCore,
     11        since those can be used before a QWebPage has been constructed.
     12
     13        * Api/qwebpage.cpp:
     14        (QWebPagePrivate::QWebPagePrivate):
     15        * Api/qwebsettings.cpp:
     16        (QWebSettings::globalSettings):
     17        (QWebSettings::setIconDatabasePath):
     18        (QWebSettings::iconDatabasePath):
     19        (QWebSettings::clearIconDatabase):
     20        (QWebSettings::iconForUrl):
     21        (QWebSettings::setWebGraphic):
     22        (QWebSettings::webGraphic):
     23        (QWebSettings::clearMemoryCaches):
     24        (QWebSettings::maximumPagesInCache):
     25        (QWebSettings::setObjectCacheCapacities):
     26        (QWebSettings::setOfflineStoragePath):
     27        (QWebSettings::offlineStoragePath):
     28        (QWebSettings::setOfflineWebApplicationCachePath):
     29        (QWebSettings::offlineWebApplicationCachePath):
     30        (QWebSettings::setOfflineWebApplicationCacheQuota):
     31        (QWebSettings::offlineWebApplicationCacheQuota):
     32        (QWebSettings::enablePersistentStorage):
     33        * WebCoreSupport/InitWebCoreQt.cpp: Added.
     34        (WebCore::initializeWebCoreQt):
     35        * WebCoreSupport/InitWebCoreQt.h: Added.
     36
    1372011-11-30  Adenilson Cavalcanti  <adenilson.silva@openbossa.org>
    238
  • trunk/Source/WebKit2/ChangeLog

    r101470 r101477  
     12011-11-30  Simon Hausmann  <simon.hausmann@nokia.com>
     2
     3        Build fix. The removal of the Qt threading back-end also removed
     4        an implicit QString inclusion/forward-declaration.
     5
     6        * UIProcess/qt/QtWebContext.h:
     7
    182011-11-30  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    29
  • trunk/Source/WebKit2/UIProcess/qt/QtWebContext.h

    r101195 r101477  
    2626#include <wtf/RefCounted.h>
    2727#include <wtf/RefPtr.h>
     28#include <qglobal.h>
     29
     30QT_BEGIN_NAMESPACE
     31class QString;
     32QT_END_NAMESPACE
    2833
    2934namespace WebKit {
  • trunk/Source/api.pri

    r101262 r101477  
    5353    $$PWD/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \
    5454    $$PWD/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \
     55    $$PWD/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp \
    5556    $$PWD/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \
    5657    $$PWD/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp \
     
    6465
    6566HEADERS += \
     67    $$PWD/WebKit/qt/WebCoreSupport/InitWebCoreQt.h \
    6668    $$PWD/WebKit/qt/WebCoreSupport/InspectorServerQt.h \
    6769    $$PWD/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \
Note: See TracChangeset for help on using the changeset viewer.