summaryrefslogtreecommitdiffstats
path: root/content/browser/device_monitor_mac.h
diff options
context:
space:
mode:
authormcasas@chromium.org <mcasas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-12 09:27:25 +0000
committermcasas@chromium.org <mcasas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-12 09:27:25 +0000
commit08f2c54c587f87d11520bdf4bd1dd3c5475c02e0 (patch)
tree7b46ce372e7f05d2ba0653ffc14217dab5901428 /content/browser/device_monitor_mac.h
parentd36b82b29d8f80c022bc8a800e5252d828bcfc0b (diff)
downloadchromium_src-08f2c54c587f87d11520bdf4bd1dd3c5475c02e0.zip
chromium_src-08f2c54c587f87d11520bdf4bd1dd3c5475c02e0.tar.gz
chromium_src-08f2c54c587f87d11520bdf4bd1dd3c5475c02e0.tar.bz2
Mac AVFoundation/QTKit: delay DeviceMonitorMac startup to first GetUserMedia.
Currently DeviceMonitorMac is constructed from BrowserMainLoop in the first compasses of Chrome bringup. DeviceMonitorMac creates either a QTKitMonitorImpl or a AVFoundationMonitorImpl, that immediately starts observing the system capture devices. This monitoring is not needed until the user actively starts operating the devices, that happens in MediaStreamManager. This CL adds a method StartMonitoring() to DeviceMonitorMac that is exercised from MediaStreamManager::StartMonitoring(). The performance regression in bugs 349616 and 348020 affects only AVFoundation, but both implementations would benefit from a delayed startup. Tested locally via using --[enable/disable]-avfoundation, connecting and disconnecting devices etc. BUG=288562, 349616, 348020 Review URL: https://codereview.chromium.org/189443010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256483 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/device_monitor_mac.h')
-rw-r--r--content/browser/device_monitor_mac.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/content/browser/device_monitor_mac.h b/content/browser/device_monitor_mac.h
index 6def493..696b961 100644
--- a/content/browser/device_monitor_mac.h
+++ b/content/browser/device_monitor_mac.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/system_monitor/system_monitor.h"
+#include "base/threading/thread_checker.h"
namespace {
class DeviceMonitorMacImpl;
@@ -22,6 +23,11 @@ class DeviceMonitorMac {
DeviceMonitorMac();
~DeviceMonitorMac();
+ // Registers the observers for the audio/video device removal, connection and
+ // suspension. The AVFoundation library is also loaded and initialised if the
+ // OS supports it.
+ void StartMonitoring();
+
// Method called by the internal DeviceMonitorMacImpl object
// |device_monitor_impl_| when a device of type |type| has been added to or
// removed from the system. This code executes in the notification thread
@@ -31,6 +37,10 @@ class DeviceMonitorMac {
private:
scoped_ptr<DeviceMonitorMacImpl> device_monitor_impl_;
+ // |thread_checker_| is used to check that constructor and StartMonitoring()
+ // are called in the correct thread, that also owns the object.
+ base::ThreadChecker thread_checker_;
+
DISALLOW_COPY_AND_ASSIGN(DeviceMonitorMac);
};