| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |