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

Side by Side Diff: src/heap/memory-reducer.cc

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 unified diff | Download patch
« no previous file with comments | « src/heap/memory-reducer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/memory-reducer.h" 5 #include "src/heap/memory-reducer.h"
6 6
7 #include "src/flags.h" 7 #include "src/flags.h"
8 #include "src/heap/heap.h" 8 #include "src/heap/heap.h"
9 #include "src/utils.h" 9 #include "src/utils.h"
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Leave some room for precision error in task scheduler. 170 // Leave some room for precision error in task scheduler.
171 const double kSlackMs = 100; 171 const double kSlackMs = 100;
172 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap()->isolate()); 172 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap()->isolate());
173 DCHECK(nullptr == pending_task_); 173 DCHECK(nullptr == pending_task_);
174 pending_task_ = new MemoryReducer::TimerTask(this); 174 pending_task_ = new MemoryReducer::TimerTask(this);
175 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( 175 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
176 isolate, pending_task_, (delay_ms + kSlackMs) / 1000.0); 176 isolate, pending_task_, (delay_ms + kSlackMs) / 1000.0);
177 } 177 }
178 178
179 179
180 void MemoryReducer::ClearTask(v8::Task* task) {
181 if (pending_task_ == task) {
182 pending_task_ = nullptr;
183 }
184 }
185
186
180 void MemoryReducer::TearDown() { 187 void MemoryReducer::TearDown() {
181 if (pending_task_ != nullptr) { 188 if (pending_task_ != nullptr) {
182 pending_task_->NotifyHeapTearDown(); 189 pending_task_->NotifyHeapTearDown();
183 pending_task_ = nullptr; 190 pending_task_ = nullptr;
184 } 191 }
185 state_ = State(kDone, 0, 0); 192 state_ = State(kDone, 0, 0);
186 } 193 }
187 194
188 } // internal 195 } // internal
189 } // v8 196 } // v8
OLDNEW
« no previous file with comments | « src/heap/memory-reducer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698