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

Side by Side Diff: content/browser/renderer_host/media/media_stream_dispatcher_host.h

Issue 10662049: Move the device enumerate/open/close work to device thread from IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small changes to fix the trybots' failure Created 8 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 | 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_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "content/browser/renderer_host/media/media_stream_manager.h" 12 #include "content/browser/renderer_host/media/media_stream_manager.h"
13 #include "content/browser/renderer_host/media/media_stream_requester.h" 13 #include "content/browser/renderer_host/media/media_stream_requester.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/common/media/media_stream_options.h" 15 #include "content/common/media/media_stream_options.h"
16 #include "content/public/browser/browser_message_filter.h" 16 #include "content/public/browser/browser_message_filter.h"
17 17
18 namespace content {
19 class ResourceContext;
20 } // namespace content
21
22 namespace media_stream { 18 namespace media_stream {
23 19
24 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by 20 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by
25 // MediaStreamImpl. It's the complement of MediaStreamDispatcher 21 // MediaStreamImpl. It's the complement of MediaStreamDispatcher
26 // (owned by RenderView). 22 // (owned by RenderView).
27 class CONTENT_EXPORT MediaStreamDispatcherHost 23 class CONTENT_EXPORT MediaStreamDispatcherHost
28 : public content::BrowserMessageFilter, 24 : public content::BrowserMessageFilter,
29 public MediaStreamRequester { 25 public MediaStreamRequester {
30 public: 26 public:
31 MediaStreamDispatcherHost(content::ResourceContext* resource_context, 27 explicit MediaStreamDispatcherHost(int render_process_id);
32 int render_process_id,
33 media::AudioManager* audio_manager);
34 28
35 // MediaStreamRequester implementation. 29 // MediaStreamRequester implementation.
36 virtual void StreamGenerated( 30 virtual void StreamGenerated(
37 const std::string& label, 31 const std::string& label,
38 const StreamDeviceInfoArray& audio_devices, 32 const StreamDeviceInfoArray& audio_devices,
39 const StreamDeviceInfoArray& video_devices) OVERRIDE; 33 const StreamDeviceInfoArray& video_devices) OVERRIDE;
40 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; 34 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE;
41 virtual void AudioDeviceFailed(const std::string& label, int index) OVERRIDE; 35 virtual void AudioDeviceFailed(const std::string& label, int index) OVERRIDE;
42 virtual void VideoDeviceFailed(const std::string& label, int index) OVERRIDE; 36 virtual void VideoDeviceFailed(const std::string& label, int index) OVERRIDE;
43 virtual void DevicesEnumerated(const std::string& label, 37 virtual void DevicesEnumerated(const std::string& label,
(...skipping 27 matching lines...) Expand all
71 media_stream::MediaStreamType type, 65 media_stream::MediaStreamType type,
72 const GURL& security_origin); 66 const GURL& security_origin);
73 67
74 void OnOpenDevice(int render_view_id, 68 void OnOpenDevice(int render_view_id,
75 int page_request_id, 69 int page_request_id,
76 const std::string& device_id, 70 const std::string& device_id,
77 media_stream::MediaStreamType type, 71 media_stream::MediaStreamType type,
78 const GURL& security_origin); 72 const GURL& security_origin);
79 73
80 // Returns the media stream manager to forward events to, 74 // Returns the media stream manager to forward events to,
81 // creating one if needed. 75 // creating one if needed. It is a virtual function so that the unit tests
82 MediaStreamManager* manager(); 76 // can inject their own MediaStreamManager.
77 virtual MediaStreamManager* GetManager();
83 78
84 content::ResourceContext* resource_context_;
85 int render_process_id_; 79 int render_process_id_;
86 media::AudioManager* audio_manager_;
87 80
88 struct StreamRequest; 81 struct StreamRequest;
89 typedef std::map<std::string, StreamRequest> StreamMap; 82 typedef std::map<std::string, StreamRequest> StreamMap;
90 // Streams generated for this host. 83 // Streams generated for this host.
91 StreamMap streams_; 84 StreamMap streams_;
92 85
93 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); 86 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost);
94 }; 87 };
95 88
96 } // namespace media_stream 89 } // namespace media_stream
97 90
98 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ 91 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698