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 "services/tracing/tracing_app.h" | 5 #include "services/tracing/tracing_app.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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 MojoTimeTicks end = MojoGetTimeTicksNow() + kTimeToWaitMicros; | 100 MojoTimeTicks end = MojoGetTimeTicksNow() + kTimeToWaitMicros; |
101 | 101 |
102 while (!recorder_impls_.empty()) { | 102 while (!recorder_impls_.empty()) { |
103 MojoTimeTicks now = MojoGetTimeTicksNow(); | 103 MojoTimeTicks now = MojoGetTimeTicksNow(); |
104 if (now >= end) // Timed out? | 104 if (now >= end) // Timed out? |
105 break; | 105 break; |
106 | 106 |
107 MojoDeadline mojo_deadline = end - now; | 107 MojoDeadline mojo_deadline = end - now; |
108 std::vector<mojo::Handle> handles; | 108 std::vector<mojo::Handle> handles; |
109 std::vector<MojoHandleSignals> signals; | 109 std::vector<MojoHandleSignals> signals; |
110 for (const auto& it : recorder_impls_) { | 110 for (auto* it : recorder_impls_) { |
111 handles.push_back(it->TraceRecorderHandle()); | 111 handles.push_back(it->TraceRecorderHandle()); |
112 signals.push_back(MOJO_HANDLE_SIGNAL_READABLE | | 112 signals.push_back(MOJO_HANDLE_SIGNAL_READABLE | |
113 MOJO_HANDLE_SIGNAL_PEER_CLOSED); | 113 MOJO_HANDLE_SIGNAL_PEER_CLOSED); |
114 } | 114 } |
115 std::vector<MojoHandleSignalsState> signals_states(signals.size()); | 115 std::vector<MojoHandleSignalsState> signals_states(signals.size()); |
116 const mojo::WaitManyResult wait_many_result = | 116 const mojo::WaitManyResult wait_many_result = |
117 mojo::WaitMany(handles, signals, mojo_deadline, &signals_states); | 117 mojo::WaitMany(handles, signals, mojo_deadline, &signals_states); |
118 if (wait_many_result.result == MOJO_RESULT_DEADLINE_EXCEEDED) { | 118 if (wait_many_result.result == MOJO_RESULT_DEADLINE_EXCEEDED) { |
119 // Timed out waiting, nothing more to read. | 119 // Timed out waiting, nothing more to read. |
120 LOG(WARNING) << "Timed out waiting for trace flush"; | 120 LOG(WARNING) << "Timed out waiting for trace flush"; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 const GetStartupPerformanceTimesCallback& callback) { | 177 const GetStartupPerformanceTimesCallback& callback) { |
178 callback.Run(startup_performance_times_.Clone()); | 178 callback.Run(startup_performance_times_.Clone()); |
179 } | 179 } |
180 | 180 |
181 void TracingApp::AllDataCollected() { | 181 void TracingApp::AllDataCollected() { |
182 recorder_impls_.clear(); | 182 recorder_impls_.clear(); |
183 sink_.reset(); | 183 sink_.reset(); |
184 } | 184 } |
185 | 185 |
186 } // namespace tracing | 186 } // namespace tracing |
OLD | NEW |