Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "mojo/runner/context.h" | 5 #include "mojo/runner/context.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/process/process_info.h" | |
| 17 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
| 20 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 21 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
| 22 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 23 #include "components/devtools_service/public/cpp/switches.h" | 24 #include "components/devtools_service/public/cpp/switches.h" |
| 24 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h " | 25 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h " |
| 25 #include "mojo/application/public/cpp/application_connection.h" | 26 #include "mojo/application/public/cpp/application_connection.h" |
| 26 #include "mojo/application/public/cpp/application_delegate.h" | 27 #include "mojo/application/public/cpp/application_delegate.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 | 307 |
| 307 ServiceProviderPtr tracing_service_provider_ptr; | 308 ServiceProviderPtr tracing_service_provider_ptr; |
| 308 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); | 309 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); |
| 309 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 310 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 310 request->url = mojo::String::From("mojo:tracing"); | 311 request->url = mojo::String::From("mojo:tracing"); |
| 311 application_manager_.ConnectToApplication( | 312 application_manager_.ConnectToApplication( |
| 312 nullptr, request.Pass(), std::string(), GURL(""), nullptr, | 313 nullptr, request.Pass(), std::string(), GURL(""), nullptr, |
| 313 tracing_service_provider_ptr.Pass(), | 314 tracing_service_provider_ptr.Pass(), |
| 314 shell::GetPermissiveCapabilityFilter(), base::Closure()); | 315 shell::GetPermissiveCapabilityFilter(), base::Closure()); |
| 315 | 316 |
| 317 // Record the shell process creation time for performance testing. | |
| 318 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 319 switches::kStatsCollectionController)) { | |
| 320 tracing::StartupPerformanceControllerPtr controller; | |
| 321 application_manager_.ConnectToService(GURL("mojo:tracing"), &controller); | |
|
yzshen1
2015/08/13 15:59:12
Please consider directly obtaining a service provi
msw
2015/08/14 23:20:35
Done.
| |
| 322 const base::Time creation_time = base::CurrentProcessInfo::CreationTime(); | |
| 323 controller->SetShellProcessCreationTime(creation_time.ToInternalValue()); | |
| 324 } | |
| 325 | |
| 316 InitDevToolsServiceIfNeeded(&application_manager_, command_line); | 326 InitDevToolsServiceIfNeeded(&application_manager_, command_line); |
| 317 | 327 |
| 318 return true; | 328 return true; |
| 319 } | 329 } |
| 320 | 330 |
| 321 void Context::Shutdown() { | 331 void Context::Shutdown() { |
| 322 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); | 332 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); |
| 323 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 333 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
| 324 task_runners_->shell_runner()); | 334 task_runners_->shell_runner()); |
| 325 embedder::ShutdownIPCSupport(); | 335 embedder::ShutdownIPCSupport(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 base::MessageLoop::current()->Quit(); | 401 base::MessageLoop::current()->Quit(); |
| 392 } else { | 402 } else { |
| 393 app_complete_callback_.Run(); | 403 app_complete_callback_.Run(); |
| 394 } | 404 } |
| 395 } | 405 } |
| 396 } | 406 } |
| 397 } | 407 } |
| 398 | 408 |
| 399 } // namespace runner | 409 } // namespace runner |
| 400 } // namespace mojo | 410 } // namespace mojo |
| OLD | NEW |