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/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 ReportUsage(Usage::SESSION_ENDED); | 127 ReportUsage(Usage::SESSION_ENDED); |
128 | 128 |
129 // At this point, |client| can be in the destruction process, and calling | 129 // At this point, |client| can be in the destruction process, and calling |
130 // any method of |client| is dangerous. | 130 // any method of |client| is dangerous. |
131 base::AutoLock auto_lock(lock_); | 131 base::AutoLock auto_lock(lock_); |
132 clients_.erase(client); | 132 clients_.erase(client); |
133 pending_clients_.erase(client); | 133 pending_clients_.erase(client); |
134 } | 134 } |
135 | 135 |
136 void MidiManager::AccumulateMidiBytesSent(MidiManagerClient* client, size_t n) { | 136 void MidiManager::AccumulateMidiBytesSent(MidiManagerClient* client, size_t n) { |
137 { | 137 base::AutoLock auto_lock(lock_); |
138 base::AutoLock auto_lock(lock_); | 138 if (clients_.find(client) == clients_.end()) |
139 if (clients_.find(client) == clients_.end()) | 139 return; |
140 return; | 140 |
141 } | |
142 client->AccumulateMidiBytesSent(n); | 141 client->AccumulateMidiBytesSent(n); |
143 } | 142 } |
144 | 143 |
145 void MidiManager::DispatchSendMidiData(MidiManagerClient* client, | 144 void MidiManager::DispatchSendMidiData(MidiManagerClient* client, |
146 uint32 port_index, | 145 uint32 port_index, |
147 const std::vector<uint8>& data, | 146 const std::vector<uint8>& data, |
148 double timestamp) { | 147 double timestamp) { |
149 NOTREACHED(); | 148 NOTREACHED(); |
150 } | 149 } |
151 | 150 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 lock_.AssertAcquired(); | 236 lock_.AssertAcquired(); |
238 | 237 |
239 for (const auto& info : input_ports_) | 238 for (const auto& info : input_ports_) |
240 client->AddInputPort(info); | 239 client->AddInputPort(info); |
241 for (const auto& info : output_ports_) | 240 for (const auto& info : output_ports_) |
242 client->AddOutputPort(info); | 241 client->AddOutputPort(info); |
243 } | 242 } |
244 | 243 |
245 } // namespace midi | 244 } // namespace midi |
246 } // namespace media | 245 } // namespace media |
OLD | NEW |