Skip to content

Commit c3b13d6

Browse files
magomezpgorszkowski-igalia
authored andcommitted
Add API to send memory pressure events
1 parent c6fa543 commit c3b13d6

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5673,3 +5673,10 @@ pid_t webkit_web_view_get_web_process_identifier(WebKitWebView *webView)
56735673

56745674
return getPage(webView).processID();
56755675
}
5676+
5677+
void webkit_web_view_send_memory_pressure_event(WebKitWebView *webView, gboolean critical)
5678+
{
5679+
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
5680+
5681+
getPage(webView).sendMemoryPressureEvent(critical);
5682+
}

Source/WebKit/UIProcess/API/glib/WebKitWebView.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,10 @@ webkit_web_view_is_web_process_responsive_finish (WebKitWebView
10611061
WEBKIT_API pid_t
10621062
webkit_web_view_get_web_process_identifier (WebKitWebView *web_view);
10631063

1064+
WEBKIT_API void
1065+
webkit_web_view_send_memory_pressure_event (WebKitWebView *web_view,
1066+
gboolean critical);
1067+
10641068
G_END_DECLS
10651069

10661070
#endif

Source/WebKit/UIProcess/WebPageProxy.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14186,6 +14186,12 @@ void WebPageProxy::frameNameChanged(IPC::Connection& connection, WebCore::FrameI
1418614186
});
1418714187
}
1418814188

14189+
void WebPageProxy::sendMemoryPressureEvent(bool critical) const
14190+
{
14191+
for (auto& processPool : WebProcessPool::allProcessPools())
14192+
processPool->sendMemoryPressureEvent(critical);
14193+
}
14194+
1418914195
} // namespace WebKit
1419014196

1419114197
#undef WEBPAGEPROXY_RELEASE_LOG

Source/WebKit/UIProcess/WebPageProxy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,6 +2386,8 @@ class WebPageProxy final : public API::ObjectImpl<API::Object::Type::Page>, publ
23862386

23872387
WebPageProxyMessageReceiverRegistration& messageReceiverRegistration();
23882388

2389+
void sendMemoryPressureEvent(bool critical) const;
2390+
23892391
#if HAVE(ESIM_AUTOFILL_SYSTEM_SUPPORT)
23902392
bool shouldAllowAutoFillForCellularIdentifiers() const;
23912393
#endif

0 commit comments

Comments
 (0)