Skip to content

Commit

Permalink
Fix PlayStation build following 278797@main
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274205

Unreviewed build fix.

C++20 makes std::memory_order an enum class, which is pretty,
but the enum itself already existed, so we can use its values directly for greater compatibility.

* Source/WebCore/html/CanvasBase.cpp:
(WebCore::CanvasBase::memoryCost const):
(WebCore::CanvasBase::setImageBuffer const):
std::memory_order::relaxed -> std::memory_order_relaxed

Canonical link: https://commits.webkit.org/278806@main
  • Loading branch information
rkirsling committed May 15, 2024
1 parent 90197c9 commit ced686d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/WebCore/html/CanvasBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void CanvasBase::makeRenderingResultsAvailable(ShouldApplyPostProcessingToDirtyR
size_t CanvasBase::memoryCost() const
{
// May be called from GC threads.
return m_imageBufferMemoryCost.load(std::memory_order::relaxed);
return m_imageBufferMemoryCost.load(std::memory_order_relaxed);
}

#if ENABLE(RESOURCE_USAGE)
Expand Down Expand Up @@ -259,7 +259,7 @@ RefPtr<ImageBuffer> CanvasBase::setImageBuffer(RefPtr<ImageBuffer>&& buffer) con
RefPtr returnBuffer = std::exchange(m_imageBuffer, WTFMove(buffer));

IntSize oldSize = m_size;
size_t oldMemoryCost = m_imageBufferMemoryCost.load(std::memory_order::relaxed);
size_t oldMemoryCost = m_imageBufferMemoryCost.load(std::memory_order_relaxed);
size_t newMemoryCost = 0;
if (m_imageBuffer) {
m_size = m_imageBuffer->truncatedLogicalSize();
Expand All @@ -269,7 +269,7 @@ RefPtr<ImageBuffer> CanvasBase::setImageBuffer(RefPtr<ImageBuffer>&& buffer) con
m_imageBuffer->context().setStrokeThickness(1);
m_contextStateSaver = makeUnique<GraphicsContextStateSaver>(m_imageBuffer->context());
}
m_imageBufferMemoryCost.store(newMemoryCost, std::memory_order::relaxed);
m_imageBufferMemoryCost.store(newMemoryCost, std::memory_order_relaxed);
if (newMemoryCost) {
JSC::JSLockHolder lock(scriptExecutionContext()->vm());
scriptExecutionContext()->vm().heap.reportExtraMemoryAllocated(static_cast<JSCell*>(nullptr), newMemoryCost);
Expand Down

0 comments on commit ced686d

Please sign in to comment.