diff --git a/engine/src/flutter/shell/platform/fuchsia/dart/dart_runner.cc b/engine/src/flutter/shell/platform/fuchsia/dart/dart_runner.cc index 670cb90923..200500d2c9 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart/dart_runner.cc +++ b/engine/src/flutter/shell/platform/fuchsia/dart/dart_runner.cc @@ -189,7 +189,14 @@ void DartRunner::StartComponent( fuchsia::sys::Package package, fuchsia::sys::StartupInfo startup_info, ::fidl::InterfaceRequest controller) { - TRACE_EVENT1("dart", "StartComponent", "url", package.resolved_url.c_str()); + // TRACE_DURATION currently requires that the string data does not change + // in the traced scope. Since |package| gets moved in the construction of + // |thread| below, we cannot ensure that |package.resolved_url| does not + // move or change, so we make a copy to pass to TRACE_DURATION. + // TODO(PT-169): Remove this copy when TRACE_DURATION reads string arguments + // eagerly. + std::string url_copy = package.resolved_url; + TRACE_EVENT1("dart", "StartComponent", "url", url_copy.c_str()); std::thread thread(RunApplication, this, std::move(package), std::move(startup_info), context_->svc(), std::move(controller)); diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/runner.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/runner.cc index c61f59bc3d..8ad10e72e5 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/runner.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/runner.cc @@ -137,7 +137,14 @@ void Runner::StartComponent( fuchsia::sys::Package package, fuchsia::sys::StartupInfo startup_info, fidl::InterfaceRequest controller) { - TRACE_EVENT0("flutter", "StartComponent"); + // TRACE_DURATION currently requires that the string data does not change + // in the traced scope. Since |package| gets moved in the Application::Create + // call below, we cannot ensure that |package.resolved_url| does not move or + // change, so we make a copy to pass to TRACE_DURATION. + // TODO(PT-169): Remove this copy when TRACE_DURATION reads string arguments + // eagerly. + std::string url_copy = package.resolved_url; + TRACE_EVENT1("flutter", "StartComponent", "url", url_copy.c_str()); // Notes on application termination: Application typically terminate on the // thread on which they were created. This usually means the thread was // specifically created to host the application. But we want to ensure that