Skip to content

Commit a760568

Browse files
SconyPawel Lampe
authored andcommitted
Expose API for sending memory pressure events
1 parent b19f56a commit a760568

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
@@ -5071,6 +5071,13 @@ WebKitWebsitePolicies* webkit_web_view_get_website_policies(WebKitWebView* webVi
50715071
return webView->priv->websitePolicies.get();
50725072
}
50735073

5074+
void webkit_web_view_send_memory_pressure_event(WebKitWebView *webView, gboolean critical)
5075+
{
5076+
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
5077+
5078+
getPage(webView).sendMemoryPressureEvent(critical);
5079+
}
5080+
50745081
void webkitWebViewSetIsWebProcessResponsive(WebKitWebView* webView, bool isResponsive)
50755082
{
50765083
if (webView->priv->isWebProcessResponsive == isResponsive)

Source/WebKit/UIProcess/API/wpe/WebKitWebView.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,10 @@ webkit_web_view_get_tls_info (WebKitWebView
558558
WEBKIT_API WebKitUserContentManager *
559559
webkit_web_view_get_user_content_manager (WebKitWebView *web_view);
560560

561+
WEBKIT_API void
562+
webkit_web_view_send_memory_pressure_event (WebKitWebView *web_view,
563+
gboolean critical);
564+
561565
WEBKIT_API gboolean
562566
webkit_web_view_is_editable (WebKitWebView *web_view);
563567

Source/WebKit/UIProcess/WebPageProxy.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3098,6 +3098,12 @@ const NativeWebKeyboardEvent& WebPageProxy::firstQueuedKeyEvent() const
30983098
return m_keyEventQueue.first();
30993099
}
31003100

3101+
void WebPageProxy::sendMemoryPressureEvent(bool critical) const
3102+
{
3103+
for (auto& processPool : WebProcessPool::allProcessPools())
3104+
processPool->sendMemoryPressureEvent(critical);
3105+
}
3106+
31013107
bool WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
31023108
{
31033109
if (!hasRunningProcess())

Source/WebKit/UIProcess/WebPageProxy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,8 @@ class WebPageProxy final : public API::ObjectImpl<API::Object::Type::Page>
21402140
void clearNotificationPermissionState();
21412141
#endif
21422142

2143+
void sendMemoryPressureEvent(bool critical) const;
2144+
21432145
private:
21442146
WebPageProxy(PageClient&, WebProcessProxy&, Ref<API::PageConfiguration>&&);
21452147
void platformInitialize();

0 commit comments

Comments
 (0)