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.h> | 7 #include <string.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 | 1755 |
1756 void RTCPeerConnectionHandler::RunSynchronousClosureOnSignalingThread( | 1756 void RTCPeerConnectionHandler::RunSynchronousClosureOnSignalingThread( |
1757 const base::Closure& closure, | 1757 const base::Closure& closure, |
1758 const char* trace_event_name) { | 1758 const char* trace_event_name) { |
1759 DCHECK(thread_checker_.CalledOnValidThread()); | 1759 DCHECK(thread_checker_.CalledOnValidThread()); |
1760 scoped_refptr<base::SingleThreadTaskRunner> thread(signaling_thread()); | 1760 scoped_refptr<base::SingleThreadTaskRunner> thread(signaling_thread()); |
1761 if (!thread.get() || thread->BelongsToCurrentThread()) { | 1761 if (!thread.get() || thread->BelongsToCurrentThread()) { |
1762 TRACE_EVENT0("webrtc", trace_event_name); | 1762 TRACE_EVENT0("webrtc", trace_event_name); |
1763 closure.Run(); | 1763 closure.Run(); |
1764 } else { | 1764 } else { |
1765 base::WaitableEvent event(false, false); | 1765 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 1766 base::WaitableEvent::InitialState::NOT_SIGNALED); |
1766 thread->PostTask(FROM_HERE, | 1767 thread->PostTask(FROM_HERE, |
1767 base::Bind(&RunSynchronousClosure, closure, | 1768 base::Bind(&RunSynchronousClosure, closure, |
1768 base::Unretained(trace_event_name), | 1769 base::Unretained(trace_event_name), |
1769 base::Unretained(&event))); | 1770 base::Unretained(&event))); |
1770 event.Wait(); | 1771 event.Wait(); |
1771 } | 1772 } |
1772 } | 1773 } |
1773 | 1774 |
1774 void RTCPeerConnectionHandler::ReportICEState( | 1775 void RTCPeerConnectionHandler::ReportICEState( |
1775 webrtc::PeerConnectionInterface::IceConnectionState new_state) { | 1776 webrtc::PeerConnectionInterface::IceConnectionState new_state) { |
1776 DCHECK(thread_checker_.CalledOnValidThread()); | 1777 DCHECK(thread_checker_.CalledOnValidThread()); |
1777 if (ice_state_seen_[new_state]) | 1778 if (ice_state_seen_[new_state]) |
1778 return; | 1779 return; |
1779 ice_state_seen_[new_state] = true; | 1780 ice_state_seen_[new_state] = true; |
1780 UMA_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.ConnectionState", new_state, | 1781 UMA_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.ConnectionState", new_state, |
1781 webrtc::PeerConnectionInterface::kIceConnectionMax); | 1782 webrtc::PeerConnectionInterface::kIceConnectionMax); |
1782 } | 1783 } |
1783 | 1784 |
1784 void RTCPeerConnectionHandler::ResetUMAStats() { | 1785 void RTCPeerConnectionHandler::ResetUMAStats() { |
1785 DCHECK(thread_checker_.CalledOnValidThread()); | 1786 DCHECK(thread_checker_.CalledOnValidThread()); |
1786 num_local_candidates_ipv6_ = 0; | 1787 num_local_candidates_ipv6_ = 0; |
1787 num_local_candidates_ipv4_ = 0; | 1788 num_local_candidates_ipv4_ = 0; |
1788 ice_connection_checking_start_ = base::TimeTicks(); | 1789 ice_connection_checking_start_ = base::TimeTicks(); |
1789 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); | 1790 memset(ice_state_seen_, 0, sizeof(ice_state_seen_)); |
1790 } | 1791 } |
1791 } // namespace content | 1792 } // namespace content |
OLD | NEW |