Initializing the main thread should initialize the main run loop
https://bugs.webkit.org/show_bug.cgi?id=213637
Reviewed by Anders Carlsson.
Source/JavaScriptCore:
- JavaScriptCore.order: Removed some defunct stuff.
- shell/playstation/TestShell.cpp:
(setupTestRun): Merged initializeThreading call with
initializeMainThread call because initializeMainThread is a superset.
Source/WebCore:
- platform/ios/wak/WebCoreThread.mm:
(RunWebThread): Removed call to initializeMainThread() because the main
thread calls it before starting the web thread, so it's a no-op. (And if
it were an op, it would be broken.)
(StartWebThread): Merged RunLoop::initializeMain and initializeThreading
into initializeMainThread.
Source/WebDriver:
(WebDriver::WebDriverService::run):
Source/WebKit:
- Shared/Cocoa/WebKit2InitializeCocoa.mm:
(WebKit::runInitializationCode):
(WebKit::InitializeWebKit2):
- Shared/WebKit2Initialize.cpp:
(WebKit::InitializeWebKit2):
Source/WebKitLegacy/mac:
- History/WebBackForwardList.mm:
(+[WebBackForwardList initialize]):
- History/WebHistoryItem.mm:
(+[WebHistoryItem initialize]):
(+[WebCache initialize]):
- Misc/WebElementDictionary.mm:
(+[WebElementDictionary initialize]):
- Misc/WebIconDatabase.mm:
- Plugins/Hosted/WebHostedNetscapePluginView.mm:
(+[WebHostedNetscapePluginView initialize]):
- Plugins/WebBaseNetscapePluginView.mm:
- Plugins/WebBasePluginPackage.mm:
(+[WebBasePluginPackage initialize]):
- Plugins/WebNetscapePluginView.mm:
(+[WebNetscapePluginView initialize]):
- WebCoreSupport/WebEditorClient.mm:
(+[WebUndoStep initialize]):
- WebCoreSupport/WebFrameLoaderClient.mm:
(+[WebFramePolicyListener initialize]):
(+[WebArchivePrivate initialize]):
- WebView/WebDataSource.mm:
(+[WebDataSource initialize]):
(+[WebHTMLViewPrivate initialize]):
(+[WebHTMLView initialize]):
- WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(+[WebResourcePrivate initialize]):
- WebView/WebTextIterator.mm:
(+[WebTextIteratorPrivate initialize]):
(+[WebView initialize]):
(+[WebViewPrivate initialize]):
Source/WebKitLegacy/win:
(WebView::WebView):
Source/WTF:
Previously, some code initialized one, some the other, and some both;
and some code tried to initialize more than once; and some code tried
to initialize in ways that would crash but luckily got pre-empted by
other code that had already initialized.
In addition to general confusion, this setup made it subtly high stakes
to call certain functions, like callOnMainThread or
RunLoop::main().dispatch(), because they might crash if the right
initialization had not been performed.
Let's fix that.
(WTF::initializeMainThread): Removed defunct comment about
initializeMainThreadToProcessMainThread. Shrank scope of initializeKey.
(WTF::RunLoop::initializeMain): Don't call initializeMainThread anymore
because it calls us now. No need for a store fence since we run on the
main thread and we don't store anything.
(WTF::RunLoop::initializeWeb): Upgrade to RELEASE_ASSERT.
- wtf/RunLoop.h: Removed incorrect comment. (Fascinating to wonder when
it became incorrect.)
Tools:
Updated TestWebKitAPI to stop using RunLoop::initializeMain directly.
- TestWebKitAPI/Tests/WTF/RefPtr.cpp:
(TestWebKitAPI::TEST):
- TestWebKitAPI/Tests/WTF/RunLoop.cpp:
(TestWebKitAPI::TEST):
- TestWebKitAPI/Tests/WebCore/AbortableTaskQueue.cpp:
(TestWebKitAPI::TEST):
- TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp:
(ApplicationManifestParserTest::SetUp):
- TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
(TestWebKitAPI::ComplexTextControllerTest::SetUp):
- TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::ContentExtensionTest::SetUp):
- TestWebKitAPI/Tests/WebCore/DNS.cpp:
(TestWebKitAPI::TEST):
- TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
(TestWebKitAPI::TEST_F):
- TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:
(initializeInAppBrowserPrivacyTestSettings):
- TestWebKitAPI/TestsController.cpp:
(TestWebKitAPI::TestsController::TestsController):
- WebKitTestRunner/TestController.cpp:
(TestController::initialize):