[webkit-changes] [WebKit/WebKit] 4905aa: Reduce indirection in Path / PathStream

Chris Dumez noreply at github.com
Thu Oct 5 10:22:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4905aa0e344500a0fcbbc873abed049ba6dd28c4
      https://github.com/WebKit/WebKit/commit/4905aa0e344500a0fcbbc873abed049ba6dd28c4
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-10-05 (Thu, 05 Oct 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/Path.cpp
    M Source/WebCore/platform/graphics/Path.h
    M Source/WebCore/platform/graphics/PathImpl.h
    M Source/WebCore/platform/graphics/PathStream.cpp
    M Source/WebCore/platform/graphics/PathStream.h
    M Source/WebCore/platform/graphics/cairo/PathCairo.cpp
    M Source/WebCore/platform/graphics/cairo/PathCairo.h
    M Source/WebCore/platform/graphics/cg/PathCG.cpp
    M Source/WebCore/platform/graphics/cg/PathCG.h

  Log Message:
  -----------
  Reduce indirection in Path / PathStream
https://bugs.webkit.org/show_bug.cgi?id=262623

Reviewed by Simon Fraser.

Reduce indirection in Path / PathStream. PathStream now olds the vector of
segments directly instead of using another heap-allocated refcounted object
to hold the segment vector. This refcounted object was used to facilitate
sharing and copy on write. However, we can achieve the same thing by having
the Path objects sharing the same PathStream and cloning the PathStream only
on write.

Path::ensureImpl() was showing as a big source of fastMalloc() in profiles
and this should help with that.

* Source/WebCore/platform/graphics/Path.cpp:
(WebCore::Path::Path):
(WebCore::Path::operator== const):
(WebCore::Path::setImpl):
(WebCore::Path::asImpl):
(WebCore::Path::asImpl const):
(WebCore::Path::operator=): Deleted.
* Source/WebCore/platform/graphics/Path.h:
* Source/WebCore/platform/graphics/PathImpl.h:
* Source/WebCore/platform/graphics/PathStream.cpp:
(WebCore::PathStream::create):
(WebCore::PathStream::PathStream):
(WebCore::PathStream::copy const):
(WebCore::PathStream::lastIfMoveTo const):
(WebCore::PathStream::applySegments const):
(WebCore::PathStream::applyElements const):
(WebCore::PathStream::transform):
(WebCore::PathStream::singleSegment const):
(WebCore::PathStream::isClosed const):
(WebCore::PathStream::currentPoint const):
(WebCore::PathStream::fastBoundingRect const):
(WebCore::PathStream::boundingRect const):
(WebCore::PathStream::clone const): Deleted.
(WebCore::PathStream::operator== const): Deleted.
(WebCore::PathStream::segments const): Deleted.
* Source/WebCore/platform/graphics/PathStream.h:
* Source/WebCore/platform/graphics/cg/PathCG.cpp:
(WebCore::PathCG::create):
(WebCore::PathCG::copy const):
(WebCore::PathCG::clone const): Deleted.
(WebCore::PathCG::operator== const): Deleted.
* Source/WebCore/platform/graphics/cg/PathCG.h:

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




More information about the webkit-changes mailing list