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

Unified Diff: src/heap/gc-idle-time-handler.cc

Issue 1269583002: Fix idle notification for background tab. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: deflake TestIdleNotification by ensuring that sweeping is completed. Created 5 years, 5 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 | « src/heap/gc-idle-time-handler.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/gc-idle-time-handler.cc
diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc
index efce981ee8c2037a60216e222384de34cf7408e8..f76c48bf9e3ed615ac7f04af25bda87b92014eb0 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -114,6 +114,10 @@ bool GCIdleTimeHandler::ShouldDoScavenge(
size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size,
size_t scavenge_speed_in_bytes_per_ms,
size_t new_space_allocation_throughput_in_bytes_per_ms) {
+ if (idle_time_in_ms >= kMinBackgroundIdleTime) {
+ // It is better to do full GC for the background tab.
+ return false;
+ }
size_t new_space_allocation_limit =
kMaxScheduledIdleTime * scavenge_speed_in_bytes_per_ms;
@@ -193,7 +197,10 @@ bool GCIdleTimeHandler::ShouldDoOverApproximateWeakClosure(
}
-GCIdleTimeAction GCIdleTimeHandler::NothingOrDone() {
+GCIdleTimeAction GCIdleTimeHandler::NothingOrDone(double idle_time_in_ms) {
+ if (idle_time_in_ms >= kMinBackgroundIdleTime) {
+ return GCIdleTimeAction::Nothing();
+ }
if (idle_times_which_made_no_progress_ >= kMaxNoProgressIdleTimes) {
return GCIdleTimeAction::Done();
} else {
@@ -232,7 +239,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
// get the right idle signal.
if (ShouldDoContextDisposalMarkCompact(heap_state.contexts_disposed,
heap_state.contexts_disposal_rate)) {
- return NothingOrDone();
+ return NothingOrDone(idle_time_in_ms);
}
if (ShouldDoScavenge(
@@ -247,7 +254,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
if (heap_state.sweeping_completed) {
return GCIdleTimeAction::FinalizeSweeping();
} else {
- return NothingOrDone();
+ return NothingOrDone(idle_time_in_ms);
}
}
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698