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

Side by Side Diff: mojo/runner/context.cc

Issue 1278673002: Add stats collection for telemetry startup.warm.blank_page test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment. Created 5 years, 4 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
« no previous file with comments | « mojo/runner/BUILD.gn ('k') | mojo/runner/switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
27 #include "mojo/application/public/cpp/application_impl.h" 28 #include "mojo/application/public/cpp/application_impl.h"
28 #include "mojo/common/trace_controller_impl.h" 29 #include "mojo/common/trace_controller_impl.h"
29 #include "mojo/common/tracing_impl.h" 30 #include "mojo/common/tracing_impl.h"
30 #include "mojo/edk/embedder/embedder.h" 31 #include "mojo/edk/embedder/embedder.h"
31 #include "mojo/edk/embedder/simple_platform_support.h" 32 #include "mojo/edk/embedder/simple_platform_support.h"
32 #include "mojo/runner/about_fetcher.h" 33 #include "mojo/runner/about_fetcher.h"
33 #include "mojo/runner/in_process_native_runner.h" 34 #include "mojo/runner/in_process_native_runner.h"
34 #include "mojo/runner/out_of_process_native_runner.h" 35 #include "mojo/runner/out_of_process_native_runner.h"
35 #include "mojo/runner/switches.h" 36 #include "mojo/runner/switches.h"
36 #include "mojo/services/tracing/tracing.mojom.h" 37 #include "mojo/services/tracing/public/cpp/switches.h"
38 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
37 #include "mojo/shell/application_loader.h" 39 #include "mojo/shell/application_loader.h"
38 #include "mojo/shell/application_manager.h" 40 #include "mojo/shell/application_manager.h"
39 #include "mojo/shell/switches.h" 41 #include "mojo/shell/switches.h"
40 #include "mojo/util/filename_util.h" 42 #include "mojo/util/filename_util.h"
41 #include "url/gurl.h" 43 #include "url/gurl.h"
42 44
43 namespace mojo { 45 namespace mojo {
44 namespace runner { 46 namespace runner {
45 namespace { 47 namespace {
46 48
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 runner_factory.reset(new InProcessNativeRunnerFactory(this)); 299 runner_factory.reset(new InProcessNativeRunnerFactory(this));
298 application_manager_.set_blocking_pool(task_runners_->blocking_pool()); 300 application_manager_.set_blocking_pool(task_runners_->blocking_pool());
299 application_manager_.set_native_runner_factory(runner_factory.Pass()); 301 application_manager_.set_native_runner_factory(runner_factory.Pass());
300 application_manager_.set_disable_cache( 302 application_manager_.set_disable_cache(
301 base::CommandLine::ForCurrentProcess()->HasSwitch( 303 base::CommandLine::ForCurrentProcess()->HasSwitch(
302 switches::kDisableCache)); 304 switches::kDisableCache));
303 305
304 InitContentHandlers(&application_manager_, command_line); 306 InitContentHandlers(&application_manager_, command_line);
305 InitNativeOptions(&application_manager_, command_line); 307 InitNativeOptions(&application_manager_, command_line);
306 308
309 ServiceProviderPtr service_provider_ptr;
307 ServiceProviderPtr tracing_service_provider_ptr; 310 ServiceProviderPtr tracing_service_provider_ptr;
308 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); 311 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr));
309 mojo::URLRequestPtr request(mojo::URLRequest::New()); 312 mojo::URLRequestPtr request(mojo::URLRequest::New());
310 request->url = mojo::String::From("mojo:tracing"); 313 request->url = mojo::String::From("mojo:tracing");
311 application_manager_.ConnectToApplication( 314 application_manager_.ConnectToApplication(
312 nullptr, request.Pass(), std::string(), GURL(""), nullptr, 315 nullptr, request.Pass(), std::string(), GURL(),
313 tracing_service_provider_ptr.Pass(), 316 GetProxy(&service_provider_ptr), tracing_service_provider_ptr.Pass(),
314 shell::GetPermissiveCapabilityFilter(), base::Closure()); 317 shell::GetPermissiveCapabilityFilter(), base::Closure());
315 318
319 // CurrentProcessInfo::CreationTime() is missing on some platforms.
320 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
321 // Record the shell process creation time for performance testing.
322 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
323 tracing::kEnableStatsCollectionBindings)) {
324 tracing::StartupPerformanceDataCollectorPtr collector;
325 service_provider_ptr->ConnectToService(
326 tracing::StartupPerformanceDataCollector::Name_,
327 GetProxy(&collector).PassMessagePipe());
328 const base::Time creation_time = base::CurrentProcessInfo::CreationTime();
329 collector->SetShellProcessCreationTime(creation_time.ToInternalValue());
330 }
331 #endif
332
316 InitDevToolsServiceIfNeeded(&application_manager_, command_line); 333 InitDevToolsServiceIfNeeded(&application_manager_, command_line);
317 334
318 return true; 335 return true;
319 } 336 }
320 337
321 void Context::Shutdown() { 338 void Context::Shutdown() {
322 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); 339 TRACE_EVENT0("mojo_shell", "Context::Shutdown");
323 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 340 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
324 task_runners_->shell_runner()); 341 task_runners_->shell_runner());
325 embedder::ShutdownIPCSupport(); 342 embedder::ShutdownIPCSupport();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 base::MessageLoop::current()->Quit(); 408 base::MessageLoop::current()->Quit();
392 } else { 409 } else {
393 app_complete_callback_.Run(); 410 app_complete_callback_.Run();
394 } 411 }
395 } 412 }
396 } 413 }
397 } 414 }
398 415
399 } // namespace runner 416 } // namespace runner
400 } // namespace mojo 417 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/runner/BUILD.gn ('k') | mojo/runner/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698