Reviewers: Michael Achenbach,

Description:
Version 4.6.1.1 (cherry-pick)

Merged 530e36d7b306fa5a7afb637e605f40cca35256fc

Correctly handle the case when TimerTask is destroyed with being run.

BUG=chromium:508584
LOG=N
[email protected]

Please review this at https://codereview.chromium.org/1236463003/

Base URL: https://chromium.googlesource.com/v8/[email protected]

Affected files (+14, -3 lines):
  M include/v8-version.h
  M src/heap/memory-reducer.h
  M src/heap/memory-reducer.cc


Index: include/v8-version.h
diff --git a/include/v8-version.h b/include/v8-version.h
index 609a447edcba7b80af67f0ac2d3bd97fa3ad1946..adb535665c839ff5b94ee60fad85e7f592f417c4 100644
--- a/include/v8-version.h
+++ b/include/v8-version.h
@@ -11,7 +11,7 @@
 #define V8_MAJOR_VERSION 4
 #define V8_MINOR_VERSION 6
 #define V8_BUILD_NUMBER 1
-#define V8_PATCH_LEVEL 0
+#define V8_PATCH_LEVEL 1

 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
Index: src/heap/memory-reducer.cc
diff --git a/src/heap/memory-reducer.cc b/src/heap/memory-reducer.cc
index 2e0ccb9de6a07ebac1ea37141af7e25c7586f487..c89d1424e7c5e78e303ae64b7043669571bb4035 100644
--- a/src/heap/memory-reducer.cc
+++ b/src/heap/memory-reducer.cc
@@ -177,6 +177,13 @@ void MemoryReducer::ScheduleTimer(double delay_ms) {
 }


+void MemoryReducer::ClearTask(v8::Task* task) {
+  if (pending_task_ == task) {
+    pending_task_ = nullptr;
+  }
+}
+
+
 void MemoryReducer::TearDown() {
   if (pending_task_ != nullptr) {
     pending_task_->NotifyHeapTearDown();
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:


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to