| Index: content/renderer/media/midi_message_filter.cc
|
| diff --git a/content/renderer/media/midi_message_filter.cc b/content/renderer/media/midi_message_filter.cc
|
| index 27fe2a72fa63d74e239f4ff7d5abe2298a63fa48..fb9dbd611382787d55f174cae7aa6ca0b6e74fad 100644
|
| --- a/content/renderer/media/midi_message_filter.cc
|
| +++ b/content/renderer/media/midi_message_filter.cc
|
| @@ -60,6 +60,8 @@ void MidiMessageFilter::RemoveClient(blink::WebMIDIAccessorClient* client) {
|
| clients_waiting_session_queue_.erase(it);
|
| if (clients_.empty() && clients_waiting_session_queue_.empty()) {
|
| session_result_ = media::MIDI_NOT_INITIALIZED;
|
| + inputs_.clear();
|
| + outputs_.clear();
|
| io_message_loop_->PostTask(FROM_HERE,
|
| base::Bind(&MidiMessageFilter::EndSessionOnIOThread, this));
|
| }
|
| @@ -125,6 +127,8 @@ bool MidiMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP(MidiMessageFilter, message)
|
| IPC_MESSAGE_HANDLER(MidiMsg_SessionStarted, OnSessionStarted)
|
| + IPC_MESSAGE_HANDLER(MidiMsg_AddInputPort, OnAddInputPort)
|
| + IPC_MESSAGE_HANDLER(MidiMsg_AddOutputPort, OnAddOutputPort)
|
| IPC_MESSAGE_HANDLER(MidiMsg_DataReceived, OnDataReceived)
|
| IPC_MESSAGE_HANDLER(MidiMsg_AcknowledgeSentData, OnAcknowledgeSentData)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| @@ -149,15 +153,11 @@ void MidiMessageFilter::OnChannelClosing() {
|
| sender_ = NULL;
|
| }
|
|
|
| -void MidiMessageFilter::OnSessionStarted(media::MidiResult result,
|
| - MidiPortInfoList inputs,
|
| - MidiPortInfoList outputs) {
|
| +void MidiMessageFilter::OnSessionStarted(media::MidiResult result) {
|
| TRACE_EVENT0("midi", "MidiMessageFilter::OnSessionStarted");
|
| DCHECK(io_message_loop_->BelongsToCurrentThread());
|
| base::AutoLock auto_lock(lock_);
|
| session_result_ = result;
|
| - inputs_ = inputs;
|
| - outputs_ = outputs;
|
| // Handle on the main JS thread.
|
| for (blink::WebMIDIAccessorClient* client : clients_waiting_session_queue_) {
|
| main_message_loop_->PostTask(FROM_HERE,
|
| @@ -166,6 +166,20 @@ void MidiMessageFilter::OnSessionStarted(media::MidiResult result,
|
| clients_waiting_session_queue_.clear();
|
| }
|
|
|
| +void MidiMessageFilter::OnAddInputPort(media::MidiPortInfo info) {
|
| + DCHECK(io_message_loop_->BelongsToCurrentThread());
|
| + base::AutoLock auto_lock(lock_);
|
| + inputs_.push_back(info);
|
| + // TODO(toyoshim): Notify to clients that were already added.
|
| +}
|
| +
|
| +void MidiMessageFilter::OnAddOutputPort(media::MidiPortInfo info) {
|
| + DCHECK(io_message_loop_->BelongsToCurrentThread());
|
| + base::AutoLock auto_lock(lock_);
|
| + outputs_.push_back(info);
|
| + // TODO(toyoshim): Notify to clients that were already added.
|
| +}
|
| +
|
| void MidiMessageFilter::OnDataReceived(uint32 port,
|
| const std::vector<uint8>& data,
|
| double timestamp) {
|
|
|