[webkit-changes] [WebKit/WebKit] a5473c: [UnifiedPDF] Keep page previews around more aggres...

Simon Fraser noreply at github.com
Thu May 30 09:41:39 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a5473c4f0084ecfaba9cb8a09b2ea86d6e95a820
      https://github.com/WebKit/WebKit/commit/a5473c4f0084ecfaba9cb8a09b2ea86d6e95a820
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-05-30 (Thu, 30 May 2024)

  Changed paths:
    M Source/WebCore/html/PluginDocument.cpp
    M Source/WebCore/html/PluginDocument.h
    M Source/WebCore/page/MemoryRelease.cpp
    M Source/WebCore/plugins/PluginViewBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    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/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/Plugins/PluginView.h

  Log Message:
  -----------
  [UnifiedPDF] Keep page previews around more aggressively
https://bugs.webkit.org/show_bug.cgi?id=273958
rdar://127820531

Reviewed by Abrar Rahman Protyasha.

Page previews are used to show a lower-resolution of the PDF page before we render
high-resolution tiles. They help reduce apparent flashiness when scrolling and zooming.

We currently only retain page previews for pages in the visible area (based on
TiledBacking's `coverageRect`). However, this causes us to throw away and re-render
page previews frequently when scrolling and zooming.

Instead, retain all the page previews, for full-page plugins, and rely on a memory
warning to release those outside the visible area. They are released via a
`releaseMemory()` call that is plumbed through from `releaseCriticalMemory()`.
Doing this only for full-frame plugins avoids the need to traverse the DOM to find
all the PDFPlugin instances.

* Source/WebCore/html/PluginDocument.cpp:
(WebCore::PluginDocument::releaseMemory):
* Source/WebCore/html/PluginDocument.h:
* Source/WebCore/page/MemoryRelease.cpp:
(WebCore::releaseCriticalMemory):
* Source/WebCore/plugins/PluginViewBase.h:
(WebCore::PluginViewBase::releaseMemory):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::releaseMemory):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm:
(WebKit::AsyncPDFRenderer::releaseMemory):
(WebKit::AsyncPDFRenderer::removePreviewForPage):
(WebKit::AsyncPDFRenderer::coverageRectDidChange):
(WebKit::AsyncPDFRenderer::removePagePreviewsOutsideCoverageRect):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::releaseMemory):
(WebKit::UnifiedPDFPlugin::shouldCachePagePreviews const):
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::releaseMemory):
* Source/WebKit/WebProcess/Plugins/PluginView.h:

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