Skip to content

Commit

Permalink
Perform termination in response to session errors on the platform thr…
Browse files Browse the repository at this point in the history
…ead. (flutter#5246)

Follows the same pattern followed for termination in response to isolate shutdown.
  • Loading branch information
chinmaygarde authored May 12, 2018
1 parent 620d2fd commit b14a33c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion content_handler/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@ Engine::Engine(Delegate& delegate,
OnMetricsUpdate on_session_metrics_change_callback = std::bind(
&Engine::OnSessionMetricsDidChange, this, std::placeholders::_1);

fxl::Closure on_session_error_callback = std::bind(&Engine::Terminate, this);
// Session errors may occur on the GPU thread, but we must terminate ourselves
// on the platform thread.
fxl::Closure on_session_error_callback =
[runner = fsl::MessageLoop::GetCurrent()->task_runner(),
weak = weak_factory_.GetWeakPtr()]() {
runner->PostTask([weak]() {
if (weak) {
weak->Terminate();
}
});
};

// Grab the accessibilty context writer that can understand the semtics tree
// on the platform view.
Expand Down

0 comments on commit b14a33c

Please sign in to comment.