[heap] Correctly restore platform in IncrementalMarkingUsingTasks test.

Bug: 
Change-Id: I9003407826865f1befb0ea7de60aa9fce2766da7
Reviewed-on: https://chromium-review.googlesource.com/814675
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49955}
This commit is contained in:
Ulan Degenbaev 2017-12-07 18:19:13 +01:00 committed by Commit Bot
parent 1614388fd6
commit e91234c1a4

View File

@ -33,11 +33,14 @@ namespace heap {
class MockPlatform : public TestPlatform {
public:
MockPlatform() : task_(nullptr) {
MockPlatform() : task_(nullptr), old_platform_(i::V8::GetCurrentPlatform()) {
// Now that it's completely constructed, make this the current platform.
i::V8::SetPlatformForTesting(this);
}
virtual ~MockPlatform() { delete task_; }
virtual ~MockPlatform() {
delete task_;
i::V8::SetPlatformForTesting(old_platform_);
}
void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override {
task_ = task;
@ -56,6 +59,7 @@ class MockPlatform : public TestPlatform {
private:
Task* task_;
v8::Platform* old_platform_;
};
TEST(IncrementalMarkingUsingTasks) {