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

Side by Side Diff: webrtc/p2p/base/transportcontroller.cc

Issue 2567243003: RTCStatsCollector: Utilize network thread to minimize thread hops. (Closed)
Patch Set: Rebase and rename Get[Session]Stats_n 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
« no previous file with comments | « webrtc/api/webrtcsession_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool TransportController::SetLocalCertificate( 134 bool TransportController::SetLocalCertificate(
135 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { 135 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {
136 return network_thread_->Invoke<bool>( 136 return network_thread_->Invoke<bool>(
137 RTC_FROM_HERE, rtc::Bind(&TransportController::SetLocalCertificate_n, 137 RTC_FROM_HERE, rtc::Bind(&TransportController::SetLocalCertificate_n,
138 this, certificate)); 138 this, certificate));
139 } 139 }
140 140
141 bool TransportController::GetLocalCertificate( 141 bool TransportController::GetLocalCertificate(
142 const std::string& transport_name, 142 const std::string& transport_name,
143 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) const { 143 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) const {
144 if (network_thread_->IsCurrent()) {
145 return GetLocalCertificate_n(transport_name, certificate);
146 }
144 return network_thread_->Invoke<bool>( 147 return network_thread_->Invoke<bool>(
145 RTC_FROM_HERE, rtc::Bind(&TransportController::GetLocalCertificate_n, 148 RTC_FROM_HERE, rtc::Bind(&TransportController::GetLocalCertificate_n,
146 this, transport_name, certificate)); 149 this, transport_name, certificate));
147 } 150 }
148 151
149 std::unique_ptr<rtc::SSLCertificate> 152 std::unique_ptr<rtc::SSLCertificate>
150 TransportController::GetRemoteSSLCertificate( 153 TransportController::GetRemoteSSLCertificate(
151 const std::string& transport_name) const { 154 const std::string& transport_name) const {
155 if (network_thread_->IsCurrent()) {
156 return GetRemoteSSLCertificate_n(transport_name);
157 }
152 return network_thread_->Invoke<std::unique_ptr<rtc::SSLCertificate>>( 158 return network_thread_->Invoke<std::unique_ptr<rtc::SSLCertificate>>(
153 RTC_FROM_HERE, rtc::Bind(&TransportController::GetRemoteSSLCertificate_n, 159 RTC_FROM_HERE, rtc::Bind(&TransportController::GetRemoteSSLCertificate_n,
154 this, transport_name)); 160 this, transport_name));
155 } 161 }
156 162
157 bool TransportController::SetLocalTransportDescription( 163 bool TransportController::SetLocalTransportDescription(
158 const std::string& transport_name, 164 const std::string& transport_name,
159 const TransportDescription& tdesc, 165 const TransportDescription& tdesc,
160 ContentAction action, 166 ContentAction action,
161 std::string* err) { 167 std::string* err) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 205
200 bool TransportController::ReadyForRemoteCandidates( 206 bool TransportController::ReadyForRemoteCandidates(
201 const std::string& transport_name) const { 207 const std::string& transport_name) const {
202 return network_thread_->Invoke<bool>( 208 return network_thread_->Invoke<bool>(
203 RTC_FROM_HERE, rtc::Bind(&TransportController::ReadyForRemoteCandidates_n, 209 RTC_FROM_HERE, rtc::Bind(&TransportController::ReadyForRemoteCandidates_n,
204 this, transport_name)); 210 this, transport_name));
205 } 211 }
206 212
207 bool TransportController::GetStats(const std::string& transport_name, 213 bool TransportController::GetStats(const std::string& transport_name,
208 TransportStats* stats) { 214 TransportStats* stats) {
215 if (network_thread_->IsCurrent()) {
216 return GetStats_n(transport_name, stats);
217 }
209 return network_thread_->Invoke<bool>( 218 return network_thread_->Invoke<bool>(
210 RTC_FROM_HERE, 219 RTC_FROM_HERE,
211 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); 220 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats));
212 } 221 }
213 222
214 void TransportController::SetMetricsObserver( 223 void TransportController::SetMetricsObserver(
215 webrtc::MetricsObserverInterface* metrics_observer) { 224 webrtc::MetricsObserverInterface* metrics_observer) {
216 return network_thread_->Invoke<void>( 225 return network_thread_->Invoke<void>(
217 RTC_FROM_HERE, rtc::Bind(&TransportController::SetMetricsObserver_n, this, 226 RTC_FROM_HERE, rtc::Bind(&TransportController::SetMetricsObserver_n, this,
218 metrics_observer)); 227 metrics_observer));
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, 869 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE,
861 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); 870 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state));
862 } 871 }
863 } 872 }
864 873
865 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { 874 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) {
866 SignalDtlsHandshakeError(error); 875 SignalDtlsHandshakeError(error);
867 } 876 }
868 877
869 } // namespace cricket 878 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698