Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 24845f1b014dd496f6b285c4f2822d7c8d0a9833
      
https://github.com/WebKit/WebKit/commit/24845f1b014dd496f6b285c4f2822d7c8d0a9833
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-09-13 (Sun, 13 Sep 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/ColorInterpolation.cpp
    M Source/WebCore/platform/graphics/ColorInterpolation.h

  Log Message:
  -----------
  interpolateColors() takes its Color arguments by value, ref-churning 
out-of-line colors in gradient stop loops
https://bugs.webkit.org/show_bug.cgi?id=324106
rdar://187322060

Reviewed by Sam Weinig.

interpolateColors() took both of its Color arguments by value. Color is
only 8 bytes, but its copy constructor is not trivial: for out-of-line
colors (extended color spaces such as oklch/lab/display-p3 and color-mix
results) it performs an atomic ref on the ThreadSafeRefCounted
OutOfLineComponents, with a matching deref when the parameter is
destroyed. These are exactly the colors that flow through this path.

The function is called once per gradient stop while building resolved
gradients (Style::interpolateColors callers in StyleGradient.cpp,
including the 9-iteration color-hint replacement loop), so each stop paid
two atomic ref/deref pairs for no reason. The body only reads the
arguments via const methods, so pass them by const reference instead.

* Source/WebCore/platform/graphics/ColorInterpolation.cpp:
(WebCore::interpolateColors):
* Source/WebCore/platform/graphics/ColorInterpolation.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to