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

Side by Side Diff: content/renderer/media/webrtc/peer_connection_dependency_factory.cc

Issue 2913693003: Replace deprecated base::NonThreadSafe in content/renderer/media/webrtc in favor of SequenceChecker. (Closed)
Patch Set: move media_stream_remote_video_source.cc to https://codereview.chromium.org/2909103002/ Created 3 years, 6 months 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 | « content/renderer/media/webrtc/peer_connection_dependency_factory.h ('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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/webrtc/peer_connection_dependency_factory.h" 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 : network_manager_(NULL), 107 : network_manager_(NULL),
108 p2p_socket_dispatcher_(p2p_socket_dispatcher), 108 p2p_socket_dispatcher_(p2p_socket_dispatcher),
109 signaling_thread_(NULL), 109 signaling_thread_(NULL),
110 worker_thread_(NULL), 110 worker_thread_(NULL),
111 chrome_signaling_thread_("Chrome_libJingle_Signaling"), 111 chrome_signaling_thread_("Chrome_libJingle_Signaling"),
112 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { 112 chrome_worker_thread_("Chrome_libJingle_WorkerThread") {
113 TryScheduleStunProbeTrial(); 113 TryScheduleStunProbeTrial();
114 } 114 }
115 115
116 PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() { 116 PeerConnectionDependencyFactory::~PeerConnectionDependencyFactory() {
117 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
117 DVLOG(1) << "~PeerConnectionDependencyFactory()"; 118 DVLOG(1) << "~PeerConnectionDependencyFactory()";
118 DCHECK(!pc_factory_); 119 DCHECK(!pc_factory_);
119 } 120 }
120 121
121 std::unique_ptr<blink::WebRTCPeerConnectionHandler> 122 std::unique_ptr<blink::WebRTCPeerConnectionHandler>
122 PeerConnectionDependencyFactory::CreateRTCPeerConnectionHandler( 123 PeerConnectionDependencyFactory::CreateRTCPeerConnectionHandler(
123 blink::WebRTCPeerConnectionHandlerClient* client) { 124 blink::WebRTCPeerConnectionHandlerClient* client) {
124 // Save histogram data so we can see how much PeerConnetion is used. 125 // Save histogram data so we can see how much PeerConnetion is used.
125 // The histogram counts the number of calls to the JS API 126 // The histogram counts the number of calls to the JS API
126 // webKitRTCPeerConnection. 127 // webKitRTCPeerConnection.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 webrtc::IceCandidateInterface* 437 webrtc::IceCandidateInterface*
437 PeerConnectionDependencyFactory::CreateIceCandidate( 438 PeerConnectionDependencyFactory::CreateIceCandidate(
438 const std::string& sdp_mid, 439 const std::string& sdp_mid,
439 int sdp_mline_index, 440 int sdp_mline_index,
440 const std::string& sdp) { 441 const std::string& sdp) {
441 return webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, sdp, nullptr); 442 return webrtc::CreateIceCandidate(sdp_mid, sdp_mline_index, sdp, nullptr);
442 } 443 }
443 444
444 WebRtcAudioDeviceImpl* 445 WebRtcAudioDeviceImpl*
445 PeerConnectionDependencyFactory::GetWebRtcAudioDevice() { 446 PeerConnectionDependencyFactory::GetWebRtcAudioDevice() {
446 DCHECK(CalledOnValidThread()); 447 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
447 EnsureWebRtcAudioDeviceImpl(); 448 EnsureWebRtcAudioDeviceImpl();
448 return audio_device_.get(); 449 return audio_device_.get();
449 } 450 }
450 451
451 void PeerConnectionDependencyFactory::InitializeWorkerThread( 452 void PeerConnectionDependencyFactory::InitializeWorkerThread(
452 rtc::Thread** thread, 453 rtc::Thread** thread,
453 base::WaitableEvent* event) { 454 base::WaitableEvent* event) {
454 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); 455 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
455 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true); 456 jingle_glue::JingleThreadWrapper::current()->set_send_allowed(true);
456 *thread = jingle_glue::JingleThreadWrapper::current(); 457 *thread = jingle_glue::JingleThreadWrapper::current();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 // processed before returning. We wait for the above task to finish before 528 // processed before returning. We wait for the above task to finish before
528 // letting the the function continue to avoid any potential race issues. 529 // letting the the function continue to avoid any potential race issues.
529 chrome_worker_thread_.Stop(); 530 chrome_worker_thread_.Stop();
530 } else { 531 } else {
531 NOTREACHED() << "Worker thread not running."; 532 NOTREACHED() << "Worker thread not running.";
532 } 533 }
533 } 534 }
534 } 535 }
535 536
536 void PeerConnectionDependencyFactory::EnsureInitialized() { 537 void PeerConnectionDependencyFactory::EnsureInitialized() {
537 DCHECK(CalledOnValidThread()); 538 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
538 GetPcFactory(); 539 GetPcFactory();
539 } 540 }
540 541
541 scoped_refptr<base::SingleThreadTaskRunner> 542 scoped_refptr<base::SingleThreadTaskRunner>
542 PeerConnectionDependencyFactory::GetWebRtcWorkerThread() const { 543 PeerConnectionDependencyFactory::GetWebRtcWorkerThread() const {
543 DCHECK(CalledOnValidThread()); 544 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
544 return chrome_worker_thread_.IsRunning() ? chrome_worker_thread_.task_runner() 545 return chrome_worker_thread_.IsRunning() ? chrome_worker_thread_.task_runner()
545 : nullptr; 546 : nullptr;
546 } 547 }
547 548
548 scoped_refptr<base::SingleThreadTaskRunner> 549 scoped_refptr<base::SingleThreadTaskRunner>
549 PeerConnectionDependencyFactory::GetWebRtcSignalingThread() const { 550 PeerConnectionDependencyFactory::GetWebRtcSignalingThread() const {
550 DCHECK(CalledOnValidThread()); 551 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
551 return chrome_signaling_thread_.IsRunning() 552 return chrome_signaling_thread_.IsRunning()
552 ? chrome_signaling_thread_.task_runner() 553 ? chrome_signaling_thread_.task_runner()
553 : nullptr; 554 : nullptr;
554 } 555 }
555 556
556 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { 557 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() {
557 DCHECK(CalledOnValidThread()); 558 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
558 if (audio_device_.get()) 559 if (audio_device_.get())
559 return; 560 return;
560 561
561 audio_device_ = new WebRtcAudioDeviceImpl(); 562 audio_device_ = new WebRtcAudioDeviceImpl();
562 } 563 }
563 564
564 } // namespace content 565 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/peer_connection_dependency_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698