OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/midi_manager.h" | 5 #include "media/midi/midi_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 void MidiManager::AddInputPort(const MidiPortInfo& info) { | 98 void MidiManager::AddInputPort(const MidiPortInfo& info) { |
99 input_ports_.push_back(info); | 99 input_ports_.push_back(info); |
100 } | 100 } |
101 | 101 |
102 void MidiManager::AddOutputPort(const MidiPortInfo& info) { | 102 void MidiManager::AddOutputPort(const MidiPortInfo& info) { |
103 output_ports_.push_back(info); | 103 output_ports_.push_back(info); |
104 } | 104 } |
105 | 105 |
| 106 void MidiManager::ClearInputOutputPorts() { |
| 107 input_ports_.clear(); |
| 108 output_ports_.clear(); |
| 109 } |
| 110 |
106 void MidiManager::ReceiveMidiData( | 111 void MidiManager::ReceiveMidiData( |
107 uint32 port_index, | 112 uint32 port_index, |
108 const uint8* data, | 113 const uint8* data, |
109 size_t length, | 114 size_t length, |
110 double timestamp) { | 115 double timestamp) { |
111 base::AutoLock auto_lock(lock_); | 116 base::AutoLock auto_lock(lock_); |
112 | 117 |
113 for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i) | 118 for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i) |
114 (*i)->ReceiveMidiData(port_index, data, length, timestamp); | 119 (*i)->ReceiveMidiData(port_index, data, length, timestamp); |
115 } | 120 } |
(...skipping 12 matching lines...) Expand all Loading... |
128 it != pending_clients_.end(); | 133 it != pending_clients_.end(); |
129 ++it) { | 134 ++it) { |
130 if (result_ == MIDI_OK) | 135 if (result_ == MIDI_OK) |
131 clients_.insert(it->second); | 136 clients_.insert(it->second); |
132 it->second->CompleteStartSession(it->first, result_); | 137 it->second->CompleteStartSession(it->first, result_); |
133 } | 138 } |
134 pending_clients_.clear(); | 139 pending_clients_.clear(); |
135 } | 140 } |
136 | 141 |
137 } // namespace media | 142 } // namespace media |
OLD | NEW |