| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 bool IsSystemRealTimeMessage(uint8 data) { | 42 bool IsSystemRealTimeMessage(uint8 data) { |
| 43 return 0xf8 <= data && data <= 0xff; | 43 return 0xf8 <= data && data <= 0xff; |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 using media::kSysExByte; | 48 using media::kSysExByte; |
| 49 using media::kEndOfSysExByte; | 49 using media::kEndOfSysExByte; |
| 50 | 50 |
| 51 MidiHost::MidiHost(int renderer_process_id, media::MidiManager* midi_manager) | 51 MidiHost::MidiHost(int renderer_process_id, media::MidiManager* midi_manager) |
| 52 : renderer_process_id_(renderer_process_id), | 52 : BrowserMessageFilter(MidiMsgStart), |
| 53 renderer_process_id_(renderer_process_id), |
| 53 has_sys_ex_permission_(false), | 54 has_sys_ex_permission_(false), |
| 54 midi_manager_(midi_manager), | 55 midi_manager_(midi_manager), |
| 55 sent_bytes_in_flight_(0), | 56 sent_bytes_in_flight_(0), |
| 56 bytes_sent_since_last_acknowledgement_(0) { | 57 bytes_sent_since_last_acknowledgement_(0) { |
| 57 } | 58 } |
| 58 | 59 |
| 59 MidiHost::~MidiHost() { | 60 MidiHost::~MidiHost() { |
| 60 if (midi_manager_) | 61 if (midi_manager_) |
| 61 midi_manager_->EndSession(this); | 62 midi_manager_->EndSession(this); |
| 62 } | 63 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 218 } |
| 218 waiting_data_length = media::GetMidiMessageLength(current); | 219 waiting_data_length = media::GetMidiMessageLength(current); |
| 219 if (waiting_data_length == 0) | 220 if (waiting_data_length == 0) |
| 220 return false; // Error: |current| should have been a valid status byte. | 221 return false; // Error: |current| should have been a valid status byte. |
| 221 --waiting_data_length; // Found status byte | 222 --waiting_data_length; // Found status byte |
| 222 } | 223 } |
| 223 return waiting_data_length == 0 && !in_sysex; | 224 return waiting_data_length == 0 && !in_sysex; |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace content | 227 } // namespace content |
| OLD | NEW |