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

Unified Diff: media/midi/midi_manager.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
Index: media/midi/midi_manager.cc
diff --git a/media/midi/midi_manager.cc b/media/midi/midi_manager.cc
index 05fcfa45a96f215af0f079c64717fa8182e0e251..8d0bf5088d57654ff4e9cf606c5b99775c0fb43e 100644
--- a/media/midi/midi_manager.cc
+++ b/media/midi/midi_manager.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/message_loop/message_loop.h"
#include "base/threading/thread.h"
namespace media {
@@ -62,10 +63,13 @@ void MIDIManager::ReceiveMIDIData(
(*i)->ReceiveMIDIData(port_index, data, length, timestamp);
}
+bool MIDIManager::CurrentlyOnMIDISendThread() {
+ return send_thread_->message_loop() == base::MessageLoop::current();
+}
+
void MIDIManager::DispatchSendMIDIData(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) {
// Lazily create the thread when first needed.
if (!send_thread_) {
@@ -77,7 +81,7 @@ void MIDIManager::DispatchSendMIDIData(MIDIManagerClient* client,
send_message_loop_->PostTask(
FROM_HERE,
base::Bind(&MIDIManager::SendMIDIData, base::Unretained(this),
- client, port_index, data, length, timestamp));
+ client, port_index, data, timestamp));
}
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698