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

Unified Diff: media/midi/midi_manager.cc

Issue 332323002: Merge 276987 "Web MIDI: MidiManager crashes if a session is ende..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1985/src/
Patch Set: Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/midi/midi_manager.h ('k') | media/midi/midi_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_manager.cc
===================================================================
--- media/midi/midi_manager.cc (revision 277616)
+++ media/midi/midi_manager.cc (working copy)
@@ -43,8 +43,7 @@
if (!too_many_pending_clients_exist) {
// Call StartInitialization() only for the first request.
session_needs_initialization = pending_clients_.empty();
- pending_clients_.insert(
- std::pair<int, MidiManagerClient*>(client_id, client));
+ pending_clients_.insert(std::make_pair(client, client_id));
}
}
}
@@ -81,9 +80,8 @@
void MidiManager::EndSession(MidiManagerClient* client) {
base::AutoLock auto_lock(lock_);
- ClientList::iterator i = clients_.find(client);
- if (i != clients_.end())
- clients_.erase(i);
+ clients_.erase(client);
+ pending_clients_.erase(client);
}
void MidiManager::DispatchSendMidiData(MidiManagerClient* client,
@@ -132,7 +130,6 @@
base::AutoLock auto_lock(lock_);
DCHECK(clients_.empty());
- DCHECK(!pending_clients_.empty());
DCHECK(!initialized_);
initialized_ = true;
result_ = result;
@@ -141,8 +138,8 @@
it != pending_clients_.end();
++it) {
if (result_ == MIDI_OK)
- clients_.insert(it->second);
- it->second->CompleteStartSession(it->first, result_);
+ clients_.insert(it->first);
+ it->first->CompleteStartSession(it->second, result_);
}
pending_clients_.clear();
}
« no previous file with comments | « media/midi/midi_manager.h ('k') | media/midi/midi_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698