Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(809)

Unified Diff: media/midi/midi_manager_win.cc

Issue 2485903002: Web MIDI: do not keep virtual synth open (Closed)
Patch Set: plan b Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_manager_win.cc
diff --git a/media/midi/midi_manager_win.cc b/media/midi/midi_manager_win.cc
index 5a589cdabe8c32614c4ebbd2ec04baa631c799c6..e03f99354940223bb1837a87c93e1e4b61e6647d 100644
--- a/media/midi/midi_manager_win.cc
+++ b/media/midi/midi_manager_win.cc
@@ -89,6 +89,10 @@ std::string MmversionToString(MMVERSION version) {
return base::StringPrintf("%d.%d", HIBYTE(version), LOBYTE(version));
}
+void CloseOutputPortOnTaskThread(HMIDIOUT midi_out_handle) {
+ midiOutClose(midi_out_handle);
+}
+
class MIDIHDRDeleter {
public:
void operator()(MIDIHDR* header) {
@@ -828,8 +832,11 @@ class MidiServiceWinImpl : public MidiServiceWin,
make_scoped_refptr(new MidiOutputDeviceState(MidiDeviceInfo(caps)));
state->midi_handle = midi_out_handle;
const auto& state_device_info = state->device_info;
- if (IsUnsupportedDevice(state_device_info))
+ if (IsUnsupportedDevice(state_device_info)) {
+ task_thread_.task_runner()->PostTask(
+ FROM_HERE, base::Bind(&CloseOutputPortOnTaskThread, midi_out_handle));
return;
+ }
bool add_new_port = false;
uint32_t port_number = 0;
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698