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

Unified Diff: src/heap/memory-reducer.cc

Issue 1246603002: Don't run the second pass of the pending phantom callbacks if the heap has been torn down. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: update 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/memory-reducer.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/memory-reducer.cc
diff --git a/src/heap/memory-reducer.cc b/src/heap/memory-reducer.cc
index c89d1424e7c5e78e303ae64b7043669571bb4035..be4b43f535aa64fd5a24b34eba6f32087ff2f748 100644
--- a/src/heap/memory-reducer.cc
+++ b/src/heap/memory-reducer.cc
@@ -16,9 +16,12 @@ const int MemoryReducer::kLongDelayMs = 5000;
const int MemoryReducer::kShortDelayMs = 500;
const int MemoryReducer::kMaxNumberOfGCs = 3;
+MemoryReducer::TimerTask::TimerTask(MemoryReducer* memory_reducer)
+ : CancelableTask(memory_reducer->heap()->isolate()),
+ memory_reducer_(memory_reducer) {}
-void MemoryReducer::TimerTask::Run() {
- if (heap_is_torn_down_) return;
+
+void MemoryReducer::TimerTask::RunInternal() {
Heap* heap = memory_reducer_->heap();
Event event;
event.type = kTimer;
@@ -32,10 +35,8 @@ void MemoryReducer::TimerTask::Run() {
void MemoryReducer::NotifyTimer(const Event& event) {
- DCHECK(nullptr != pending_task_);
DCHECK_EQ(kTimer, event.type);
DCHECK_EQ(kWait, state_.action);
- pending_task_ = nullptr;
state_ = Step(state_, event);
if (state_.action == kRun) {
DCHECK(heap()->incremental_marking()->IsStopped());
@@ -170,25 +171,13 @@ void MemoryReducer::ScheduleTimer(double delay_ms) {
// Leave some room for precision error in task scheduler.
const double kSlackMs = 100;
v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap()->isolate());
- DCHECK(nullptr == pending_task_);
- pending_task_ = new MemoryReducer::TimerTask(this);
+ auto timer_task = new MemoryReducer::TimerTask(this);
V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
- isolate, pending_task_, (delay_ms + kSlackMs) / 1000.0);
-}
-
-
-void MemoryReducer::ClearTask(v8::Task* task) {
- if (pending_task_ == task) {
- pending_task_ = nullptr;
- }
+ isolate, timer_task, (delay_ms + kSlackMs) / 1000.0);
}
void MemoryReducer::TearDown() {
- if (pending_task_ != nullptr) {
- pending_task_->NotifyHeapTearDown();
- pending_task_ = nullptr;
- }
state_ = State(kDone, 0, 0);
}
« no previous file with comments | « src/heap/memory-reducer.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698