Commit 3e47c6db authored by toyoshim's avatar toyoshim Committed by Commit bot

Web MIDI: Improve device change monitornig on Windows

Current implementation monitors DBT_DEVICEARRIVAL mesage, but that
is not a right message to monitor device changes since actual device
list that OS holds will be updated a little later. Instead, monitor
DBT_DEVNODES_CHANGES that is delivered after the list being updated.

In Chrome, SystemMessageWindowWin invokes base::SystemMonitor's observer
with DEVTYPE_UNKNOWN for DBT_DEVNODES_CHANGED, and the SystemMonitor
provides a way to observe the event on the registered thread.
Using the monitor must be the right implementation.

BUG=472980

Review URL: https://codereview.chromium.org/1056333002

Cr-Commit-Position: refs/heads/master@{#324031}
parent 61b74f33
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/memory/scoped_vector.h" #include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/system_monitor/system_monitor.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace media { namespace media {
...@@ -245,6 +246,9 @@ TEST_F(MidiManagerTest, AbortSession) { ...@@ -245,6 +246,9 @@ TEST_F(MidiManagerTest, AbortSession) {
} }
TEST_F(MidiManagerTest, CreateMidiManager) { TEST_F(MidiManagerTest, CreateMidiManager) {
// SystemMonitor is needed on Windows.
base::SystemMonitor system_monitor;
scoped_ptr<FakeMidiManagerClient> client; scoped_ptr<FakeMidiManagerClient> client;
client.reset(new FakeMidiManagerClient); client.reset(new FakeMidiManagerClient);
......
This diff is collapsed.
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