Force MediaCaptureDevicesDispatcher to be created on UI thread

This commit is contained in:
deepak1556 2017-12-07 09:45:17 +05:30
parent 19de41b764
commit 16d96a6ef2
2 changed files with 5 additions and 2 deletions

View file

@ -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());

View file

@ -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() {}