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

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: review #7 and #8 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..8b9a22333331ba0b8cb519f639422175f14b3894 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,
+ size_t port_index,
palmer 2013/08/26 17:43:25 uint32_t
Takashi Toyoshima 2013/08/27 07:14:33 Done.
+ 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 (port_index >= destinations_.size())
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