Make microtask queue be per thread (flutter/engine#3644)

Previously, it was a static. Doesn't have much effect in practice because we
only use this microtask queue for main isolates, which exist on a single
thread.
This commit is contained in:
Adam Barth
2017-05-04 15:06:43 -07:00
committed by GitHub
parent 456c1066eb
commit 52247beb87
4 changed files with 4 additions and 4 deletions

View File

@@ -172,7 +172,7 @@ void ScheduleMicrotask(Dart_NativeArguments args) {
Dart_Handle closure = Dart_GetNativeArgument(args, 0);
if (LogIfError(closure) || !Dart_IsClosure(closure))
return;
tonic::DartMicrotaskQueue::ScheduleMicrotask(closure);
tonic::DartMicrotaskQueue::GetForCurrentThread()->ScheduleMicrotask(closure);
}
} // namespace blink

View File

@@ -223,7 +223,7 @@ void Window::BeginFrame(ftl::TimePoint frameTime) {
Dart_NewInteger(microseconds),
});
tonic::DartMicrotaskQueue::RunMicrotasks();
tonic::DartMicrotaskQueue::GetForCurrentThread()->RunMicrotasks();
DartInvokeField(library_.value(), "_drawFrame", {});
}

View File

@@ -103,7 +103,7 @@ void RunNonInteractive(ftl::CommandLine initial_command_line,
if (error == tonic::kNoError)
error = task_observer.last_error();
if (error == tonic::kNoError)
error = tonic::DartMicrotaskQueue::GetLastError();
error = tonic::DartMicrotaskQueue::GetForCurrentThread()->GetLastError();
// The script has completed and the engine may not be in a clean state,
// so just stop the process.