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

Side by Side Diff: services/service_manager/standalone/context.cc

Issue 2617883002: Add a new BindInterface() method to Connector. (Closed)
Patch Set: . Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/service_manager/standalone/context.h" 5 #include "services/service_manager/standalone/context.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 bool enable_stats_collection_bindings = 196 bool enable_stats_collection_bindings =
197 command_line.HasSwitch(tracing::kEnableStatsCollectionBindings); 197 command_line.HasSwitch(tracing::kEnableStatsCollectionBindings);
198 198
199 if (enable_stats_collection_bindings || 199 if (enable_stats_collection_bindings ||
200 command_line.HasSwitch(switches::kEnableTracing)) { 200 command_line.HasSwitch(switches::kEnableTracing)) {
201 Identity source_identity = CreateServiceManagerIdentity(); 201 Identity source_identity = CreateServiceManagerIdentity();
202 Identity tracing_identity(tracing::mojom::kServiceName, mojom::kRootUserID); 202 Identity tracing_identity(tracing::mojom::kServiceName, mojom::kRootUserID);
203 tracing::mojom::FactoryPtr factory; 203 tracing::mojom::FactoryPtr factory;
204 ConnectToInterface(service_manager(), source_identity, tracing_identity, 204 BindInterface(service_manager(), source_identity, tracing_identity,
205 &factory); 205 &factory);
206 provider_.InitializeWithFactory(&factory); 206 provider_.InitializeWithFactory(&factory);
207 207
208 if (command_line.HasSwitch(tracing::kTraceStartup)) { 208 if (command_line.HasSwitch(tracing::kTraceStartup)) {
209 tracing::mojom::CollectorPtr coordinator; 209 tracing::mojom::CollectorPtr coordinator;
210 ConnectToInterface(service_manager(), source_identity, tracing_identity, 210 BindInterface(service_manager(), source_identity, tracing_identity,
211 &coordinator); 211 &coordinator);
212 tracer_.StartCollectingFromTracingService(std::move(coordinator)); 212 tracer_.StartCollectingFromTracingService(std::move(coordinator));
213 } 213 }
214 214
215 // Record the service manager startup metrics used for performance testing. 215 // Record the service manager startup metrics used for performance testing.
216 if (enable_stats_collection_bindings) { 216 if (enable_stats_collection_bindings) {
217 tracing::mojom::StartupPerformanceDataCollectorPtr collector; 217 tracing::mojom::StartupPerformanceDataCollectorPtr collector;
218 ConnectToInterface(service_manager(), source_identity, tracing_identity, 218 BindInterface(service_manager(), source_identity, tracing_identity,
219 &collector); 219 &collector);
220 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) 220 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
221 // CurrentProcessInfo::CreationTime is only defined on some platforms. 221 // CurrentProcessInfo::CreationTime is only defined on some platforms.
222 const base::Time creation_time = base::CurrentProcessInfo::CreationTime(); 222 const base::Time creation_time = base::CurrentProcessInfo::CreationTime();
223 collector->SetServiceManagerProcessCreationTime( 223 collector->SetServiceManagerProcessCreationTime(
224 creation_time.ToInternalValue()); 224 creation_time.ToInternalValue());
225 #endif 225 #endif
226 collector->SetServiceManagerMainEntryPointTime( 226 collector->SetServiceManagerMainEntryPointTime(
227 main_entry_time_.ToInternalValue()); 227 main_entry_time_.ToInternalValue());
228 } 228 }
229 } 229 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 mojom::InterfaceProviderPtr local_interfaces; 268 mojom::InterfaceProviderPtr local_interfaces;
269 269
270 std::unique_ptr<ConnectParams> params(new ConnectParams); 270 std::unique_ptr<ConnectParams> params(new ConnectParams);
271 params->set_source(CreateServiceManagerIdentity()); 271 params->set_source(CreateServiceManagerIdentity());
272 params->set_target(Identity(name, mojom::kRootUserID)); 272 params->set_target(Identity(name, mojom::kRootUserID));
273 params->set_remote_interfaces(mojo::MakeRequest(&remote_interfaces)); 273 params->set_remote_interfaces(mojo::MakeRequest(&remote_interfaces));
274 service_manager_->Connect(std::move(params)); 274 service_manager_->Connect(std::move(params));
275 } 275 }
276 276
277 } // namespace service_manager 277 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/service_manager.cc ('k') | services/service_manager/tests/connect/connect_test_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698