Skip to content

Commit fb1f93a

Browse files
magomezspenap
authored andcommitted
Add API to send memory pressure events
1 parent 1a127f5 commit fb1f93a

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

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

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

58665866
return getPage(webView).legacyMainFrameProcessID();
58675867
}
5868+
5869+
void webkit_web_view_send_memory_pressure_event(WebKitWebView *webView, gboolean critical)
5870+
{
5871+
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
5872+
5873+
getPage(webView).sendMemoryPressureEvent(critical);
5874+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,10 @@ webkit_web_view_is_web_process_responsive_finish (WebKitWebView
10701070
WEBKIT_API pid_t
10711071
webkit_web_view_get_web_process_identifier (WebKitWebView *web_view);
10721072

1073+
WEBKIT_API void
1074+
webkit_web_view_send_memory_pressure_event (WebKitWebView *web_view,
1075+
gboolean critical);
1076+
10731077
G_END_DECLS
10741078

10751079
#endif

Source/WebKit/UIProcess/WebPageProxy.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16533,6 +16533,12 @@ Ref<AboutSchemeHandler> WebPageProxy::protectedAboutSchemeHandler()
1653316533
return m_aboutSchemeHandler;
1653416534
}
1653516535

16536+
void WebPageProxy::sendMemoryPressureEvent(bool critical) const
16537+
{
16538+
for (auto& processPool : WebProcessPool::allProcessPools())
16539+
processPool->sendMemoryPressureEvent(critical);
16540+
}
16541+
1653616542
} // namespace WebKit
1653716543

1653816544
#undef WEBPAGEPROXY_RELEASE_LOG

Source/WebKit/UIProcess/WebPageProxy.h

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

25622562
WebPageProxyMessageReceiverRegistration& messageReceiverRegistration();
25632563

2564+
void sendMemoryPressureEvent(bool critical) const;
2565+
25642566
#if HAVE(ESIM_AUTOFILL_SYSTEM_SUPPORT)
25652567
bool shouldAllowAutoFillForCellularIdentifiers() const;
25662568
#endif

0 commit comments

Comments
 (0)