Chromium Code Reviews| Index: mojo/services/tracing/tracing_app.cc |
| diff --git a/mojo/services/tracing/tracing_app.cc b/mojo/services/tracing/tracing_app.cc |
| index 5409799f2086e13623a4d54e8395a09d56096796..e30f4daaa7fa5416601128698446e3ea608beb20 100644 |
| --- a/mojo/services/tracing/tracing_app.cc |
| +++ b/mojo/services/tracing/tracing_app.cc |
| @@ -38,6 +38,7 @@ TracingApp::~TracingApp() {} |
| bool TracingApp::ConfigureIncomingConnection( |
| mojo::ApplicationConnection* connection) { |
| connection->AddService<TraceCoordinator>(this); |
| + connection->AddService<StartupPerformanceController>(this); |
| // If someone connects to us they may want to use the TraceCoordinator |
| // interface and/or they may want to expose themselves to be traced. Attempt |
| @@ -46,7 +47,8 @@ bool TracingApp::ConfigureIncomingConnection( |
| // close the pipe if not. |
| TraceControllerPtr controller_ptr; |
| connection->ConnectToService(&controller_ptr); |
| - controller_ptrs_.AddInterfacePtr(controller_ptr.Pass()); |
| + if (controller_ptr.get()) |
| + controller_ptrs_.AddInterfacePtr(controller_ptr.Pass()); |
| return true; |
| } |
| @@ -56,6 +58,12 @@ void TracingApp::Create( |
| coordinator_bindings_.AddBinding(this, request.Pass()); |
| } |
| +void TracingApp::Create( |
| + mojo::ApplicationConnection* connection, |
| + mojo::InterfaceRequest<StartupPerformanceController> request) { |
| + startup_performance_controller_bindings_.AddBinding(this, request.Pass()); |
| +} |
| + |
| void TracingApp::Start(mojo::ScopedDataPipeProducerHandle stream, |
| const mojo::String& categories) { |
| sink_.reset(new TraceDataSink(stream.Pass())); |
| @@ -81,6 +89,41 @@ void TracingApp::StopAndFlush() { |
| base::TimeDelta::FromSeconds(1)); |
| } |
| +void TracingApp::SetShellProcessCreationTime(int64 time) { |
| + if (startup_performance_times_.shell_process_creation_time == 0) |
| + startup_performance_times_.shell_process_creation_time = time; |
| +} |
| + |
| +void TracingApp::SetBrowserMessageLoopStartTime(int64 time) { |
| + if (startup_performance_times_.browser_message_loop_start_time == 0) |
| + startup_performance_times_.browser_message_loop_start_time = time; |
| +} |
| + |
| +void TracingApp::SetBrowserWindowDisplayTime(int64 time) { |
| + if (startup_performance_times_.browser_window_display_time == 0) |
| + startup_performance_times_.browser_window_display_time = time; |
| +} |
| + |
| +void TracingApp::SetBrowserOpenTabsTime(int64 time) { |
| + if (startup_performance_times_.browser_open_tabs_time == 0) |
| + startup_performance_times_.browser_open_tabs_time = time; |
| +} |
| + |
| +void TracingApp::SetFirstWebContentsMainFrameLoadTime(int64 time) { |
| + if (startup_performance_times_.first_web_contents_main_frame_load_time == 0) |
| + startup_performance_times_.first_web_contents_main_frame_load_time = time; |
| +} |
| + |
| +void TracingApp::SetFirstVisuallyNonEmptyLayoutTime(int64 time) { |
| + if (startup_performance_times_.first_visually_non_empty_layout_time == 0) |
| + startup_performance_times_.first_visually_non_empty_layout_time = time; |
| +} |
| + |
| +void TracingApp::GetStartupPerformanceTimes( |
| + const GetStartupPerformanceTimesCallback& callback) { |
| + callback.Run(startup_performance_times_.Clone().Pass()); |
|
yzshen1
2015/08/13 15:59:12
nit: Pass() could be omitted in this case.
msw
2015/08/14 23:20:35
Done.
|
| +} |
| + |
| void TracingApp::AllDataCollected() { |
| collector_impls_.clear(); |
| sink_->Flush(); |