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

Unified Diff: media/midi/midi_manager.h

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
Index: media/midi/midi_manager.h
diff --git a/media/midi/midi_manager.h b/media/midi/midi_manager.h
index c2b26ab1b136df59fb1cf1a04cdf35c98607d9ca..edbe07a8a06782c2af73b5fd914b6e79a0c84b86 100644
--- a/media/midi/midi_manager.h
+++ b/media/midi/midi_manager.h
@@ -6,6 +6,7 @@
#define MEDIA_MIDI_MIDI_MANAGER_H_
#include <set>
+#include <vector>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
@@ -70,9 +71,8 @@ class MEDIA_EXPORT MIDIManager {
// |timestamp| is the time to send the data, in seconds. A value of 0
// means send "now" or as soon as possible.
void DispatchSendMIDIData(MIDIManagerClient* client,
- int port_index,
- const uint8* data,
- size_t length,
+ unsigned int port_index,
+ const std::vector<uint8>& data,
double timestamp);
// input_ports() is a list of MIDI ports for receiving MIDI data.
@@ -90,21 +90,24 @@ class MEDIA_EXPORT MIDIManager {
virtual bool Initialize() = 0;
// Implements the platform-specific details of sending MIDI data.
+ // This function runs on MIDISendThread.
virtual void SendMIDIData(MIDIManagerClient* client,
- int port_index,
- const uint8* data,
- size_t length,
+ unsigned int port_index,
+ const std::vector<uint8>& data,
double timestamp) = 0;
void AddInputPort(const MIDIPortInfo& info);
void AddOutputPort(const MIDIPortInfo& info);
// Dispatches to all clients.
- void ReceiveMIDIData(
- int port_index,
- const uint8* data,
- size_t length,
- double timestamp);
+ // TODO(toyoshim): Make |port_index| unsigned to be consistent with send side.
+ void ReceiveMIDIData(int port_index,
+ const uint8* data,
+ size_t length,
+ double timestamp);
+
+ // Checks if current thread is MIDISendThread.
+ bool CurrentlyOnMIDISendThread();
bool initialized_;

Powered by Google App Engine
This is Rietveld 408576698