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

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

Issue 1234513003: Correctly handle the case when TimerTask is destroyed with being run. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/heap/memory-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/memory-reducer.h
diff --git a/src/heap/memory-reducer.h b/src/heap/memory-reducer.h
index 4d15afa2e2dc5eee75680b820796da1b5a78c74c..0371f9d1b807062964a680a4da0177c133dd99e2 100644
--- a/src/heap/memory-reducer.h
+++ b/src/heap/memory-reducer.h
@@ -114,7 +114,7 @@ class MemoryReducer {
// Posts a timer task that will call NotifyTimer after the given delay.
void ScheduleTimer(double delay_ms);
void TearDown();
-
+ void ClearTask(v8::Task* task);
static const int kLongDelayMs;
static const int kShortDelayMs;
static const int kMaxNumberOfGCs;
@@ -126,7 +126,11 @@ class MemoryReducer {
public:
explicit TimerTask(MemoryReducer* memory_reducer)
: memory_reducer_(memory_reducer), heap_is_torn_down_(false) {}
- virtual ~TimerTask() {}
+ virtual ~TimerTask() {
+ if (!heap_is_torn_down_) {
+ memory_reducer_->ClearTask(this);
+ }
+ }
void NotifyHeapTearDown() { heap_is_torn_down_ = true; }
private:
« no previous file with comments | « no previous file | src/heap/memory-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698