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

Unified Diff: media/midi/midi_manager_mac.cc

Issue 23379002: Web MIDI: fix multi-threading problem around message buffer handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/CHECK/DCHECK/ Created 7 years, 4 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
« media/midi/midi_manager_mac.h ('K') | « media/midi/midi_manager_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_manager_mac.cc
diff --git a/media/midi/midi_manager_mac.cc b/media/midi/midi_manager_mac.cc
index 7bc8f2332e02f02fbd32342564fcf0eb933397b5..5d749ba774e0929c263ac01dba4c42b180dbea36 100644
--- a/media/midi/midi_manager_mac.cc
+++ b/media/midi/midi_manager_mac.cc
@@ -147,10 +147,11 @@ void MIDIManagerMac::ReadMidi(MIDIEndpointRef source,
}
void MIDIManagerMac::SendMIDIData(MIDIManagerClient* client,
- int port_index,
- const uint8* data,
- size_t length,
+ unsigned int port_index,
+ const std::vector<uint8>& data,
double timestamp) {
+ DCHECK(CurrentlyOnMIDISendThread());
+
// System Exclusive has already been filtered.
MIDITimeStamp coremidi_timestamp = SecondsToMIDITimeStamp(timestamp);
@@ -159,14 +160,11 @@ void MIDIManagerMac::SendMIDIData(MIDIManagerClient* client,
kMaxPacketListSize,
midi_packet_,
coremidi_timestamp,
- length,
- data);
+ data.size(),
+ &data[0]);
// Lookup the destination based on the port index.
- // TODO(crogers): re-factor |port_index| to use unsigned
- // to avoid the need for this check.
- if (port_index < 0 ||
- static_cast<size_t>(port_index) >= destinations_.size())
+ if (static_cast<size_t>(port_index) >= destinations_.size())
scherkus (not reviewing) 2013/08/21 17:46:29 if you make port_index size_t, you can remove the
Takashi Toyoshima 2013/08/22 05:47:45 Done.
return;
MIDIEndpointRef destination = destinations_[port_index];
@@ -176,7 +174,7 @@ void MIDIManagerMac::SendMIDIData(MIDIManagerClient* client,
// Re-initialize for next time.
midi_packet_ = MIDIPacketListInit(packet_list_);
- client->AccumulateMIDIBytesSent(length);
+ client->AccumulateMIDIBytesSent(data.size());
}
MIDIPortInfo MIDIManagerMac::GetPortInfoFromEndpoint(
« media/midi/midi_manager_mac.h ('K') | « media/midi/midi_manager_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698