Skip to content

Commit

Permalink
Add back inline storage to WebCore::Path
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259326
rdar://112501668

Reviewed by Simon Fraser.

After https://commits.webkit.org/265569@main, we have three separate
heap allocations when creating a WebCore::Path with a single segment.
(The PathStream, the SegmentsData, and its Vector buffer.) These heap
allocations show up on profiles, and were part of a MotionMark Canvas
Lines regression.

* Source/WebCore/platform/graphics/Path.cpp:
(WebCore::Path::Path):
(WebCore::Path::operator=):
(WebCore::Path::operator== const):
(WebCore::Path::setImpl):
(WebCore::Path::ensurePlatformPathImpl):
(WebCore::Path::ensureImpl):
(WebCore::Path::asImpl):
(WebCore::Path::asImpl const):
(WebCore::Path::moveTo):
(WebCore::Path::asSingleMoveTo const):
(WebCore::Path::addLineTo):
(WebCore::Path::addQuadCurveTo):
(WebCore::Path::addBezierCurveTo):
(WebCore::Path::addArcTo):
(WebCore::Path::addArc):
(WebCore::Path::addEllipse):
(WebCore::Path::addEllipseInRect):
(WebCore::Path::addRect):
(WebCore::Path::addRoundedRect):
(WebCore::Path::closeSubpath):
(WebCore::Path::applySegments const):
(WebCore::Path::clear):
(WebCore::Path::singleSegment const):
(WebCore::Path::singleDataLine const):
(WebCore::Path::singleArc const):
(WebCore::Path::singleQuadCurve const):
(WebCore::Path::singleBezierCurve const):
(WebCore::Path::isEmpty const):
(WebCore::Path::segmentsIfExists const):
(WebCore::Path::isClosed const):
(WebCore::Path::currentPoint const):
(WebCore::Path::fastBoundingRect const):
(WebCore::Path::boundingRect const):
* Source/WebCore/platform/graphics/Path.h:
(WebCore::Path::singleSegmentIfExists const):
(WebCore::Path::asSingle):
(WebCore::Path::asSingle const):
* Source/WebCore/platform/graphics/PathStream.cpp:
(WebCore::PathStream::create):
(WebCore::PathStream::PathStream):
(WebCore::PathStream::addArc):
* Source/WebCore/platform/graphics/PathStream.h:

Canonical link: https://commits.webkit.org/266156@main
  • Loading branch information
heycam committed Jul 19, 2023
1 parent bac5d51 commit 816baea
Show file tree
Hide file tree
Showing 5 changed files with 289 additions and 69 deletions.
Loading

0 comments on commit 816baea

Please sign in to comment.