Commit f7a93fbd authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Fix MockPlatform in IncrementalMarkingUsingTasks test.

Now the mock platform delays all background tasks and forwards them
to the real platform in its destructor.

This fixes a race that happens when the background tasks calls
TestPlatform::MonotonicallyIncreasingTime() while the mock platform
is being destroyed.

BUG: v8:7494
Change-Id: I659ccc19121144152f447d59ff3c5e7ef1bec6d5
Reviewed-on: https://chromium-review.googlesource.com/949202Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51741}
parent 23520d93
......@@ -40,12 +40,20 @@ class MockPlatform : public TestPlatform {
virtual ~MockPlatform() {
delete task_;
i::V8::SetPlatformForTesting(old_platform_);
for (Task* task : worker_tasks_) {
old_platform_->CallOnWorkerThread(task);
}
worker_tasks_.clear();
}
void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override {
task_ = task;
}
void CallOnWorkerThread(Task* task) override {
worker_tasks_.push_back(task);
}
bool IdleTasksEnabled(v8::Isolate* isolate) override { return false; }
bool PendingTask() { return task_ != nullptr; }
......@@ -59,6 +67,7 @@ class MockPlatform : public TestPlatform {
private:
Task* task_;
std::vector<Task*> worker_tasks_;
v8::Platform* old_platform_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment