[webkit-changes] [WebKit/WebKit] 6bd11f: Canvas context allocation fails because "Total can...

Dean Jackson noreply at github.com
Thu Jun 29 13:44:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6bd11f3792f05b4e58e5647bf173212879fa62cc
      https://github.com/WebKit/WebKit/commit/6bd11f3792f05b4e58e5647bf173212879fa62cc
  Author: Dean Jackson <dino at apple.com>
  Date:   2023-06-29 (Thu, 29 Jun 2023)

  Changed paths:
    M LayoutTests/fast/canvas/canvas-crash.html
    M LayoutTests/fast/canvas/canvas-skia-excessive-size.html
    R LayoutTests/fast/canvas/canvas-too-large-to-draw-expected.txt
    R LayoutTests/fast/canvas/canvas-too-large-to-draw.html
    M LayoutTests/fast/canvas/large-getImageData.html
    M LayoutTests/platform/wincairo/TestExpectations
    R LayoutTests/webgl/webgl-oom-paint-document-no-crash-expected.html
    R LayoutTests/webgl/webgl-oom-paint-document-no-crash.html
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/html/CanvasBase.h
    M Source/WebCore/html/HTMLCanvasElement.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.idl
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp

  Log Message:
  -----------
  Canvas context allocation fails because "Total canvas memory use exceeds the maximum limit"
https://bugs.webkit.org/show_bug.cgi?id=195325
rdar://48609162

Reviewed by Geoff Garen.

Some pages that use a lot of transient canvas memory can hit our
artificial limits even when they are no longer referencing canvases.
This happens because we don't instantly reclaim memory when we
drop the reference, and instead have to wait for garbage collection.
This problem can also continue between page refreshes.

The limit was introduced many many releases ago when devices had
less memory, and it was more common to accidentally jetsam a page
if you used too much canvas memory. After some internal and external
discussion we've decided to remove the canvas limit and just let the page
follow the same memory restrictions as all other Web features.

This might mean more pages crash (jetsam) than break.

* LayoutTests/fast/canvas/canvas-too-large-to-draw-expected.txt: Removed.
* LayoutTests/fast/canvas/canvas-too-large-to-draw.html: Removed.
* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::allocateImageBuffer const):
(WebCore::CanvasBase::maxActivePixelMemory): Deleted.
(WebCore::CanvasBase::setMaxPixelMemoryForTesting): Deleted.
* Source/WebCore/html/CanvasBase.h:
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createContext2d):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::avoidIOSurfaceSizeCheckInWebProcess):
(WebCore::Internals::setMaxCanvasPixelMemory): Deleted.
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::getPixelBufferForImageBufferWithNewMemory):

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




More information about the webkit-changes mailing list