Commit 0d25815e authored by Eric Seckler's avatar Eric Seckler Committed by Commit Bot

tracing/services: Set the process name for new-style utility services

Utility services are now started in a slightly different way by
UtilityThreadImpl. In the past, their TraceLog process names were set
in UtilityServiceFactory, which is no longer involved for most services.

So, also set the process name in the new service binder.

Bug: 1040525
Change-Id: Ib8900350460ee2711303519d705de3de361fb3f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1993349Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Auto-Submit: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#730094}
parent ec24b76c
......@@ -15,6 +15,7 @@
#include "base/memory/scoped_refptr.h"
#include "base/optional.h"
#include "base/sequenced_task_runner.h"
#include "base/trace_event/trace_log.h"
#include "build/build_config.h"
#include "content/child/child_process.h"
#include "content/public/utility/content_utility_client.h"
......@@ -43,8 +44,13 @@ class ServiceBinderImpl {
// was running in the process.
static auto* service_name_crash_key = base::debug::AllocateCrashKeyString(
"service-name", base::debug::CrashKeySize::Size32);
base::debug::SetCrashKeyString(service_name_crash_key,
receiver->interface_name().value());
const std::string& service_name = receiver->interface_name().value();
base::debug::SetCrashKeyString(service_name_crash_key, service_name);
// Traces should also indicate the service name.
auto* trace_log = base::trace_event::TraceLog::GetInstance();
if (trace_log->IsProcessNameEmpty())
trace_log->set_process_name("Service: " + service_name);
// We watch for and terminate on PEER_CLOSED, but we also terminate if the
// watcher is cancelled (meaning the local endpoint was closed rather than
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment