Skip to content

Commit 80adb19

Browse files
committed
Add API to send memory pressure events
1 parent ba774ca commit 80adb19

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
@@ -5872,3 +5872,10 @@ pid_t webkit_web_view_get_web_process_identifier(WebKitWebView *webView)
58725872

58735873
return getPage(webView).legacyMainFrameProcessID();
58745874
}
5875+
5876+
void webkit_web_view_send_memory_pressure_event(WebKitWebView *webView, gboolean critical)
5877+
{
5878+
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
5879+
5880+
getPage(webView).sendMemoryPressureEvent(critical);
5881+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,10 @@ webkit_web_view_is_web_process_responsive_finish (WebKitWebView
10761076
WEBKIT_API pid_t
10771077
webkit_web_view_get_web_process_identifier (WebKitWebView *web_view);
10781078

1079+
WEBKIT_API void
1080+
webkit_web_view_send_memory_pressure_event (WebKitWebView *web_view,
1081+
gboolean critical);
1082+
10791083
G_END_DECLS
10801084

10811085
#endif

Source/WebKit/UIProcess/WebPageProxy.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16554,6 +16554,12 @@ Ref<AboutSchemeHandler> WebPageProxy::protectedAboutSchemeHandler()
1655416554
return m_aboutSchemeHandler;
1655516555
}
1655616556

16557+
void WebPageProxy::sendMemoryPressureEvent(bool critical) const
16558+
{
16559+
for (auto& processPool : WebProcessPool::allProcessPools())
16560+
processPool->sendMemoryPressureEvent(critical);
16561+
}
16562+
1655716563
} // namespace WebKit
1655816564

1655916565
#undef WEBPAGEPROXY_RELEASE_LOG

Source/WebKit/UIProcess/WebPageProxy.h

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

25632563
WebPageProxyMessageReceiverRegistration& messageReceiverRegistration();
25642564

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

0 commit comments

Comments
 (0)