Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5553587

Browse files
committed
[fuchsia] Add more logging for error cases.
1 parent 910395e commit 5553587

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

shell/platform/fuchsia/flutter/component_v1.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ void ComponentV1::OnEngineTerminate(const Engine* shell_holder) {
484484
});
485485

486486
if (found == shell_holders_.end()) {
487+
FML_LOG(ERROR) << "Tried to terminate an unregistered shell holder.";
487488
return;
488489
}
489490

@@ -493,11 +494,15 @@ void ComponentV1::OnEngineTerminate(const Engine* shell_holder) {
493494
auto return_code = shell_holder->GetEngineReturnCode();
494495
if (return_code.has_value()) {
495496
last_return_code_ = {true, return_code.value()};
497+
} else {
498+
FML_LOG(ERROR) << "Failed to get return code from terminated shell holder.";
496499
}
497500

498501
shell_holders_.erase(found);
499502

500503
if (shell_holders_.size() == 0) {
504+
FML_VLOG(-1) << "Killing component because all shell holders have been "
505+
"terminated.";
501506
Kill();
502507
// WARNING: Don't do anything past this point because the delegate may have
503508
// collected this instance via the termination callback.

shell/platform/fuchsia/flutter/component_v2.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ void ComponentV2::OnEngineTerminate(const Engine* shell_holder) {
526526
});
527527

528528
if (found == shell_holders_.end()) {
529+
FML_LOG(ERROR) << "Tried to terminate an unregistered shell holder.";
529530
return;
530531
}
531532

@@ -535,11 +536,15 @@ void ComponentV2::OnEngineTerminate(const Engine* shell_holder) {
535536
auto return_code = shell_holder->GetEngineReturnCode();
536537
if (return_code.has_value()) {
537538
last_return_code_ = {true, return_code.value()};
539+
} else {
540+
FML_LOG(ERROR) << "Failed to get return code from terminated shell holder.";
538541
}
539542

540543
shell_holders_.erase(found);
541544

542545
if (shell_holders_.size() == 0) {
546+
FML_VLOG(-1) << "Killing component because all shell holders have been "
547+
"terminated.";
543548
Kill();
544549
// WARNING: Don't do anything past this point because the delegate may have
545550
// collected this instance via the termination callback.

shell/platform/fuchsia/flutter/engine.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ void Engine::Initialize(
221221
weak = weak_factory_.GetWeakPtr()]() {
222222
task_runner->PostTask([weak]() {
223223
if (weak) {
224+
FML_LOG(ERROR) << "Terminating from session_error_callback";
224225
weak->Terminate();
225226
}
226227
});
@@ -339,6 +340,8 @@ void Engine::Initialize(
339340
weak = weak_factory_.GetWeakPtr()]() {
340341
task_runner->PostTask([weak]() {
341342
if (weak) {
343+
FML_LOG(ERROR) << "Terminating from "
344+
"on_session_listener_error_callback";
342345
weak->Terminate();
343346
}
344347
});
@@ -615,6 +618,7 @@ void Engine::Initialize(
615618
// The engine could have been killed by the caller right after the
616619
// constructor was called but before it could run on the UI thread.
617620
if (weak) {
621+
FML_LOG(ERROR) << "Terminating from on_run_failure";
618622
weak->Terminate();
619623
}
620624
};

shell/platform/fuchsia/flutter/gfx_session_connection.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
#include "gfx_session_connection.h"
66

7-
#include <lib/async/cpp/time.h>
8-
#include <lib/async/default.h>
9-
107
#include <lib/async/cpp/task.h>
8+
#include <lib/async/cpp/time.h>
119
#include <lib/async/default.h>
1210
#include <lib/fit/function.h>
11+
#include <zircon/status.h>
1312

1413
#include "flutter/fml/make_copyable.h"
1514
#include "flutter/fml/time/time_point.h"
@@ -222,8 +221,11 @@ GfxSessionConnection::GfxSessionConnection(
222221

223222
next_presentation_info_.set_presentation_time(0);
224223

225-
session_wrapper_.set_error_handler(
226-
[callback = session_error_callback](zx_status_t status) { callback(); });
224+
session_wrapper_.set_error_handler([callback = session_error_callback](
225+
zx_status_t status) {
226+
FML_LOG(ERROR) << "Session wrapper error: " << zx_status_get_string(status);
227+
callback();
228+
});
227229

228230
// Set the |fuchsia::ui::scenic::OnFramePresented()| event handler that will
229231
// fire every time a set of one or more frames is presented.

0 commit comments

Comments
 (0)