[webkit-reviews] review granted: [Bug 208265] Make Path::Path(const Path&) and Path::operator=(const Path&) cheap : [Attachment 392280] Address comment

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 3 09:16:59 PST 2020


Darin Adler <darin at apple.com> has granted Wenson Hsieh
<wenson_hsieh at apple.com>'s request for review:
Bug 208265: Make Path::Path(const Path&) and Path::operator=(const Path&) cheap
https://bugs.webkit.org/show_bug.cgi?id=208265

Attachment 392280: Address comment

https://bugs.webkit.org/attachment.cgi?id=392280&action=review




--- Comment #19 from Darin Adler <darin at apple.com> ---
Comment on attachment 392280
  --> https://bugs.webkit.org/attachment.cgi?id=392280
Address comment

View in context: https://bugs.webkit.org/attachment.cgi?id=392280&action=review

I would have used a new bug report for this refinement. Thanks for doing it!

> Source/WebCore/platform/graphics/cg/PathCG.cpp:109
> +	       auto pathToCopy = m_path;
> +	       m_path = CGPathCreateMutableCopy(pathToCopy);
> +	       CFRelease(pathToCopy);

This is going to get simpler when we change m_path to a RetainPtr. It will just
be:

    m_path = CGPathCreateMutableCopy(m_path.get());

However in the mean time, I can’t resist pointing out this alternate, insane,
one-line way to write it, even though I don’t think you will choose it:

    CFRelease(std::exchange(m_path, CGPathCreateMutableCopy(m_path)));


More information about the webkit-reviews mailing list