diff --git a/shell/browser/api/electron_api_content_tracing.cc b/shell/browser/api/electron_api_content_tracing.cc index b48daa90dbc1..aa1047c40302 100644 --- a/shell/browser/api/electron_api_content_tracing.cc +++ b/shell/browser/api/electron_api_content_tracing.cc @@ -67,7 +67,7 @@ absl::optional CreateTemporaryFileOnIO() { void StopTracing(gin_helper::Promise promise, absl::optional file_path) { - auto resolve_or_reject = base::AdaptCallbackForRepeating(base::BindOnce( + auto resolve_or_reject = base::BindOnce( [](gin_helper::Promise promise, const base::FilePath& path, absl::optional error) { if (error) { @@ -76,17 +76,21 @@ void StopTracing(gin_helper::Promise promise, promise.Resolve(path); } }, - std::move(promise), *file_path)); + std::move(promise), *file_path); if (file_path) { + auto split_callback = base::SplitOnceCallback(std::move(resolve_or_reject)); auto endpoint = TracingController::CreateFileEndpoint( - *file_path, base::BindRepeating(resolve_or_reject, absl::nullopt)); + *file_path, + base::BindOnce(std::move(split_callback.first), absl::nullopt)); if (!TracingController::GetInstance()->StopTracing(endpoint)) { - resolve_or_reject.Run(absl::make_optional( - "Failed to stop tracing (was a trace in progress?)")); + std::move(split_callback.second) + .Run(absl::make_optional( + "Failed to stop tracing (was a trace in progress?)")); } } else { - resolve_or_reject.Run( - absl::make_optional("Failed to create temporary file for trace data")); + std::move(resolve_or_reject) + .Run(absl::make_optional( + "Failed to create temporary file for trace data")); } }