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

Side by Side Diff: content/renderer/media/media_stream_impl.h

Issue 10108016: Refactored MediaStreamImpl to be a RenderViewObserver as the other delegates in RenderViewImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed messed up MockMediaStreamImpl. Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/message_loop_proxy.h" 19 #include "base/message_loop_proxy.h"
20 #include "base/threading/non_thread_safe.h" 20 #include "base/threading/non_thread_safe.h"
21 #include "base/threading/thread.h" 21 #include "base/threading/thread.h"
22 #include "content/common/content_export.h" 22 #include "content/common/content_export.h"
23 #include "content/public/renderer/render_view_observer.h"
23 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" 24 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
24 #include "content/renderer/media/rtc_video_decoder.h" 25 #include "content/renderer/media/rtc_video_decoder.h"
25 #include "third_party/libjingle/source/talk/app/webrtc/mediastream.h" 26 #include "third_party/libjingle/source/talk/app/webrtc/mediastream.h"
26 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" 27 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClient.h" 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaClient.h"
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaRequest.h " 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserMediaRequest.h "
29 #include "webkit/media/media_stream_client.h" 30 #include "webkit/media/media_stream_client.h"
30 31
31 namespace base { 32 namespace base {
32 class WaitableEvent; 33 class WaitableEvent;
(...skipping 20 matching lines...) Expand all
53 class MediaStreamDependencyFactory; 54 class MediaStreamDependencyFactory;
54 class PeerConnectionHandlerBase; 55 class PeerConnectionHandlerBase;
55 class VideoCaptureImplManager; 56 class VideoCaptureImplManager;
56 class RTCVideoDecoder; 57 class RTCVideoDecoder;
57 58
58 // MediaStreamImpl is a delegate for the Media Stream API messages used by 59 // MediaStreamImpl is a delegate for the Media Stream API messages used by
59 // WebKit. It ties together WebKit, native PeerConnection in libjingle and 60 // WebKit. It ties together WebKit, native PeerConnection in libjingle and
60 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) 61 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost)
61 // in the browser process. It must be created, called and destroyed on the 62 // in the browser process. It must be created, called and destroyed on the
62 // render thread. 63 // render thread.
64 // MediaStreamImpl have weak pointers to a P2PSocketDispatcher and a
65 // MediaStreamDispatcher. These objects are also RenderViewObservers.
66 // MediaStreamImpl must be deleted before the P2PSocketDispatcher.
63 class CONTENT_EXPORT MediaStreamImpl 67 class CONTENT_EXPORT MediaStreamImpl
64 : NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), 68 : public content::RenderViewObserver,
69 NON_EXPORTED_BASE(public WebKit::WebUserMediaClient),
65 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), 70 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient),
66 public MediaStreamDispatcherEventHandler, 71 public MediaStreamDispatcherEventHandler,
67 NON_EXPORTED_BASE(public base::NonThreadSafe), 72 public base::SupportsWeakPtr<MediaStreamImpl>,
68 public base::RefCountedThreadSafe<MediaStreamImpl>, 73 NON_EXPORTED_BASE(public base::NonThreadSafe) {
69 public base::SupportsWeakPtr<MediaStreamImpl> {
70 public: 74 public:
71 MediaStreamImpl( 75 MediaStreamImpl(
76 content::RenderView* render_view,
72 MediaStreamDispatcher* media_stream_dispatcher, 77 MediaStreamDispatcher* media_stream_dispatcher,
73 content::P2PSocketDispatcher* p2p_socket_dispatcher, 78 content::P2PSocketDispatcher* p2p_socket_dispatcher,
74 VideoCaptureImplManager* vc_manager, 79 VideoCaptureImplManager* vc_manager,
75 MediaStreamDependencyFactory* dependency_factory); 80 MediaStreamDependencyFactory* dependency_factory);
76 virtual ~MediaStreamImpl(); 81 virtual ~MediaStreamImpl();
77 82
78 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler( 83 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler(
79 WebKit::WebPeerConnectionHandlerClient* client); 84 WebKit::WebPeerConnectionHandlerClient* client);
80 virtual WebKit::WebPeerConnection00Handler* CreatePeerConnectionHandlerJsep( 85 virtual WebKit::WebPeerConnection00Handler* CreatePeerConnectionHandlerJsep(
81 WebKit::WebPeerConnection00HandlerClient* client); 86 WebKit::WebPeerConnection00HandlerClient* client);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 157
153 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's 158 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's
154 // valid for the lifetime of RenderView. 159 // valid for the lifetime of RenderView.
155 MediaStreamDispatcher* media_stream_dispatcher_; 160 MediaStreamDispatcher* media_stream_dispatcher_;
156 161
157 // p2p_socket_dispatcher_ is a weak reference, owned by RenderView. It's valid 162 // p2p_socket_dispatcher_ is a weak reference, owned by RenderView. It's valid
158 // for the lifetime of RenderView. 163 // for the lifetime of RenderView.
159 content::P2PSocketDispatcher* p2p_socket_dispatcher_; 164 content::P2PSocketDispatcher* p2p_socket_dispatcher_;
160 165
161 // We own network_manager_, must be deleted on the worker thread. 166 // We own network_manager_, must be deleted on the worker thread.
167 // The network manager uses |p2p_socket_dispatcher_|.
162 content::IpcNetworkManager* network_manager_; 168 content::IpcNetworkManager* network_manager_;
163 169
164 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; 170 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_;
165 171
166 scoped_refptr<VideoCaptureImplManager> vc_manager_; 172 scoped_refptr<VideoCaptureImplManager> vc_manager_;
167 173
168 // peer_connection_handlers_ contains raw references, owned by WebKit. A 174 // peer_connection_handlers_ contains raw references, owned by WebKit. A
169 // pointer is valid until stop is called on the object (which will call 175 // pointer is valid until stop is called on the object (which will call
170 // ClosePeerConnection on us and we remove the pointer). 176 // ClosePeerConnection on us and we remove the pointer).
171 std::list<PeerConnectionHandlerBase*> peer_connection_handlers_; 177 std::list<PeerConnectionHandlerBase*> peer_connection_handlers_;
(...skipping 21 matching lines...) Expand all
193 base::Thread chrome_worker_thread_; 199 base::Thread chrome_worker_thread_;
194 200
195 static int next_request_id_; 201 static int next_request_id_;
196 typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap; 202 typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap;
197 MediaRequestMap user_media_requests_; 203 MediaRequestMap user_media_requests_;
198 204
199 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); 205 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl);
200 }; 206 };
201 207
202 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ 208 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream_impl.cc » ('j') | content/renderer/render_view_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698