Fix for https://bugs.webkit.org/show_bug.cgi?id=38097
Disentangle initializing the main thread from initializing threading
Reviewed by Maciej Stachowiak.
JavaScriptCore:
This is the first step in getting rid of the WEB_THREAD #define and
paving the way to allowing mac both WebKit and WebKit2 to use the same
WebCore.
- JavaScriptCore.exp: Export initializeMainThread and initializeMainThreadToProcessMainThread.
- JavaScriptCore.xcodeproj/project.pbxproj: Sort files.
(WTF::mainThreadInitializationMutex):
(WTF::mainThreadFunctionQueueMutex):
(WTF::initializeMainThread):
(WTF::deprecatedInitializeMainThread):
Added Mac only initializeMainThreadToProcessMainThread which sets up callOnMainThread
and isMainThead calls to assume that WebCore's main thread is also the
process's main thread. Since it is possible that both initializeMainThread
and initializeMainThreadToProcessMainThread could be called, the first one called
wins (either will work).
- wtf/Threading.h: Moved to top of file.
- wtf/ThreadingPthreads.cpp:
(WTF::initializeThreading): Remove call to initializeMainThread.
(WTF::initializeThreading): Ditto.
- wtf/gtk/ThreadingGtk.cpp:
(WTF::initializeThreading): Ditto.
- wtf/mac/MainThreadMac.mm:
(WTF::initializeMainThreadPlatform):
(WTF::initializeMainThreadToProcessMainThread):
(WTF::scheduleDispatchFunctionsOnMainThread):
(WTF::isMainThread):
Add runtime switch between the old behavior of using the system's main
thread and a stored pointer to the main thread. Tiger always uses the
system's main thread.
(WTF::initializeThreading): Remove call to initializeMainThread.
- wtf/win/MainThreadWin.cpp:
(WTF::initializeMainThreadPlatform): Add call to initializeCurrentThreadInternal
removed from initializeThreading.
WebCore:
- WebCore.xcodeproj/project.pbxproj: Sort files.
- accessibility/mac/AccessibilityObjectWrapper.mm: Remove unnessary
+initialize method. The AccessibilityObjectWrapper has no data members
that need to be derefed, so it does not need to be finalized on the main
thread.
- bindings/js/ScriptController.cpp:
(WebCore::ScriptController::initializeThreading): Add call to initializeMainThread.
- bindings/objc/WebScriptObject.mm:
(+[WebScriptObject initialize]): Add call to initializeMainThreadToProcessMainThread.
- bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::initializeThreading): Add call to initializeMainThread.
- platform/mac/SharedBufferMac.mm:
(+[WebCoreSharedBufferData initialize]): Add call to initializeMainThreadToProcessMainThread.
WebKit/chromium:
(WebKit::initialize): Add call to initializeMainThread.
(WebKit::WebViewImpl::WebViewImpl): Ditto.
WebKit/gtk:
- webkit/webkitprivate.cpp:
(webkit_init): Add call to initializeMainThread.
WebKit/mac:
Calls initializeMainThreadToProcessMainThread since there is no way to ensure
that the initialize method will be called on the main thread.
- Carbon/CarbonWindowAdapter.mm:
(+[CarbonWindowAdapter initialize]): Add call to initializeMainThreadToProcessMainThread.
- History/WebBackForwardList.mm:
(+[WebBackForwardList initialize]): Ditto.
- History/WebHistoryItem.mm:
(+[WebHistoryItem initialize]): Ditto.
- Misc/WebElementDictionary.mm:
(+[WebElementDictionary initialize]): Ditto.
(+[WebIconDatabase initialize]): Ditto.
- Plugins/Hosted/WebHostedNetscapePluginView.mm:
(+[WebHostedNetscapePluginView initialize]): Ditto.
- Plugins/WebBaseNetscapePluginView.mm:
(+[WebBaseNetscapePluginView initialize]): Ditto.
- Plugins/WebBasePluginPackage.mm:
(+[WebBasePluginPackage initialize]): Ditto.
- Plugins/WebNetscapePluginView.mm:
(+[WebNetscapePluginView initialize]): Ditto.
- WebCoreSupport/WebEditorClient.mm:
(+[WebEditCommand initialize]): Ditto.
- WebCoreSupport/WebFrameLoaderClient.mm:
(+[WebFramePolicyListener initialize]): Ditto.
(+[WebArchivePrivate initialize]): Ditto.
- WebView/WebDataSource.mm:
(+[WebDataSourcePrivate initialize]): Ditto.
(+[WebHTMLViewPrivate initialize]): Ditto.
(+[WebHTMLView initialize]): Ditto.
(+[WebResourcePrivate initialize]): Ditto.
- WebView/WebTextIterator.mm:
(+[WebTextIteratorPrivate initialize]): Ditto.
- WebView/WebView.mm:
- WebView/WebViewData.mm: Ditto.
(+[WebViewPrivate initialize]): Ditto.
WebKit/qt:
(QWebPagePrivate::QWebPagePrivate): Add call to initializeMainThread.
WebKit/win:
(WebKitClassFactory::WebKitClassFactory): Add call to initializeMainThread.
(WebView::WebView): Ditto.
WebKit/wx:
(wxWebView::Create): Add call to initializeMainThread.
WebKit2:
- UIProcess/Launcher/mac/WebProcessLauncher.mm:
(WebKit::webThreadBody): Add call to initializeMainThread.
- UIProcess/Launcher/win/WebProcessLauncher.cpp:
(WebKit::webThreadBody): Ditto.
- WebProcess/Launching/mac/WebProcessMain.mm:
(main): Ditto.
- WebProcess/win/WebProcessMain.cpp:
(WebKit::WebProcessMain): Ditto.