Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: services/service_manager/standalone/context.cc

Issue 2440903002: Make "all user" services work when packaged. (Closed)
Patch Set: Addressed latest comments and synced. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/service_manager/service_manager.cc ('k') | services/service_manager/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/service_manager/standalone/context.cc
diff --git a/services/service_manager/standalone/context.cc b/services/service_manager/standalone/context.cc
index ed5c5f0f7d397b199cea433badaf1e7a9ed6b94d..181c41a4089d77d6fab086dfdd68481d275ee64c 100644
--- a/services/service_manager/standalone/context.cc
+++ b/services/service_manager/standalone/context.cc
@@ -182,35 +182,39 @@ void Context::Init(std::unique_ptr<InitParams> init_params) {
}
}
-
- Identity source_identity = CreateServiceManagerIdentity();
- Identity tracing_identity("service:tracing", mojom::kRootUserID);
- tracing::mojom::FactoryPtr factory;
- ConnectToInterface(service_manager(), source_identity, tracing_identity,
- &factory);
- provider_.InitializeWithFactory(&factory);
-
- if (command_line.HasSwitch(tracing::kTraceStartup)) {
- tracing::mojom::CollectorPtr coordinator;
+ bool enable_stats_collection_bindings =
+ command_line.HasSwitch(tracing::kEnableStatsCollectionBindings);
+
+ if (enable_stats_collection_bindings ||
+ command_line.HasSwitch(switches::kEnableTracing)) {
+ Identity source_identity = CreateServiceManagerIdentity();
+ Identity tracing_identity("service:tracing", mojom::kRootUserID);
+ tracing::mojom::FactoryPtr factory;
ConnectToInterface(service_manager(), source_identity, tracing_identity,
- &coordinator);
- tracer_.StartCollectingFromTracingService(std::move(coordinator));
- }
+ &factory);
+ provider_.InitializeWithFactory(&factory);
+
+ if (command_line.HasSwitch(tracing::kTraceStartup)) {
+ tracing::mojom::CollectorPtr coordinator;
+ ConnectToInterface(service_manager(), source_identity, tracing_identity,
+ &coordinator);
+ tracer_.StartCollectingFromTracingService(std::move(coordinator));
+ }
- // Record the service manager startup metrics used for performance testing.
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- tracing::kEnableStatsCollectionBindings)) {
- tracing::mojom::StartupPerformanceDataCollectorPtr collector;
- ConnectToInterface(service_manager(), source_identity, tracing_identity,
- &collector);
+ // Record the service manager startup metrics used for performance testing.
+ if (enable_stats_collection_bindings) {
+ tracing::mojom::StartupPerformanceDataCollectorPtr collector;
+ ConnectToInterface(service_manager(), source_identity, tracing_identity,
+ &collector);
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
- // CurrentProcessInfo::CreationTime is only defined on some platforms.
- const base::Time creation_time = base::CurrentProcessInfo::CreationTime();
- collector->SetServiceManagerProcessCreationTime(
- creation_time.ToInternalValue());
+ // CurrentProcessInfo::CreationTime is only defined on some platforms.
+ const base::Time creation_time = base::CurrentProcessInfo::CreationTime();
+ collector->SetServiceManagerProcessCreationTime(
+ creation_time.ToInternalValue());
#endif
- collector->SetServiceManagerMainEntryPointTime(
- main_entry_time_.ToInternalValue());
+ collector->SetServiceManagerMainEntryPointTime(
+ main_entry_time_.ToInternalValue());
+ }
}
}
« no previous file with comments | « services/service_manager/service_manager.cc ('k') | services/service_manager/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698