Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::ScriptCompletionTaskObserver Class Reference

Public Member Functions

 ScriptCompletionTaskObserver (Shell &shell, fml::RefPtr< fml::TaskRunner > main_task_runner, bool run_forever)
 
int GetExitCodeForLastError () const
 
void DidProcessTask ()
 

Detailed Description

Definition at line 273 of file tester_main.cc.

Constructor & Destructor Documentation

◆ ScriptCompletionTaskObserver()

flutter::ScriptCompletionTaskObserver::ScriptCompletionTaskObserver ( Shell shell,
fml::RefPtr< fml::TaskRunner main_task_runner,
bool  run_forever 
)
inline

Definition at line 275 of file tester_main.cc.

278 : shell_(shell),
279 main_task_runner_(std::move(main_task_runner)),
280 run_forever_(run_forever) {}

Member Function Documentation

◆ DidProcessTask()

void flutter::ScriptCompletionTaskObserver::DidProcessTask ( )
inline

Definition at line 286 of file tester_main.cc.

286 {
287 last_error_ = shell_.GetUIIsolateLastError();
288 if (shell_.EngineHasLivePorts()) {
289 // The UI isolate still has live ports and is running. Nothing to do
290 // just yet.
291 return;
292 }
293
294 if (run_forever_) {
295 // We need this script to run forever. We have already recorded the last
296 // error. Keep going.
297 return;
298 }
299
300 if (!has_terminated_) {
301 // Only try to terminate the loop once.
302 has_terminated_ = true;
303 fml::TaskRunner::RunNowOrPostTask(main_task_runner_, []() {
305 });
306 }
307 }
std::optional< DartErrorCode > GetUIIsolateLastError() const
Used by embedders to get the last error from the Dart UI Isolate, if one exists.
Definition: shell.cc:697
bool EngineHasLivePorts() const
Used by embedders to check if the Engine is running and has any live ports remaining....
Definition: shell.cc:717
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
Definition: message_loop.cc:19
static void RunNowOrPostTask(const fml::RefPtr< fml::TaskRunner > &runner, const fml::closure &task)
Definition: task_runner.cc:55

◆ GetExitCodeForLastError()

int flutter::ScriptCompletionTaskObserver::GetExitCodeForLastError ( ) const
inline

Definition at line 282 of file tester_main.cc.

282 {
283 return static_cast<int>(last_error_.value_or(DartErrorCode::NoError));
284 }
@ NoError
No error has occurred.

The documentation for this class was generated from the following file: