| Index: services/tracing/public/cpp/provider.cc
|
| diff --git a/services/tracing/public/cpp/provider.cc b/services/tracing/public/cpp/provider.cc
|
| index 47e0ab0c0fc6d74e1777fd84f2bcbb549f913c22..66e3a70cd7dba5eb8c1914a7bccbf7186d49311c 100644
|
| --- a/services/tracing/public/cpp/provider.cc
|
| +++ b/services/tracing/public/cpp/provider.cc
|
| @@ -42,6 +42,30 @@ Provider::~Provider() {
|
| StopTracing();
|
| }
|
|
|
| +void Provider::InitializeWithFactoryInternal(mojom::FactoryPtr* factory) {
|
| + mojom::ProviderPtr provider;
|
| + Bind(GetProxy(&provider));
|
| + (*factory)->CreateRecorder(std::move(provider));
|
| +#ifdef NDEBUG
|
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + tracing::kEarlyTracing)) {
|
| + ForceEnableTracing();
|
| + }
|
| +#else
|
| + ForceEnableTracing();
|
| +#endif
|
| +}
|
| +
|
| +void Provider::InitializeWithFactory(mojom::FactoryPtr* factory) {
|
| + {
|
| + base::AutoLock lock(g_singleton_lock.Get());
|
| + if (g_tracing_singleton_created)
|
| + return;
|
| + g_tracing_singleton_created = true;
|
| + }
|
| + InitializeWithFactoryInternal(factory);
|
| +}
|
| +
|
| void Provider::Initialize(service_manager::Connector* connector,
|
| const std::string& url) {
|
| {
|
| @@ -50,24 +74,12 @@ void Provider::Initialize(service_manager::Connector* connector,
|
| return;
|
| g_tracing_singleton_created = true;
|
| }
|
| -
|
| + mojom::FactoryPtr factory;
|
| + connector->ConnectToInterface("service:tracing", &factory);
|
| + InitializeWithFactoryInternal(&factory);
|
| // This will only set the name for the first app in a loaded mojo file. It's
|
| // up to something like CoreServices to name its own child threads.
|
| base::PlatformThread::SetName(url);
|
| -
|
| - mojom::FactoryPtr factory;
|
| - connector->ConnectToInterface("service:tracing", &factory);
|
| - mojom::ProviderPtr provider;
|
| - Bind(GetProxy(&provider));
|
| - factory->CreateRecorder(std::move(provider));
|
| -#ifdef NDEBUG
|
| - if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - tracing::kEarlyTracing)) {
|
| - ForceEnableTracing();
|
| - }
|
| -#else
|
| - ForceEnableTracing();
|
| -#endif
|
| }
|
|
|
| void Provider::Bind(mojom::ProviderRequest request) {
|
|
|