Changeset 263575 in webkit for trunk/Source/JavaScriptCore/shell


Ignore:
Timestamp:
Jun 26, 2020, 12:28:18 PM (5 years ago)
Author:
[email protected]
Message:

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:

  • WebDriverService.cpp:

(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]):

  • Misc/WebCache.mm:

(+[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]):

  • WebView/WebArchive.mm:

(+[WebArchivePrivate initialize]):

  • WebView/WebDataSource.mm:

(+[WebDataSource initialize]):

  • WebView/WebHTMLView.mm:

(+[WebHTMLViewPrivate initialize]):
(+[WebHTMLView initialize]):

  • WebView/WebPreferences.mm:

(+[WebPreferences initialize]):

  • WebView/WebResource.mm:

(+[WebResourcePrivate initialize]):

  • WebView/WebTextIterator.mm:

(+[WebTextIteratorPrivate initialize]):

  • WebView/WebView.mm:

(+[WebView initialize]):

  • WebView/WebViewData.mm:

(+[WebViewPrivate initialize]):

Source/WebKitLegacy/win:

  • WebView.cpp:

(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/MainThread.cpp:

(WTF::initializeMainThread): Removed defunct comment about
initializeMainThreadToProcessMainThread. Shrank scope of initializeKey.

  • wtf/RunLoop.cpp:

(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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/shell/playstation/TestShell.cpp

    r252243 r263575  
    3131    // threading yet, since that would do somethings that we'd like to defer until after we
    3232    // have a chance to parse options.
    33     WTF::initializeThreading();
     33    WTF::initializeMainThread();
    3434
    3535    // Need to override and enable restricted options before we start parsing options below.
    3636    Config::enableRestrictedOptions();
    3737
    38     // Initialize JSC before getting VM.
    39     WTF::initializeMainThread();
    4038    JSC::initializeThreading();
    4139
Note: See TracChangeset for help on using the changeset viewer.