Skip to content

Commit

Permalink
Cherry-pick 274097.14@webkit-2024.2-embargoed (0bfbed0e1d1a). rdar://…
Browse files Browse the repository at this point in the history
…122181237

    Always build a Gradient identifier to enable resource caching
    https://bugs.webkit.org/show_bug.cgi?id=270480

    Reviewed by Said Abou-Hallawa.

    Gradient is a RenderingResource and it can be cached by DisplayList,
    however, every resource needs an identifier to be cached and a Gradient
    can be created withouth an identifier.

    This patch prevents Gradients without identifiers from being cached.

    * LayoutTests/TestExpectations:
    * LayoutTests/ipc/send-gradient-expected.txt: Added.
    * LayoutTests/ipc/send-gradient.html: Added.
    * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
    (WebKit::RemoteRenderingBackend::cacheGradient):

    Canonical link: https://commits.webkit.org/274097.14@webkit-2024.2-embargoed

Canonical link: https://commits.webkit.org/272448.881@safari-7618-branch
  • Loading branch information
mikhailramalho authored and JonWBedard committed Apr 5, 2024
1 parent beb97ad commit 638de89
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
2 changes: 2 additions & 0 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -5409,6 +5409,8 @@ imported/w3c/web-platform-tests/css/motion/offset-path-shape-xywh-003.html [ Ima

# IPC test failing in Debug mode due to assert.
[ Debug ] ipc/send-invalid-message.html [ Skip ]
webkit.org/b/272000 [ Debug ] ipc/send-gradient.html [ Crash ]

# mac-only IPC test
ipc/webpageproxy-correctionpanel-no-crash.html [ Skip ]

Expand Down
1 change: 1 addition & 0 deletions LayoutTests/ipc/send-gradient-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

60 changes: 60 additions & 0 deletions LayoutTests/ipc/send-gradient.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true ] -->
<body>
<script>
if (window.testRunner)
testRunner.dumpAsText()

if (window.IPC) {
[streamConnection, streamConnectionHandle] = IPC.createStreamClientConnection(14);
streamConnection.open();
IPC.sendMessage(
'GPU',
0,
IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name,
[
{type: 'uint64_t', value: 1872},
{type: 'uint64_t', value: IPC.webPageProxyID},
{type: 'uint64_t', value: IPC.pageID},
{type: 'StreamServerConnectionHandle', value: streamConnectionHandle}
]
);
streamConnection.sendMessage(
1872,
IPC.messages.RemoteRenderingBackend_CacheGradient.name,
0.1,
[
{type: 'uint8_t',value: 1},
{type: 'float',value: 20.91822109052055},
{type: 'float',value: 199.65170247825378},
{type: 'float',value: -631},
{type: 'float',value: 870.2870187910883},
{type: 'float',value: 4238675097},
{type: 'float',value: -671},
{type: 'float',value: 613},
{type: 'uint8_t',value: 6},
{type: 'uint8_t',value: 1},
{type: 'uint8_t',value: 1},
{type: 'Vector',value:
[
[
{type: 'float',value: 4167777921},
{type: 'bool',value: 0}
],
[
{type: 'float',value: 864.3565721604522},
{type: 'bool',value: 1},
{type: 'bool',value: 1},
{type: 'bool',value: 0},
{type: 'uint8_t',value: 0},
{type: 'uint32_t',value: 1022}
]
]
},
{type: 'bool',value: 0}
]
);
} else {
testRunner.notifyDone();
}
</script>
</body>
5 changes: 4 additions & 1 deletion Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ void RemoteRenderingBackend::cacheDecomposedGlyphs(Ref<DecomposedGlyphs>&& decom
void RemoteRenderingBackend::cacheGradient(Ref<Gradient>&& gradient)
{
ASSERT(!RunLoop::isMain());
m_remoteResourceCache.cacheGradient(WTFMove(gradient));
if (gradient->hasValidRenderingResourceIdentifier())
m_remoteResourceCache.cacheGradient(WTFMove(gradient));
else
LOG_WITH_STREAM(DisplayLists, stream << "Received a Gradient without a valid resource identifier");
}

void RemoteRenderingBackend::cacheFilter(Ref<Filter>&& filter)
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit/Platform/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ extern "C" {
M(ContentObservation) \
M(ContextMenu) \
M(DisplayLink) \
M(DisplayLists) \
M(DiskPersistency) \
M(DragAndDrop) \
M(EME) \
Expand Down

0 comments on commit 638de89

Please sign in to comment.