OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/media/rtc_peer_connection_handler.h" | 5 #include "content/renderer/media/rtc_peer_connection_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1299 webrtc::PeerConnectionInterface::IceConnectionState new_state) { | 1299 webrtc::PeerConnectionInterface::IceConnectionState new_state) { |
1300 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceConnectionChange"); | 1300 TRACE_EVENT0("webrtc", "RTCPeerConnectionHandler::OnIceConnectionChange"); |
1301 DCHECK(thread_checker_.CalledOnValidThread()); | 1301 DCHECK(thread_checker_.CalledOnValidThread()); |
1302 if (new_state == webrtc::PeerConnectionInterface::kIceConnectionChecking) { | 1302 if (new_state == webrtc::PeerConnectionInterface::kIceConnectionChecking) { |
1303 ice_connection_checking_start_ = base::TimeTicks::Now(); | 1303 ice_connection_checking_start_ = base::TimeTicks::Now(); |
1304 } else if (new_state == | 1304 } else if (new_state == |
1305 webrtc::PeerConnectionInterface::kIceConnectionConnected) { | 1305 webrtc::PeerConnectionInterface::kIceConnectionConnected) { |
1306 // If the state becomes connected, send the time needed for PC to become | 1306 // If the state becomes connected, send the time needed for PC to become |
1307 // connected from checking to UMA. UMA data will help to know how much | 1307 // connected from checking to UMA. UMA data will help to know how much |
1308 // time needed for PC to connect with remote peer. | 1308 // time needed for PC to connect with remote peer. |
1309 if (ice_connection_checking_start_.is_null()) { | |
1310 UMA_HISTOGRAM_MEDIUM_TIMES("WebRTC.PeerConnection.TimeToConnect", | |
1311 base::TimeDelta()); | |
pthatcher2
2015/06/01 23:02:15
Can you put a comment explaining why it's correct
guoweis_left_chromium
2015/06/08 19:55:38
Done.
| |
1312 } else { | |
1309 UMA_HISTOGRAM_MEDIUM_TIMES( | 1313 UMA_HISTOGRAM_MEDIUM_TIMES( |
1310 "WebRTC.PeerConnection.TimeToConnect", | 1314 "WebRTC.PeerConnection.TimeToConnect", |
1311 base::TimeTicks::Now() - ice_connection_checking_start_); | 1315 base::TimeTicks::Now() - ice_connection_checking_start_); |
1316 } | |
1312 } | 1317 } |
1313 | 1318 |
1314 track_metrics_.IceConnectionChange(new_state); | 1319 track_metrics_.IceConnectionChange(new_state); |
1315 blink::WebRTCPeerConnectionHandlerClient::ICEConnectionState state = | 1320 blink::WebRTCPeerConnectionHandlerClient::ICEConnectionState state = |
1316 GetWebKitIceConnectionState(new_state); | 1321 GetWebKitIceConnectionState(new_state); |
1317 if (peer_connection_tracker_) | 1322 if (peer_connection_tracker_) |
1318 peer_connection_tracker_->TrackIceConnectionStateChange(this, state); | 1323 peer_connection_tracker_->TrackIceConnectionStateChange(this, state); |
1319 if(client_) | 1324 if(client_) |
1320 client_->didChangeICEConnectionState(state); | 1325 client_->didChangeICEConnectionState(state); |
1321 } | 1326 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1493 base::WaitableEvent event(false, false); | 1498 base::WaitableEvent event(false, false); |
1494 thread->PostTask(FROM_HERE, | 1499 thread->PostTask(FROM_HERE, |
1495 base::Bind(&RunSynchronousClosure, closure, | 1500 base::Bind(&RunSynchronousClosure, closure, |
1496 base::Unretained(trace_event_name), | 1501 base::Unretained(trace_event_name), |
1497 base::Unretained(&event))); | 1502 base::Unretained(&event))); |
1498 event.Wait(); | 1503 event.Wait(); |
1499 } | 1504 } |
1500 } | 1505 } |
1501 | 1506 |
1502 } // namespace content | 1507 } // namespace content |
OLD | NEW |