From 16d96a6ef22df62b943f43ffed9275254e197b67 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 7 Dec 2017 09:45:17 +0530 Subject: [PATCH] Force MediaCaptureDevicesDispatcher to be created on UI thread --- brightray/browser/browser_main_parts.cc | 4 ++++ brightray/browser/media/media_capture_devices_dispatcher.cc | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index 18a9df24b10b..f439e84d8362 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/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()); diff --git a/brightray/browser/media/media_capture_devices_dispatcher.cc b/brightray/browser/media/media_capture_devices_dispatcher.cc index aafb37594b6b..8d122890b773 100644 --- a/brightray/browser/media/media_capture_devices_dispatcher.cc +++ b/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() {}