Commit 9a461b08 authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

[Mac] Ensure the MIDI task runners are backed by CFRunLoop.

Currently the code assumes that a TYPE_DEFAULT MesssageLoop will be backed by
CFRunLoop, which is required to receive the CoreMIDI callbacks. In the future,
that assumption may not be true, so explicitly request a TYPE_UI (CFRunLoop)
pump.

Bug: 753544
Change-Id: I5464e1299d8cb99d6fbf37d8b342417487117744
Reviewed-on: https://chromium-review.googlesource.com/682834
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarTakashi Toyoshima <toyoshim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504448}
parent 84994223
......@@ -6,6 +6,7 @@
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
namespace midi {
......@@ -139,10 +140,13 @@ scoped_refptr<base::SingleThreadTaskRunner> TaskService::GetTaskRunner(
if (!threads_[thread]) {
threads_[thread] = base::MakeUnique<base::Thread>(
base::StringPrintf("MidiService_TaskService_Thread(%zu)", runner_id));
base::Thread::Options options;
#if defined(OS_WIN)
threads_[thread]->init_com_with_mta(true);
#elif defined(OS_MACOSX)
options.message_loop_type = base::MessageLoop::TYPE_UI;
#endif
threads_[thread]->Start();
threads_[thread]->StartWithOptions(options);
}
return threads_[thread]->task_runner();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment