[webkit-changes] [WebKit/WebKit] 6939c8: Simplify 2D context memory cost calculations

Kimmo Kinnunen noreply at github.com
Tue May 14 22:52:56 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6939c8db7b65abc775360f3586781a975024dcd0
      https://github.com/WebKit/WebKit/commit/6939c8db7b65abc775360f3586781a975024dcd0
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2024-05-14 (Tue, 14 May 2024)

  Changed paths:
    M Source/WebCore/html/CanvasBase.cpp
    M Source/WebCore/html/CanvasBase.h
    M Source/WebCore/html/OffscreenCanvas.idl
    M Source/WebCore/platform/graphics/ImageBuffer.h
    M Source/WebCore/platform/graphics/ImageBufferBackend.h
    M Source/WebCore/platform/graphics/NullImageBufferBackend.h
    M Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp
    M Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h

  Log Message:
  -----------
  Simplify 2D context memory cost calculations
https://bugs.webkit.org/show_bug.cgi?id=273769
rdar://127601234

Reviewed by Simon Fraser.

Avoid calling into ImageBuffer from GC threads. Instead, use the already
existing CanvasBase member variable to keep track of the canvas memory
use.

Set all the canvas memory as "external memory cost". This is the memory
that is expected to be allocated from other sources than
bmalloc/libcmalloc heap. As 2D context backing store is currently in
GPUP, it cannot be attributed to bmalloc. The Extra/External
calculations are duplicated in other categories, and should be fixed
in other work.

Use the memory cost calculations in OffscreenCanvas, too.

Notify inspector of context changes after all the member state has been
updated. Inspector calls might re-enter calling back any member function
so it's better that the member state is defined.

Remove unused s_activePixelMemory.

* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::memoryCost const):
(WebCore::CanvasBase::externalMemoryCost const):
(WebCore::CanvasBase::setImageBuffer const):
(WebCore::CanvasBase::activePixelMemory): Deleted.
* Source/WebCore/html/CanvasBase.h:
(WebCore::CanvasBase::hasCreatedImageBuffer const):
* Source/WebCore/html/OffscreenCanvas.idl:
* Source/WebCore/platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::populateBackendInfo):
(WebCore::ImageBuffer::memoryCost const):
(WebCore::ImageBuffer::externalMemoryCost const): Deleted.
* Source/WebCore/platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::calculateExternalMemoryCost): Deleted.
* Source/WebCore/platform/graphics/NullImageBufferBackend.h:
* Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::calculateExternalMemoryCost): Deleted.
* Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp:
(WebKit::ImageBufferRemoteIOSurfaceBackend::calculateExternalMemoryCost): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h:

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