OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // Gets a recent stats report. If there is a report cached that is still fresh | 64 // Gets a recent stats report. If there is a report cached that is still fresh |
65 // it is returned, otherwise new stats are gathered and returned. A report is | 65 // it is returned, otherwise new stats are gathered and returned. A report is |
66 // considered fresh for |cache_lifetime_| ms. const RTCStatsReports are safe | 66 // considered fresh for |cache_lifetime_| ms. const RTCStatsReports are safe |
67 // to use across multiple threads and may be destructed on any thread. | 67 // to use across multiple threads and may be destructed on any thread. |
68 void GetStatsReport(rtc::scoped_refptr<RTCStatsCollectorCallback> callback); | 68 void GetStatsReport(rtc::scoped_refptr<RTCStatsCollectorCallback> callback); |
69 // Clears the cache's reference to the most recent stats report. Subsequently | 69 // Clears the cache's reference to the most recent stats report. Subsequently |
70 // calling |GetStatsReport| guarantees fresh stats. | 70 // calling |GetStatsReport| guarantees fresh stats. |
71 void ClearCachedStatsReport(); | 71 void ClearCachedStatsReport(); |
72 | 72 |
| 73 // If there is a |GetStatsReport| requests in-flight, waits until it has been |
| 74 // completed. Must be called on the signaling thread. |
| 75 void WaitForPendingRequest(); |
| 76 |
73 protected: | 77 protected: |
74 RTCStatsCollector(PeerConnection* pc, int64_t cache_lifetime_us); | 78 RTCStatsCollector(PeerConnection* pc, int64_t cache_lifetime_us); |
| 79 ~RTCStatsCollector(); |
75 | 80 |
76 // Stats gathering on a particular thread. Calls |AddPartialResults| before | 81 // Stats gathering on a particular thread. Calls |AddPartialResults| before |
77 // returning. Virtual for the sake of testing. | 82 // returning. Virtual for the sake of testing. |
78 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us); | 83 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us); |
79 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us); | 84 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us); |
80 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us); | 85 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us); |
81 | 86 |
82 // Can be called on any thread. | 87 // Can be called on any thread. |
83 void AddPartialResults( | 88 void AddPartialResults( |
84 const rtc::scoped_refptr<RTCStatsReport>& partial_report); | 89 const rtc::scoped_refptr<RTCStatsReport>& partial_report); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 }; | 184 }; |
180 | 185 |
181 const char* CandidateTypeToRTCIceCandidateTypeForTesting( | 186 const char* CandidateTypeToRTCIceCandidateTypeForTesting( |
182 const std::string& type); | 187 const std::string& type); |
183 const char* DataStateToRTCDataChannelStateForTesting( | 188 const char* DataStateToRTCDataChannelStateForTesting( |
184 DataChannelInterface::DataState state); | 189 DataChannelInterface::DataState state); |
185 | 190 |
186 } // namespace webrtc | 191 } // namespace webrtc |
187 | 192 |
188 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ | 193 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ |
OLD | NEW |