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 : BrowserMessageFilter(MidiMsgStart), | 52 : renderer_process_id_(renderer_process_id), |
53 renderer_process_id_(renderer_process_id), | |
54 has_sys_ex_permission_(false), | 53 has_sys_ex_permission_(false), |
55 midi_manager_(midi_manager), | 54 midi_manager_(midi_manager), |
56 sent_bytes_in_flight_(0), | 55 sent_bytes_in_flight_(0), |
57 bytes_sent_since_last_acknowledgement_(0) { | 56 bytes_sent_since_last_acknowledgement_(0) { |
58 } | 57 } |
59 | 58 |
60 MidiHost::~MidiHost() { | 59 MidiHost::~MidiHost() { |
61 if (midi_manager_) | 60 if (midi_manager_) |
62 midi_manager_->EndSession(this); | 61 midi_manager_->EndSession(this); |
63 } | 62 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 217 } |
219 waiting_data_length = media::GetMidiMessageLength(current); | 218 waiting_data_length = media::GetMidiMessageLength(current); |
220 if (waiting_data_length == 0) | 219 if (waiting_data_length == 0) |
221 return false; // Error: |current| should have been a valid status byte. | 220 return false; // Error: |current| should have been a valid status byte. |
222 --waiting_data_length; // Found status byte | 221 --waiting_data_length; // Found status byte |
223 } | 222 } |
224 return waiting_data_length == 0 && !in_sysex; | 223 return waiting_data_length == 0 && !in_sysex; |
225 } | 224 } |
226 | 225 |
227 } // namespace content | 226 } // namespace content |
OLD | NEW |