Index: media/midi/midi_manager.cc |
diff --git a/media/midi/midi_manager.cc b/media/midi/midi_manager.cc |
index c53eef4112c33a662bd5e850e38c497df8c52aaf..fbccbba28712bb4120f5c6cee99a3fd4068a5408 100644 |
--- a/media/midi/midi_manager.cc |
+++ b/media/midi/midi_manager.cc |
@@ -26,7 +26,7 @@ MidiManager* MidiManager::Create() { |
} |
#endif |
-void MidiManager::StartSession(MidiManagerClient* client, int client_id) { |
+void MidiManager::StartSession(MidiManagerClient* client) { |
bool session_is_ready; |
bool session_needs_initialization = false; |
bool too_many_pending_clients_exist = false; |
@@ -43,7 +43,7 @@ void MidiManager::StartSession(MidiManagerClient* client, int client_id) { |
if (!too_many_pending_clients_exist) { |
// Call StartInitialization() only for the first request. |
session_needs_initialization = pending_clients_.empty(); |
- pending_clients_.insert(std::make_pair(client, client_id)); |
+ pending_clients_.insert(client); |
} |
} |
} |
@@ -58,7 +58,7 @@ void MidiManager::StartSession(MidiManagerClient* client, int client_id) { |
} |
if (too_many_pending_clients_exist) { |
// Return an error immediately if there are too many requests. |
- client->CompleteStartSession(client_id, MIDI_INITIALIZATION_ERROR); |
+ client->CompleteStartSession(MIDI_INITIALIZATION_ERROR); |
return; |
} |
// CompleteInitialization() will be called asynchronously when platform |
@@ -75,7 +75,7 @@ void MidiManager::StartSession(MidiManagerClient* client, int client_id) { |
clients_.insert(client); |
result = result_; |
} |
- client->CompleteStartSession(client_id, result); |
+ client->CompleteStartSession(result); |
} |
void MidiManager::EndSession(MidiManagerClient* client) { |
@@ -121,8 +121,8 @@ void MidiManager::ReceiveMidiData( |
double timestamp) { |
base::AutoLock auto_lock(lock_); |
- for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i) |
- (*i)->ReceiveMidiData(port_index, data, length, timestamp); |
+ for (ClientSet::iterator it = clients_.begin(); it != clients_.end(); ++it) |
yhirano
2014/10/20 12:15:15
You can use the range-based for.
Takashi Toyoshima
2014/10/20 17:14:44
Done.
|
+ (*it)->ReceiveMidiData(port_index, data, length, timestamp); |
} |
void MidiManager::CompleteInitializationInternal(MidiResult result) { |
@@ -134,12 +134,12 @@ void MidiManager::CompleteInitializationInternal(MidiResult result) { |
initialized_ = true; |
result_ = result; |
- for (PendingClientMap::iterator it = pending_clients_.begin(); |
+ for (ClientSet::iterator it = pending_clients_.begin(); |
yhirano
2014/10/20 12:15:15
ditto
Takashi Toyoshima
2014/10/20 17:14:44
Done.
|
it != pending_clients_.end(); |
++it) { |
if (result_ == MIDI_OK) |
- clients_.insert(it->first); |
- it->first->CompleteStartSession(it->second, result_); |
+ clients_.insert(*it); |
+ (*it)->CompleteStartSession(result_); |
} |
pending_clients_.clear(); |
} |