[webkit-changes] [WebKit/WebKit] 3a2359: [UnifiedPDF] Satisfy data requests synchronously w...

Simon Fraser noreply at github.com
Fri Mar 15 16:00:47 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3a2359b8709e76a04cbcf07f04052652713e7bde
      https://github.com/WebKit/WebKit/commit/3a2359b8709e76a04cbcf07f04052652713e7bde
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-03-15 (Fri, 15 Mar 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/PDFIncrementalLoader.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm

  Log Message:
  -----------
  [UnifiedPDF] Satisfy data requests synchronously when possible
https://bugs.webkit.org/show_bug.cgi?id=271072
rdar://123061082

Reviewed by Tim Horton.

Previously, fulfilling a PDFKit data request in `PDFIncrementalLoader::dataProviderGetBytesAtPosition()`
and `PDFIncrementalLoader::dataProviderGetByteRanges()` always bounced to the main thread, using a semaphore
to block the calling thread.

But now that access to `m_data` and associated metadata is thread-safe, we can just lock and fulfill
requests directly, when the data has already been loaded, which is most of the time. This vastly
reduces the frequency of deadlocks.

* Source/WebKit/WebProcess/Plugins/PDF/PDFIncrementalLoader.mm:
(WebKit::PDFIncrementalLoader::dataProviderGetBytesAtPosition):
(WebKit::PDFIncrementalLoader::dataProviderGetByteRanges):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::getByteRanges const):

Canonical link: https://commits.webkit.org/276210@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list