Commit ec8836fb authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Fix test platform to process foreground tasks in order

Any sane platform would process foreground tasks in a FIFO order. Hence
our mock platform in the tests should do the same.

R=ahaas@chromium.org

Bug: v8:7921
Change-Id: Iafe1d9f2eb2a0c168f7e994f05b054756ef9e4af
Reviewed-on: https://chromium-review.googlesource.com/c/1319754
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57283}
parent 70604268
......@@ -54,7 +54,7 @@ class MockPlatform final : public TestPlatform {
class MockTaskRunner final : public TaskRunner {
public:
void PostTask(std::unique_ptr<v8::Task> task) override {
tasks_.push_back(std::move(task));
tasks_.push(std::move(task));
}
void PostDelayedTask(std::unique_ptr<Task> task,
......@@ -70,15 +70,15 @@ class MockPlatform final : public TestPlatform {
void ExecuteTasks() {
while (!tasks_.empty()) {
std::unique_ptr<Task> task = std::move(tasks_.back());
tasks_.pop_back();
std::unique_ptr<Task> task = std::move(tasks_.front());
tasks_.pop();
task->Run();
}
}
private:
// We do not execute tasks concurrently, so we only need one list of tasks.
std::vector<std::unique_ptr<v8::Task>> tasks_;
std::queue<std::unique_ptr<v8::Task>> tasks_;
};
std::shared_ptr<MockTaskRunner> task_runner_;
......
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