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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 ReportUsage(Usage::SESSION_ENDED); | 142 ReportUsage(Usage::SESSION_ENDED); |
143 | 143 |
144 // At this point, |client| can be in the destruction process, and calling | 144 // At this point, |client| can be in the destruction process, and calling |
145 // any method of |client| is dangerous. | 145 // any method of |client| is dangerous. |
146 base::AutoLock auto_lock(lock_); | 146 base::AutoLock auto_lock(lock_); |
147 clients_.erase(client); | 147 clients_.erase(client); |
148 pending_clients_.erase(client); | 148 pending_clients_.erase(client); |
149 } | 149 } |
150 | 150 |
151 void MidiManager::AccumulateMidiBytesSent(MidiManagerClient* client, size_t n) { | 151 void MidiManager::AccumulateMidiBytesSent(MidiManagerClient* client, size_t n) { |
152 { | 152 base::AutoLock auto_lock(lock_); |
153 base::AutoLock auto_lock(lock_); | 153 if (clients_.find(client) == clients_.end()) |
154 if (clients_.find(client) == clients_.end()) | 154 return; |
155 return; | 155 |
156 } | |
157 client->AccumulateMidiBytesSent(n); | 156 client->AccumulateMidiBytesSent(n); |
Takashi Toyoshima
2015/12/07 06:00:28
Good catch.
Can you add a comment here?
We are l
| |
158 } | 157 } |
159 | 158 |
160 void MidiManager::DispatchSendMidiData(MidiManagerClient* client, | 159 void MidiManager::DispatchSendMidiData(MidiManagerClient* client, |
161 uint32 port_index, | 160 uint32 port_index, |
162 const std::vector<uint8>& data, | 161 const std::vector<uint8>& data, |
163 double timestamp) { | 162 double timestamp) { |
164 NOTREACHED(); | 163 NOTREACHED(); |
165 } | 164 } |
166 | 165 |
167 void MidiManager::StartInitialization() { | 166 void MidiManager::StartInitialization() { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 base::AutoLock auto_lock(lock_); | 259 base::AutoLock auto_lock(lock_); |
261 finalized_ = true; | 260 finalized_ = true; |
262 | 261 |
263 // Detach all clients so that they do not call MidiManager methods any more. | 262 // Detach all clients so that they do not call MidiManager methods any more. |
264 for (auto client : clients_) | 263 for (auto client : clients_) |
265 client->Detach(); | 264 client->Detach(); |
266 } | 265 } |
267 | 266 |
268 } // namespace midi | 267 } // namespace midi |
269 } // namespace media | 268 } // namespace media |
OLD | NEW |