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

Unified Diff: content/browser/renderer_host/media/video_capture_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: minor fix for the problem detected by the trybots Created 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_manager.h
diff --git a/content/browser/renderer_host/media/video_capture_manager.h b/content/browser/renderer_host/media/video_capture_manager.h
index 1a0628791efe9b369fd879894fe40f2e7d37dcf4..fe164a1099f5e265552e0ab7fa795fe153c2239a 100644
--- a/content/browser/renderer_host/media/video_capture_manager.h
+++ b/content/browser/renderer_host/media/video_capture_manager.h
@@ -15,7 +15,6 @@
#include <map>
#include "base/memory/ref_counted.h"
-#include "base/threading/thread.h"
#include "content/browser/renderer_host/media/media_stream_provider.h"
#include "content/common/content_export.h"
#include "content/common/media/media_stream_options.h"
@@ -30,13 +29,8 @@ class VideoCaptureControllerEventHandler;
namespace media_stream {
// VideoCaptureManager opens/closes and start/stops video capture devices.
-// It is deleted on the FILE thread so that it can call base::Thread::Stop()
-// there without blocking UI/IO threads. This is also needed for incognito
-// window. When incognito window is closed, IO thread is not in shutdown mode
-// and base::Thread::Stop() can't be called on IO thread.
class CONTENT_EXPORT VideoCaptureManager
- : public base::RefCountedThreadSafe<VideoCaptureManager,
- content::BrowserThread::DeleteOnFileThread>,
+ : public base::RefCountedThreadSafe<VideoCaptureManager>,
public MediaStreamProvider {
public:
// Calling |Start| of this id will open the first device, even though open has
@@ -44,7 +38,8 @@ class CONTENT_EXPORT VideoCaptureManager
// before MediaStream is implemented in Chrome and WebKit.
enum { kStartOpenSessionId = 1 };
- VideoCaptureManager();
+ explicit VideoCaptureManager(
+ scoped_refptr<base::MessageLoopProxy> message_loop);
// Implements MediaStreamProvider.
virtual void Register(MediaStreamProviderListener* listener) OVERRIDE;
@@ -78,7 +73,6 @@ class CONTENT_EXPORT VideoCaptureManager
// video capture device. Due to timing requirements, the function must be
// called before EnumerateDevices and Open.
void UseFakeDevice();
- MessageLoop* GetMessageLoop();
// Called by VideoCaptureHost to get a controller for |capture_params|.
// The controller is returned via calling |added_cb|.
@@ -93,11 +87,7 @@ class CONTENT_EXPORT VideoCaptureManager
private:
friend class ::MockVideoCaptureManager;
- friend struct content::BrowserThread::DeleteOnThread<
- content::BrowserThread::FILE>;
- friend class base::DeleteHelper<VideoCaptureManager>;
- friend class base::RefCountedThreadSafe<VideoCaptureManager,
- content::BrowserThread::DeleteOnFileThread>;
+ friend class base::RefCountedThreadSafe<VideoCaptureManager>;
virtual ~VideoCaptureManager();
@@ -142,8 +132,8 @@ class CONTENT_EXPORT VideoCaptureManager
bool IsOnCaptureDeviceThread() const;
media::VideoCaptureDevice* GetDeviceInternal(int capture_session_id);
- // Thread for all calls to VideoCaptureDevice.
- base::Thread vc_device_thread_;
+ // The message loop of media stream device thread that this object runs on.
+ scoped_refptr<base::MessageLoopProxy> message_loop_;
// Only accessed on Browser::IO thread.
MediaStreamProviderListener* listener_;

Powered by Google App Engine
This is Rietveld 408576698