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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 87 } |
88 | 88 |
89 void MidiManager::EndSession(MidiManagerClient* client) { | 89 void MidiManager::EndSession(MidiManagerClient* client) { |
90 // At this point, |client| can be in the destruction process, and calling | 90 // At this point, |client| can be in the destruction process, and calling |
91 // any method of |client| is dangerous. | 91 // any method of |client| is dangerous. |
92 base::AutoLock auto_lock(lock_); | 92 base::AutoLock auto_lock(lock_); |
93 clients_.erase(client); | 93 clients_.erase(client); |
94 pending_clients_.erase(client); | 94 pending_clients_.erase(client); |
95 } | 95 } |
96 | 96 |
| 97 void MidiManager::AccumulateMidiBytesSent(MidiManagerClient* client, size_t n) { |
| 98 { |
| 99 base::AutoLock auto_lock(lock_); |
| 100 if (clients_.find(client) == clients_.end()) |
| 101 return; |
| 102 } |
| 103 client->AccumulateMidiBytesSent(n); |
| 104 } |
| 105 |
97 void MidiManager::DispatchSendMidiData(MidiManagerClient* client, | 106 void MidiManager::DispatchSendMidiData(MidiManagerClient* client, |
98 uint32 port_index, | 107 uint32 port_index, |
99 const std::vector<uint8>& data, | 108 const std::vector<uint8>& data, |
100 double timestamp) { | 109 double timestamp) { |
101 NOTREACHED(); | 110 NOTREACHED(); |
102 } | 111 } |
103 | 112 |
104 void MidiManager::StartInitialization() { | 113 void MidiManager::StartInitialization() { |
105 CompleteInitialization(MIDI_NOT_SUPPORTED); | 114 CompleteInitialization(MIDI_NOT_SUPPORTED); |
106 } | 115 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 void MidiManager::AddInitialPorts(MidiManagerClient* client) { | 188 void MidiManager::AddInitialPorts(MidiManagerClient* client) { |
180 lock_.AssertAcquired(); | 189 lock_.AssertAcquired(); |
181 | 190 |
182 for (const auto& info : input_ports_) | 191 for (const auto& info : input_ports_) |
183 client->AddInputPort(info); | 192 client->AddInputPort(info); |
184 for (const auto& info : output_ports_) | 193 for (const auto& info : output_ports_) |
185 client->AddOutputPort(info); | 194 client->AddOutputPort(info); |
186 } | 195 } |
187 | 196 |
188 } // namespace media | 197 } // namespace media |
OLD | NEW |