Browse Source

Force MediaCaptureDevicesDispatcher to be created on UI thread

deepak1556 7 years ago
parent
commit
16d96a6ef2

+ 4 - 0
brightray/browser/browser_main_parts.cc

@@ -18,6 +18,7 @@
 #include "base/strings/utf_string_conversions.h"
 #include "brightray/browser/browser_context.h"
 #include "brightray/browser/devtools_manager_delegate.h"
+#include "brightray/browser/media/media_capture_devices_dispatcher.h"
 #include "brightray/browser/web_ui_controller_factory.h"
 #include "brightray/common/application_info.h"
 #include "brightray/common/main_delegate.h"
@@ -268,6 +269,9 @@ int BrowserMainParts::PreCreateThreads() {
 #endif
 #endif
 
+  // Force MediaCaptureDevicesDispatcher to be created on UI thread.
+  MediaCaptureDevicesDispatcher::GetInstance();
+
   if (!views::LayoutProvider::Get())
     layout_provider_.reset(new views::LayoutProvider());
 

+ 1 - 2
brightray/browser/media/media_capture_devices_dispatcher.cc

@@ -44,8 +44,7 @@ MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher()
     : is_device_enumeration_disabled_(false) {
   // MediaCaptureDevicesDispatcher is a singleton. It should be created on
   // UI thread.
-  // FIXME: Ensure the DCHECK doesn't fail and then re-enable
-  // DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 }
 
 MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {}