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

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

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/global-handles.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 0371f9d1b807062964a680a4da0177c133dd99e2..3d281d302edba94cddcd9f518ea41bb2fae3f0e9 100644
--- a/src/heap/memory-reducer.h
+++ b/src/heap/memory-reducer.h
@@ -7,6 +7,7 @@
#include "include/v8-platform.h"
#include "src/base/macros.h"
+#include "src/cancelable-task.h"
namespace v8 {
namespace internal {
@@ -101,10 +102,8 @@ class MemoryReducer {
bool can_start_incremental_gc;
};
- explicit MemoryReducer(Heap* heap)
- : heap_(heap), state_(kDone, 0, 0.0), pending_task_(nullptr) {}
+ explicit MemoryReducer(Heap* heap) : heap_(heap), state_(kDone, 0, 0.0) {}
// Callbacks.
- void NotifyTimer(const Event& event);
void NotifyMarkCompact(const Event& event);
void NotifyContextDisposed(const Event& event);
void NotifyBackgroundIdleNotification(const Event& event);
@@ -114,7 +113,6 @@ 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;
@@ -122,27 +120,21 @@ class MemoryReducer {
Heap* heap() { return heap_; }
private:
- class TimerTask : public v8::Task {
+ class TimerTask : public v8::internal::CancelableTask {
public:
- explicit TimerTask(MemoryReducer* memory_reducer)
- : memory_reducer_(memory_reducer), heap_is_torn_down_(false) {}
- virtual ~TimerTask() {
- if (!heap_is_torn_down_) {
- memory_reducer_->ClearTask(this);
- }
- }
- void NotifyHeapTearDown() { heap_is_torn_down_ = true; }
+ explicit TimerTask(MemoryReducer* memory_reducer);
private:
- // v8::Task overrides.
- void Run() override;
+ // v8::internal::CancelableTask overrides.
+ void RunInternal() override;
MemoryReducer* memory_reducer_;
- bool heap_is_torn_down_;
DISALLOW_COPY_AND_ASSIGN(TimerTask);
};
+
+ void NotifyTimer(const Event& event);
+
Heap* heap_;
State state_;
- TimerTask* pending_task_;
DISALLOW_COPY_AND_ASSIGN(MemoryReducer);
};
« no previous file with comments | « src/global-handles.cc ('k') | src/heap/memory-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698