| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/media/midi_host.h" | 5 #include "content/browser/renderer_host/media/midi_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 MidiHost::~MidiHost() { | 60 MidiHost::~MidiHost() { |
| 61 if (midi_manager_) | 61 if (midi_manager_) |
| 62 midi_manager_->EndSession(this); | 62 midi_manager_->EndSession(this); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void MidiHost::OnDestruct() const { | 65 void MidiHost::OnDestruct() const { |
| 66 BrowserThread::DeleteOnIOThread::Destruct(this); | 66 BrowserThread::DeleteOnIOThread::Destruct(this); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // IPC Messages handler | 69 // IPC Messages handler |
| 70 bool MidiHost::OnMessageReceived(const IPC::Message& message, | 70 bool MidiHost::OnMessageReceived(const IPC::Message& message) { |
| 71 bool* message_was_ok) { | |
| 72 bool handled = true; | 71 bool handled = true; |
| 73 IPC_BEGIN_MESSAGE_MAP_EX(MidiHost, message, *message_was_ok) | 72 IPC_BEGIN_MESSAGE_MAP(MidiHost, message) |
| 74 IPC_MESSAGE_HANDLER(MidiHostMsg_StartSession, OnStartSession) | 73 IPC_MESSAGE_HANDLER(MidiHostMsg_StartSession, OnStartSession) |
| 75 IPC_MESSAGE_HANDLER(MidiHostMsg_SendData, OnSendData) | 74 IPC_MESSAGE_HANDLER(MidiHostMsg_SendData, OnSendData) |
| 76 IPC_MESSAGE_UNHANDLED(handled = false) | 75 IPC_MESSAGE_UNHANDLED(handled = false) |
| 77 IPC_END_MESSAGE_MAP_EX() | 76 IPC_END_MESSAGE_MAP() |
| 78 | 77 |
| 79 return handled; | 78 return handled; |
| 80 } | 79 } |
| 81 | 80 |
| 82 void MidiHost::OnStartSession(int client_id) { | 81 void MidiHost::OnStartSession(int client_id) { |
| 83 if (midi_manager_) | 82 if (midi_manager_) |
| 84 midi_manager_->StartSession(this, client_id); | 83 midi_manager_->StartSession(this, client_id); |
| 85 } | 84 } |
| 86 | 85 |
| 87 void MidiHost::OnSendData(uint32 port, | 86 void MidiHost::OnSendData(uint32 port, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 216 } |
| 218 waiting_data_length = media::GetMidiMessageLength(current); | 217 waiting_data_length = media::GetMidiMessageLength(current); |
| 219 if (waiting_data_length == 0) | 218 if (waiting_data_length == 0) |
| 220 return false; // Error: |current| should have been a valid status byte. | 219 return false; // Error: |current| should have been a valid status byte. |
| 221 --waiting_data_length; // Found status byte | 220 --waiting_data_length; // Found status byte |
| 222 } | 221 } |
| 223 return waiting_data_length == 0 && !in_sysex; | 222 return waiting_data_length == 0 && !in_sysex; |
| 224 } | 223 } |
| 225 | 224 |
| 226 } // namespace content | 225 } // namespace content |
| OLD | NEW |