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

Side by Side Diff: webrtc/api/rtcstatscollector.h

Issue 2583613003: Fix segfault when PeerConnection is destroyed during stats collection. (Closed)
Patch Set: Created 4 years 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
OLDNEW
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
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 are any |GetStatsReport| requests in-flight, waits until it has
hbos 2016/12/16 13:49:35 nit: Will update comment to speak in singular, thi
74 // been 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);
75 79
76 // Stats gathering on a particular thread. Calls |AddPartialResults| before 80 // Stats gathering on a particular thread. Calls |AddPartialResults| before
77 // returning. Virtual for the sake of testing. 81 // returning. Virtual for the sake of testing.
78 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us); 82 virtual void ProducePartialResultsOnSignalingThread(int64_t timestamp_us);
79 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us); 83 virtual void ProducePartialResultsOnWorkerThread(int64_t timestamp_us);
80 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us); 84 virtual void ProducePartialResultsOnNetworkThread(int64_t timestamp_us);
81 85
82 // Can be called on any thread. 86 // Can be called on any thread.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 }; 183 };
180 184
181 const char* CandidateTypeToRTCIceCandidateTypeForTesting( 185 const char* CandidateTypeToRTCIceCandidateTypeForTesting(
182 const std::string& type); 186 const std::string& type);
183 const char* DataStateToRTCDataChannelStateForTesting( 187 const char* DataStateToRTCDataChannelStateForTesting(
184 DataChannelInterface::DataState state); 188 DataChannelInterface::DataState state);
185 189
186 } // namespace webrtc 190 } // namespace webrtc
187 191
188 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_ 192 #endif // WEBRTC_API_RTCSTATSCOLLECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698