Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: media/midi/midi_manager.cc

Issue 1500153002: Fix crash with MIDI send for MidiManagerAlsa (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary base::Unretained Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/midi/midi_manager_alsa.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | media/midi/midi_manager_alsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698