Bug 302600
| Summary: | Fix main thread initialization when disabling WebThread | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | David Kilzer (:ddkilzer) <ddkilzer> |
| Component: | WebCore Misc. | Assignee: | David Kilzer (:ddkilzer) <ddkilzer> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | 176812 | ||
| Bug Blocks: | |||
David Kilzer (:ddkilzer)
Fix main thread initialization when disabling WebThread.
When WebThread is enabled, WebCore::initializeMainThreadIfNeeded() (via +[WebView initialize]) returns early because WebCore::StartWebThread() performs "main" thread initialization when the WebThread starts.
When WebThread is disabled, WebCore::initializeMainThreadIfNeeded() no longer returns early, which means main thread initialization may now incorrectly occur on a background thread if +[WebView initialize] is called from there.
We must avoid this issue in WebCore::initializeMainThreadIfNeeded() by only initializing the main thread if pthread_main_np() is true, else schedule main thread initialization asynchronously on the main thread (a best-effort) using CFRunLoopPerformBlock().
We can't use synchronous main thread initialization (for example, using a semaphore) in case an app is using their own locking mechanism to initialize WebView on a background thread from the main thread.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/164844902>
David Kilzer (:ddkilzer)
Pull request: https://github.com/WebKit/WebKit/pull/54015
EWS
Committed 303102@main (f89bce6a688c): <https://commits.webkit.org/303102@main>
Reviewed commits have been landed. Closing PR #54015 and removing active labels.