-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UnifiedPDF] Prepare for thread-safe access to loaded PDF data
https://bugs.webkit.org/show_bug.cgi?id=271019 rdar://124644460 Reviewed by Tim Horton. In a future patch I will be attempting to read loaded PDF data off the main thread, rather than using the semaphore-driven hops to the main thread. In preparation for this, make accessing the various data members related to loaded PDF data thread-safe. In particular, add a Lock to protect `m_data` and `m_streamedBytes`, and move the `RangeSet<Range>>` (which represents ranges of loaded data beyond m_streamedBytes) into PDFPluginBase to be protected by the same lock. Now we need the "check data availability and return data pointer" blocks to be thread-safe, so remove `haveDataForRange()`, and make callers just try to call `dataPtrForRange()` which internally takes the lock for both the checks and the data access. There are code paths that want to avoid checking m_validRanges (the "complete unconditionally" code path); for them, add a CheckValidRanges enum to `dataPtrForRange()`. * Source/WebKit/WebProcess/Plugins/PDF/PDFIncrementalLoader.h: * Source/WebKit/WebProcess/Plugins/PDF/PDFIncrementalLoader.mm: (WebKit::ByteRangeRequest::completeUnconditionally): (WebKit::PDFIncrementalLoader::dataPtrForRange const): (WebKit::PDFIncrementalLoader::incrementalPDFStreamDidReceiveData): (WebKit::PDFIncrementalLoader::requestCompleteIfPossible): (WebKit::PDFIncrementalLoader::requestDidCompleteWithAccumulatedData): (WebKit::PDFIncrementalLoader::ensureDataBufferLength): Deleted. * Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h: (WebKit::PDFPluginBase::WTF_GUARDED_BY_LOCK): (WebKit::PDFPluginBase::streamedBytes const): Deleted. * Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm: (WebKit::PDFPluginBase::teardown): (WebKit::PDFPluginBase::originalData const): (WebKit::PDFPluginBase::streamedBytes const): (WebKit::PDFPluginBase::haveStreamedDataForRange const): (WebKit::PDFPluginBase::copyDataAtPosition const): (WebKit::PDFPluginBase::dataPtrForRange const): (WebKit::PDFPluginBase::insertRangeRequestData): (WebKit::PDFPluginBase::streamDidReceiveData): (WebKit::PDFPluginBase::streamDidFail): (WebKit::PDFPluginBase::addArchiveResource): (WebKit::PDFPluginBase::incrementalLoaderLog): (WebKit::PDFPluginBase::haveDataForRange const): Deleted. Canonical link: https://commits.webkit.org/276171@main
- Loading branch information
Showing
4 changed files
with
90 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters