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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 sent_bytes_in_flight_ += data.size(); | 116 sent_bytes_in_flight_ += data.size(); |
117 } | 117 } |
118 midi_manager_->DispatchSendMidiData(this, port, data, timestamp); | 118 midi_manager_->DispatchSendMidiData(this, port, data, timestamp); |
119 } | 119 } |
120 | 120 |
121 void MidiHost::CompleteStartSession(int client_id, media::MidiResult result) { | 121 void MidiHost::CompleteStartSession(int client_id, media::MidiResult result) { |
122 MidiPortInfoList input_ports; | 122 MidiPortInfoList input_ports; |
123 MidiPortInfoList output_ports; | 123 MidiPortInfoList output_ports; |
124 | 124 |
125 if (result == media::MIDI_OK) { | 125 if (result == media::MIDI_OK) { |
126 input_ports = midi_manager_->input_ports(); | 126 input_ports = midi_manager_->get_input_ports(); |
127 output_ports = midi_manager_->output_ports(); | 127 output_ports = midi_manager_->get_output_ports(); |
128 received_messages_queues_.clear(); | 128 received_messages_queues_.clear(); |
129 received_messages_queues_.resize(input_ports.size()); | 129 received_messages_queues_.resize(input_ports.size()); |
130 // ChildSecurityPolicy is set just before OnStartSession by | 130 // ChildSecurityPolicy is set just before OnStartSession by |
131 // MidiDispatcherHost. So we can safely cache the policy. | 131 // MidiDispatcherHost. So we can safely cache the policy. |
132 has_sys_ex_permission_ = ChildProcessSecurityPolicyImpl::GetInstance()-> | 132 has_sys_ex_permission_ = ChildProcessSecurityPolicyImpl::GetInstance()-> |
133 CanSendMidiSysExMessage(renderer_process_id_); | 133 CanSendMidiSysExMessage(renderer_process_id_); |
134 } | 134 } |
135 | 135 |
136 Send(new MidiMsg_SessionStarted(client_id, | 136 Send(new MidiMsg_SessionStarted(client_id, |
137 result, | 137 result, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 217 } |
218 waiting_data_length = media::GetMidiMessageLength(current); | 218 waiting_data_length = media::GetMidiMessageLength(current); |
219 if (waiting_data_length == 0) | 219 if (waiting_data_length == 0) |
220 return false; // Error: |current| should have been a valid status byte. | 220 return false; // Error: |current| should have been a valid status byte. |
221 --waiting_data_length; // Found status byte | 221 --waiting_data_length; // Found status byte |
222 } | 222 } |
223 return waiting_data_length == 0 && !in_sysex; | 223 return waiting_data_length == 0 && !in_sysex; |
224 } | 224 } |
225 | 225 |
226 } // namespace content | 226 } // namespace content |
OLD | NEW |