Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(970)

Unified Diff: content/renderer/render_thread_impl.cc

Issue 1780523002: Don't do V8 GC on memory pressure notifications in visible renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 8a45ff89f8a7d597954e7406400353c9a92c62e7..a271f795ac44d538d67f0e8fd12d9213f524b132 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -2020,10 +2020,13 @@ void RenderThreadImpl::OnMemoryPressure(
// Trigger full v8 garbage collection on memory pressure notifications.
// This will potentially hang the renderer for a long time, however, when
// we receive a memory pressure notification, we might be about to be
- // killed.
- blink::mainThreadIsolate()->LowMemoryNotification();
- RenderThread::Get()->PostTaskToAllWebWorkers(
- base::Bind(&LowMemoryNotificationOnThisThread));
+ // killed. Because of the janky hang don't do this to foreground
+ // renderers.
+ if (RendererIsHidden()) {
+ blink::mainThreadIsolate()->LowMemoryNotification();
+ RenderThread::Get()->PostTaskToAllWebWorkers(
+ base::Bind(&LowMemoryNotificationOnThisThread));
+ }
}
if (memory_pressure_level ==
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698