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

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

Issue 1230163002: Disable the pending task if the memory reducer is torn down. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix check 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/heap.cc ('k') | 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 fc7b2eaee569b34add4501d2874fde953d5b3c6f..4d15afa2e2dc5eee75680b820796da1b5a78c74c 100644
--- a/src/heap/memory-reducer.h
+++ b/src/heap/memory-reducer.h
@@ -101,7 +101,8 @@ class MemoryReducer {
bool can_start_incremental_gc;
};
- explicit MemoryReducer(Heap* heap) : heap_(heap), state_(kDone, 0, 0.0) {}
+ explicit MemoryReducer(Heap* heap)
+ : heap_(heap), state_(kDone, 0, 0.0), pending_task_(nullptr) {}
// Callbacks.
void NotifyTimer(const Event& event);
void NotifyMarkCompact(const Event& event);
@@ -112,6 +113,7 @@ class MemoryReducer {
static State Step(const State& state, const Event& event);
// Posts a timer task that will call NotifyTimer after the given delay.
void ScheduleTimer(double delay_ms);
+ void TearDown();
static const int kLongDelayMs;
static const int kShortDelayMs;
@@ -123,18 +125,20 @@ class MemoryReducer {
class TimerTask : public v8::Task {
public:
explicit TimerTask(MemoryReducer* memory_reducer)
- : memory_reducer_(memory_reducer) {}
+ : memory_reducer_(memory_reducer), heap_is_torn_down_(false) {}
virtual ~TimerTask() {}
+ void NotifyHeapTearDown() { heap_is_torn_down_ = true; }
private:
// v8::Task overrides.
void Run() override;
MemoryReducer* memory_reducer_;
+ bool heap_is_torn_down_;
DISALLOW_COPY_AND_ASSIGN(TimerTask);
};
-
Heap* heap_;
State state_;
+ TimerTask* pending_task_;
DISALLOW_COPY_AND_ASSIGN(MemoryReducer);
};
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/memory-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698