[webkit-changes] [WebKit/WebKit] 4e6afe: [UnifiedPDF] AsyncPDFRenderer should not communica...

Abrar Rahman Protyasha noreply at github.com
Mon Jul 29 12:15:24 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4e6afee99ec042dde4ed258a4d655e44cd70e371
      https://github.com/WebKit/WebKit/commit/4e6afee99ec042dde4ed258a4d655e44cd70e371
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-07-29 (Mon, 29 Jul 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDiscretePresentationController.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDiscretePresentationController.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFScrollingPresentationController.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] AsyncPDFRenderer should not communicate with the PDF plugin
https://bugs.webkit.org/show_bug.cgi?id=277205
rdar://132633659

Reviewed by Simon Fraser.

The async renderer is owned by the presentation controller. The PDF
plugin owns (and creates/destroys on demand) different presentation
controllers over its lifecycle.

In this patch, we choose not to couple the async renderer to a PDF
plugin, but instead to query the presentation controller about
information such as layout, or to delegate some work to the presentation
controller, such as painting background layers. The controller can
choose to gather this data or pass on the work as it sees fit, often in
coordination with the PDF plugin.

This change makes the architecture simpler to reason about, since there
is a plugin that interacts with the web content process, and said plugin
manages, at a time, a single presentation controller and renderer entity,
with no reason for the renderer or the plugin to communicate with each
other.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm:
(WebKit::AsyncPDFRenderer::create):
(WebKit::AsyncPDFRenderer::AsyncPDFRenderer):
(WebKit::AsyncPDFRenderer::releaseMemory):
(WebKit::AsyncPDFRenderer::generatePreviewImageForPage):
(WebKit::AsyncPDFRenderer::didCompletePagePreviewRender):
(WebKit::AsyncPDFRenderer::coverageRectDidChange):
(WebKit::AsyncPDFRenderer::removePagePreviewsOutsideCoverageRect):
(WebKit::AsyncPDFRenderer::renderInfoForTile const):
(WebKit::AsyncPDFRenderer::enqueuePaintWithClip):
(WebKit::AsyncPDFRenderer::serviceRequestQueue):
(WebKit::AsyncPDFRenderer::transferBufferToMainThread):
(WebKit::AsyncPDFRenderer::pdfContentChangedInRect):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDiscretePresentationController.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDiscretePresentationController.mm:
(WebKit::PDFDiscretePresentationController::pageCoverageForContentsRect const):
(WebKit::PDFDiscretePresentationController::pageCoverageAndScalesForContentsRect const):
(WebKit::PDFDiscretePresentationController::updateLayersOnLayoutChange):
(WebKit::PDFDiscretePresentationController::paintBackgroundLayerForRow):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm:
(WebKit::PDFDocumentLayout::nearestPageIndexForDocumentPoint const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.mm:
(WebKit::PDFPresentationController::createForMode):
(WebKit::PDFPresentationController::asyncRenderer):
(WebKit::PDFPresentationController::pluginPDFDocument const):
(WebKit::PDFPresentationController::layoutBoundsForPageAtIndex const):
(WebKit::PDFPresentationController::pluginShouldCachePagePreviews const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFScrollingPresentationController.mm:
(WebKit::PDFScrollingPresentationController::pageCoverageForContentsRect const):
(WebKit::PDFScrollingPresentationController::pageCoverageAndScalesForContentsRect const):
(WebKit::PDFScrollingPresentationController::updatePageBackgroundLayers):
(WebKit::PDFScrollingPresentationController::paintBackgroundLayerForPage):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::setPresentationController):
(WebKit::UnifiedPDFPlugin::paintPDFContent):
(WebKit::UnifiedPDFPlugin::paintPDFSelection):

Account for the deleted plugin methods by replacing calls with namesake
methods exposed through the PDFPresentationController.

(WebKit::UnifiedPDFPlugin::didGeneratePreviewForPage): Deleted.
(WebKit::UnifiedPDFPlugin::pageCoverageForContentsRect const): Deleted.
(WebKit::UnifiedPDFPlugin::pageCoverageAndScalesForContentsRect const): Deleted.
(WebKit::UnifiedPDFPlugin::rowForLayerID const): Deleted.

Remove these methods that are not called anymore. The presentation
controller has enough information, and can ask enough questions to the
plugin, to be able to field these requests itself.

Canonical link: https://commits.webkit.org/281515@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