OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/services/tracing/tracing_app.h" | 5 #include "mojo/services/tracing/tracing_app.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <utility> | 10 #include <utility> |
8 | 11 |
9 #include "base/bind.h" | 12 #include "base/bind.h" |
10 #include "base/logging.h" | 13 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
12 #include "mojo/application/public/cpp/application_connection.h" | 15 #include "mojo/application/public/cpp/application_connection.h" |
13 | 16 |
14 namespace tracing { | 17 namespace tracing { |
15 | 18 |
16 TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) { | 19 TracingApp::TracingApp() : collector_binding_(this), tracing_active_(false) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (satisfied & MOJO_HANDLE_SIGNAL_READABLE) | 125 if (satisfied & MOJO_HANDLE_SIGNAL_READABLE) |
123 recorder_impls_[index]->TryRead(); | 126 recorder_impls_[index]->TryRead(); |
124 else if (satisfied & MOJO_HANDLE_SIGNAL_PEER_CLOSED) | 127 else if (satisfied & MOJO_HANDLE_SIGNAL_PEER_CLOSED) |
125 recorder_impls_.erase(recorder_impls_.begin() + index); | 128 recorder_impls_.erase(recorder_impls_.begin() + index); |
126 } | 129 } |
127 } | 130 } |
128 } | 131 } |
129 AllDataCollected(); | 132 AllDataCollected(); |
130 } | 133 } |
131 | 134 |
132 void TracingApp::SetShellProcessCreationTime(int64 time) { | 135 void TracingApp::SetShellProcessCreationTime(int64_t time) { |
133 if (startup_performance_times_.shell_process_creation_time == 0) | 136 if (startup_performance_times_.shell_process_creation_time == 0) |
134 startup_performance_times_.shell_process_creation_time = time; | 137 startup_performance_times_.shell_process_creation_time = time; |
135 } | 138 } |
136 | 139 |
137 void TracingApp::SetShellMainEntryPointTime(int64 time) { | 140 void TracingApp::SetShellMainEntryPointTime(int64_t time) { |
138 if (startup_performance_times_.shell_main_entry_point_time == 0) | 141 if (startup_performance_times_.shell_main_entry_point_time == 0) |
139 startup_performance_times_.shell_main_entry_point_time = time; | 142 startup_performance_times_.shell_main_entry_point_time = time; |
140 } | 143 } |
141 | 144 |
142 void TracingApp::SetBrowserMessageLoopStartTicks(int64 ticks) { | 145 void TracingApp::SetBrowserMessageLoopStartTicks(int64_t ticks) { |
143 if (startup_performance_times_.browser_message_loop_start_ticks == 0) | 146 if (startup_performance_times_.browser_message_loop_start_ticks == 0) |
144 startup_performance_times_.browser_message_loop_start_ticks = ticks; | 147 startup_performance_times_.browser_message_loop_start_ticks = ticks; |
145 } | 148 } |
146 | 149 |
147 void TracingApp::SetBrowserWindowDisplayTicks(int64 ticks) { | 150 void TracingApp::SetBrowserWindowDisplayTicks(int64_t ticks) { |
148 if (startup_performance_times_.browser_window_display_ticks == 0) | 151 if (startup_performance_times_.browser_window_display_ticks == 0) |
149 startup_performance_times_.browser_window_display_ticks = ticks; | 152 startup_performance_times_.browser_window_display_ticks = ticks; |
150 } | 153 } |
151 | 154 |
152 void TracingApp::SetBrowserOpenTabsTimeDelta(int64 delta) { | 155 void TracingApp::SetBrowserOpenTabsTimeDelta(int64_t delta) { |
153 if (startup_performance_times_.browser_open_tabs_time_delta == 0) | 156 if (startup_performance_times_.browser_open_tabs_time_delta == 0) |
154 startup_performance_times_.browser_open_tabs_time_delta = delta; | 157 startup_performance_times_.browser_open_tabs_time_delta = delta; |
155 } | 158 } |
156 | 159 |
157 void TracingApp::SetFirstWebContentsMainFrameLoadTicks(int64 ticks) { | 160 void TracingApp::SetFirstWebContentsMainFrameLoadTicks(int64_t ticks) { |
158 if (startup_performance_times_.first_web_contents_main_frame_load_ticks == 0) | 161 if (startup_performance_times_.first_web_contents_main_frame_load_ticks == 0) |
159 startup_performance_times_.first_web_contents_main_frame_load_ticks = ticks; | 162 startup_performance_times_.first_web_contents_main_frame_load_ticks = ticks; |
160 } | 163 } |
161 | 164 |
162 void TracingApp::SetFirstVisuallyNonEmptyLayoutTicks(int64 ticks) { | 165 void TracingApp::SetFirstVisuallyNonEmptyLayoutTicks(int64_t ticks) { |
163 if (startup_performance_times_.first_visually_non_empty_layout_ticks == 0) | 166 if (startup_performance_times_.first_visually_non_empty_layout_ticks == 0) |
164 startup_performance_times_.first_visually_non_empty_layout_ticks = ticks; | 167 startup_performance_times_.first_visually_non_empty_layout_ticks = ticks; |
165 } | 168 } |
166 | 169 |
167 void TracingApp::GetStartupPerformanceTimes( | 170 void TracingApp::GetStartupPerformanceTimes( |
168 const GetStartupPerformanceTimesCallback& callback) { | 171 const GetStartupPerformanceTimesCallback& callback) { |
169 callback.Run(startup_performance_times_.Clone()); | 172 callback.Run(startup_performance_times_.Clone()); |
170 } | 173 } |
171 | 174 |
172 void TracingApp::AllDataCollected() { | 175 void TracingApp::AllDataCollected() { |
173 recorder_impls_.clear(); | 176 recorder_impls_.clear(); |
174 sink_.reset(); | 177 sink_.reset(); |
175 } | 178 } |
176 | 179 |
177 } // namespace tracing | 180 } // namespace tracing |
OLD | NEW |