Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 6af1a05d09ef8ba3fbb3f4b3b781c5eedbbfa263..4660a67dd2847e668ca305a780bc8e80a2482488 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -4956,6 +4956,19 @@ void Heap::IdleNotificationEpilogue(GCIdleTimeAction action, |
} |
+void Heap::CheckAndNotifyBackgroundIdleNotification(double idle_time_in_ms, |
+ double now_ms) { |
+ if (idle_time_in_ms >= GCIdleTimeHandler::kMinBackgroundIdleTime) { |
+ MemoryReducer::Event event; |
+ event.type = MemoryReducer::kBackgroundIdleNotification; |
+ event.time_ms = now_ms; |
+ event.can_start_incremental_gc = incremental_marking()->IsStopped() && |
+ incremental_marking()->CanBeActivated(); |
+ memory_reducer_.NotifyBackgroundIdleNotification(event); |
+ } |
+} |
+ |
+ |
double Heap::MonotonicallyIncreasingTimeInMs() { |
return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * |
static_cast<double>(base::Time::kMillisecondsPerSecond); |
@@ -4980,6 +4993,8 @@ bool Heap::IdleNotification(double deadline_in_seconds) { |
double start_ms = MonotonicallyIncreasingTimeInMs(); |
double idle_time_in_ms = deadline_in_ms - start_ms; |
+ CheckAndNotifyBackgroundIdleNotification(idle_time_in_ms, start_ms); |
+ |
tracer()->SampleAllocation(start_ms, NewSpaceAllocationCounter(), |
OldGenerationAllocationCounter()); |