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

Unified Diff: media/midi/midi_manager_win.cc

Issue 664843002: Web MIDI: distributes MIDIPort information asynchronously (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifecycle
Patch Set: . => -> Created 6 years, 2 months 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 | « media/midi/midi_manager_usb_unittest.cc ('k') | 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 54a1db8733a90db5b00fe802413df182f7b5e339..439ce9357b6c93ef5dd5e96da85d5e7ad421588b 100644
--- a/media/midi/midi_manager_win.cc
+++ b/media/midi/midi_manager_win.cc
@@ -499,6 +499,7 @@ MidiManagerWin::MidiManagerWin()
void MidiManagerWin::StartInitialization() {
const UINT num_in_devices = midiInGetNumDevs();
in_devices_.reserve(num_in_devices);
+ int inport_index = 0;
for (UINT device_id = 0; device_id < num_in_devices; ++device_id) {
MIDIINCAPS caps = {};
MMRESULT result = midiInGetDevCaps(device_id, &caps, sizeof(caps));
@@ -516,7 +517,7 @@ void MidiManagerWin::StartInitialization() {
base::WideToUTF8(caps.szPname),
base::IntToString(static_cast<int>(caps.vDriverVersion)));
AddInputPort(info);
- in_device->set_port_index(input_ports().size() - 1);
+ in_device->set_port_index(inport_index++);
in_devices_.push_back(in_device.Pass());
}
@@ -548,8 +549,8 @@ void MidiManagerWin::StartInitialization() {
MidiManagerWin::~MidiManagerWin() {
// Cleanup order is important. |send_thread_| must be stopped before
// |out_devices_| is cleared.
- for (size_t i = 0; i < output_ports().size(); ++i)
- out_devices_[i]->Quit();
+ for (auto& device : out_devices_)
+ device->Quit();
send_thread_.Stop();
out_devices_.clear();
« no previous file with comments | « media/midi/midi_manager_usb_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698