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

Unified Diff: content/browser/renderer_host/media/audio_input_device_manager.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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/audio_input_device_manager.h
diff --git a/content/browser/renderer_host/media/audio_input_device_manager.h b/content/browser/renderer_host/media/audio_input_device_manager.h
index 96bff65679102dd59554b1e2d057e1223cf1c2c6..3d79dc9f44144b18673dfa444299495117a50579 100644
--- a/content/browser/renderer_host/media/audio_input_device_manager.h
+++ b/content/browser/renderer_host/media/audio_input_device_manager.h
@@ -6,8 +6,8 @@
// communicates with MediaStreamManager and AudioInputRendererHost on the
// browser IO thread, handles queries like enumerate/open/close from
// MediaStreamManager and start/stop from AudioInputRendererHost.
-
-// All the queries and work are handled on the IO thread.
+// The work for enumerate/open/close is handled asynchronously on Media Stream
+// device thread, while start/stop are synchronous on the IO thread.
#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_
#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_
@@ -44,7 +44,8 @@ class CONTENT_EXPORT AudioInputDeviceManager
explicit AudioInputDeviceManager(media::AudioManager* audio_manager);
// MediaStreamProvider implementation, called on IO thread.
- virtual void Register(MediaStreamProviderListener* listener) OVERRIDE;
+ virtual void Register(MediaStreamProviderListener* listener,
+ base::MessageLoopProxy* device_thread_loop) OVERRIDE;
virtual void Unregister() OVERRIDE;
virtual void EnumerateDevices() OVERRIDE;
virtual int Open(const StreamDeviceInfo& device) OVERRIDE;
@@ -61,21 +62,33 @@ class CONTENT_EXPORT AudioInputDeviceManager
friend class base::RefCountedThreadSafe<AudioInputDeviceManager>;
virtual ~AudioInputDeviceManager();
+ // Executed on media stream device thread.
+ void EnumerateOnDeviceThread();
+ void OpenOnDeviceThread(int session_id, const StreamDeviceInfo& device);
+ void CloseOnDeviceThread(int session_id);
+
// Executed on IO thread to call Listener.
void DevicesEnumeratedOnIOThread(StreamDeviceInfoArray* devices);
void OpenedOnIOThread(int session_id);
void ClosedOnIOThread(int session_id);
void ErrorOnIOThread(int session_id, MediaStreamProviderError error);
+ bool IsOnDeviceThread() const;
+
+ // Only accessed on Browser::IO thread.
MediaStreamProviderListener* listener_;
int next_capture_session_id_;
typedef std::map<int, AudioInputDeviceManagerEventHandler*> EventHandlerMap;
EventHandlerMap event_handlers_;
+
+ // Only accessed from media stream device thread.
typedef std::map<int, media::AudioDeviceName> AudioInputDeviceMap;
AudioInputDeviceMap devices_;
- // TODO(tommi): Is it necessary to store this as a member?
media::AudioManager* audio_manager_;
+ // The message loop of media stream device thread that this object runs on.
+ scoped_refptr<base::MessageLoopProxy> device_loop_;
+
DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManager);
};
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/renderer_host/media/audio_input_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698