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

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

Issue 2156483002: Shutdown PeerConnectionDependencyFactory before Blink shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | content/renderer/media/webrtc/peer_connection_dependency_factory.cc » ('j') | 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 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
14 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
15 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
16 #include "content/renderer/media/webrtc/stun_field_trial.h" 15 #include "content/renderer/media/webrtc/stun_field_trial.h"
17 #include "content/renderer/p2p/socket_dispatcher.h" 16 #include "content/renderer/p2p/socket_dispatcher.h"
18 #include "ipc/ipc_platform_file.h" 17 #include "ipc/ipc_platform_file.h"
19 #include "third_party/webrtc/api/peerconnectioninterface.h" 18 #include "third_party/webrtc/api/peerconnectioninterface.h"
20 #include "third_party/webrtc/p2p/stunprober/stunprober.h" 19 #include "third_party/webrtc/p2p/stunprober/stunprober.h"
21 20
22 namespace base { 21 namespace base {
(...skipping 25 matching lines...) Expand all
48 class IpcNetworkManager; 47 class IpcNetworkManager;
49 class IpcPacketSocketFactory; 48 class IpcPacketSocketFactory;
50 class WebRtcAudioDeviceImpl; 49 class WebRtcAudioDeviceImpl;
51 class WebRtcLoggingHandlerImpl; 50 class WebRtcLoggingHandlerImpl;
52 class WebRtcLoggingMessageFilter; 51 class WebRtcLoggingMessageFilter;
53 class WebRtcVideoCapturerAdapter; 52 class WebRtcVideoCapturerAdapter;
54 struct StreamDeviceInfo; 53 struct StreamDeviceInfo;
55 54
56 // Object factory for RTC PeerConnections. 55 // Object factory for RTC PeerConnections.
57 class CONTENT_EXPORT PeerConnectionDependencyFactory 56 class CONTENT_EXPORT PeerConnectionDependencyFactory
58 : NON_EXPORTED_BASE(base::MessageLoop::DestructionObserver), 57 : NON_EXPORTED_BASE(public base::NonThreadSafe) {
59 NON_EXPORTED_BASE(public base::NonThreadSafe) {
60 public: 58 public:
61 PeerConnectionDependencyFactory( 59 PeerConnectionDependencyFactory(
62 P2PSocketDispatcher* p2p_socket_dispatcher); 60 P2PSocketDispatcher* p2p_socket_dispatcher);
63 ~PeerConnectionDependencyFactory() override; 61 virtual ~PeerConnectionDependencyFactory();
64 62
65 // Create a RTCPeerConnectionHandler object that implements the 63 // Create a RTCPeerConnectionHandler object that implements the
66 // WebKit WebRTCPeerConnectionHandler interface. 64 // WebKit WebRTCPeerConnectionHandler interface.
67 blink::WebRTCPeerConnectionHandler* CreateRTCPeerConnectionHandler( 65 blink::WebRTCPeerConnectionHandler* CreateRTCPeerConnectionHandler(
68 blink::WebRTCPeerConnectionHandlerClient* client); 66 blink::WebRTCPeerConnectionHandlerClient* client);
69 67
70 // Asks the PeerConnection factory to create a Local MediaStream object. 68 // Asks the PeerConnection factory to create a Local MediaStream object.
71 virtual scoped_refptr<webrtc::MediaStreamInterface> 69 virtual scoped_refptr<webrtc::MediaStreamInterface>
72 CreateLocalMediaStream(const std::string& label); 70 CreateLocalMediaStream(const std::string& label);
73 71
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const std::string& sdp_mid, 105 const std::string& sdp_mid,
108 int sdp_mline_index, 106 int sdp_mline_index,
109 const std::string& sdp); 107 const std::string& sdp);
110 108
111 WebRtcAudioDeviceImpl* GetWebRtcAudioDevice(); 109 WebRtcAudioDeviceImpl* GetWebRtcAudioDevice();
112 110
113 void EnsureInitialized(); 111 void EnsureInitialized();
114 scoped_refptr<base::SingleThreadTaskRunner> GetWebRtcWorkerThread() const; 112 scoped_refptr<base::SingleThreadTaskRunner> GetWebRtcWorkerThread() const;
115 virtual scoped_refptr<base::SingleThreadTaskRunner> GetWebRtcSignalingThread() 113 virtual scoped_refptr<base::SingleThreadTaskRunner> GetWebRtcSignalingThread()
116 const; 114 const;
115 void ShutDown();
117 116
118 protected: 117 protected:
119 // Asks the PeerConnection factory to create a Local VideoTrack object with 118 // Asks the PeerConnection factory to create a Local VideoTrack object with
120 // the video source using |capturer|. 119 // the video source using |capturer|.
121 virtual scoped_refptr<webrtc::VideoTrackInterface> 120 virtual scoped_refptr<webrtc::VideoTrackInterface>
122 CreateLocalVideoTrack(const std::string& id, 121 CreateLocalVideoTrack(const std::string& id,
123 cricket::VideoCapturer* capturer); 122 cricket::VideoCapturer* capturer);
124 123
125 virtual const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& 124 virtual const scoped_refptr<webrtc::PeerConnectionFactoryInterface>&
126 GetPcFactory(); 125 GetPcFactory();
127 virtual bool PeerConnectionFactoryCreated(); 126 virtual bool PeerConnectionFactoryCreated();
128 127
129 // Helper method to create a WebRtcAudioDeviceImpl. 128 // Helper method to create a WebRtcAudioDeviceImpl.
130 void EnsureWebRtcAudioDeviceImpl(); 129 void EnsureWebRtcAudioDeviceImpl();
131 130
132 private: 131 private:
133 // Implement base::MessageLoop::DestructionObserver.
134 // This makes sure the libjingle PeerConnectionFactory is released before
135 // the renderer message loop is destroyed.
136 void WillDestroyCurrentMessageLoop() override;
137
138 // Functions related to Stun probing trial to determine how fast we could send 132 // Functions related to Stun probing trial to determine how fast we could send
139 // Stun request without being dropped by NAT. 133 // Stun request without being dropped by NAT.
140 void TryScheduleStunProbeTrial(); 134 void TryScheduleStunProbeTrial();
141 void StartStunProbeTrialOnWorkerThread(const std::string& params); 135 void StartStunProbeTrialOnWorkerThread(const std::string& params);
142 136
143 // Creates |pc_factory_|, which in turn is used for 137 // Creates |pc_factory_|, which in turn is used for
144 // creating PeerConnection objects. 138 // creating PeerConnection objects.
145 void CreatePeerConnectionFactory(); 139 void CreatePeerConnectionFactory();
146 140
147 void InitializeSignalingThread( 141 void InitializeSignalingThread(
(...skipping 25 matching lines...) Expand all
173 rtc::Thread* worker_thread_; 167 rtc::Thread* worker_thread_;
174 base::Thread chrome_signaling_thread_; 168 base::Thread chrome_signaling_thread_;
175 base::Thread chrome_worker_thread_; 169 base::Thread chrome_worker_thread_;
176 170
177 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); 171 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory);
178 }; 172 };
179 173
180 } // namespace content 174 } // namespace content
181 175
182 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ 176 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/webrtc/peer_connection_dependency_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698