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

Side by Side Diff: media/midi/usb_midi_input_stream.cc

Issue 107163008: [WebMIDI] Introduce MidiManagerUsb (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@usb-midi-stream
Patch Set: Created 6 years, 10 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 unified diff | Download patch
« no previous file with comments | « media/midi/usb_midi_input_stream.h ('k') | media/midi/usb_midi_jack.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/midi/usb_midi_input_stream.h" 5 #include "media/midi/usb_midi_input_stream.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return; 82 return;
83 } 83 }
84 std::map<JackUniqueKey, size_t>::const_iterator it = 84 std::map<JackUniqueKey, size_t>::const_iterator it =
85 jack_dictionary_.find(JackUniqueKey(device, 85 jack_dictionary_.find(JackUniqueKey(device,
86 endpoint_number, 86 endpoint_number,
87 cable_number)); 87 cable_number));
88 if (it != jack_dictionary_.end()) 88 if (it != jack_dictionary_.end())
89 delegate_->OnReceivedData(it->second, &packet[1], packet_size, timestamp); 89 delegate_->OnReceivedData(it->second, &packet[1], packet_size, timestamp);
90 } 90 }
91 91
92 std::vector<UsbMidiInputStream::JackUniqueKey>
93 UsbMidiInputStream::RegisteredJackKeysForTesting() const {
94 std::vector<JackUniqueKey> result(jack_dictionary_.size(),
95 JackUniqueKey(0, 0, 0));
96 for (std::map<JackUniqueKey, size_t>::const_iterator it =
97 jack_dictionary_.begin();
98 it != jack_dictionary_.end(); ++it) {
99 DCHECK_LT(it->second, result.size());
100 result[it->second] = it->first;
101 }
102 return result;
103 }
104
92 } // namespace media 105 } // namespace media
OLDNEW
« no previous file with comments | « media/midi/usb_midi_input_stream.h ('k') | media/midi/usb_midi_jack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698