Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: content/browser/media/midi_host.cc

Issue 2422163002: Web MIDI: use midi_service.mojom for media::midi::PortState (Closed)
Patch Set: gn --check fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/media/midi_host.h ('k') | content/browser/media/midi_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/media/midi_host.h" 5 #include "content/browser/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/process/process.h" 9 #include "base/process/process.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 21 matching lines...) Expand all
32 const size_t kAcknowledgementThresholdBytes = 1024 * 1024; // 1 MB. 32 const size_t kAcknowledgementThresholdBytes = 1024 * 1024; // 1 MB.
33 33
34 } // namespace 34 } // namespace
35 35
36 using midi::IsDataByte; 36 using midi::IsDataByte;
37 using midi::IsSystemRealTimeMessage; 37 using midi::IsSystemRealTimeMessage;
38 using midi::IsValidWebMIDIData; 38 using midi::IsValidWebMIDIData;
39 using midi::MidiPortInfo; 39 using midi::MidiPortInfo;
40 using midi::kSysExByte; 40 using midi::kSysExByte;
41 using midi::kEndOfSysExByte; 41 using midi::kEndOfSysExByte;
42 using midi::mojom::PortState;
42 using midi::mojom::Result; 43 using midi::mojom::Result;
43 44
44 MidiHost::MidiHost(int renderer_process_id, 45 MidiHost::MidiHost(int renderer_process_id,
45 midi::MidiManager* midi_manager) 46 midi::MidiManager* midi_manager)
46 : BrowserMessageFilter(MidiMsgStart), 47 : BrowserMessageFilter(MidiMsgStart),
47 renderer_process_id_(renderer_process_id), 48 renderer_process_id_(renderer_process_id),
48 has_sys_ex_permission_(false), 49 has_sys_ex_permission_(false),
49 is_session_requested_(false), 50 is_session_requested_(false),
50 midi_manager_(midi_manager), 51 midi_manager_(midi_manager),
51 sent_bytes_in_flight_(0), 52 sent_bytes_in_flight_(0),
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 received_messages_queues_.push_back(nullptr); 155 received_messages_queues_.push_back(nullptr);
155 Send(new MidiMsg_AddInputPort(info)); 156 Send(new MidiMsg_AddInputPort(info));
156 } 157 }
157 158
158 void MidiHost::AddOutputPort(const MidiPortInfo& info) { 159 void MidiHost::AddOutputPort(const MidiPortInfo& info) {
159 base::AutoLock auto_lock(output_port_count_lock_); 160 base::AutoLock auto_lock(output_port_count_lock_);
160 output_port_count_++; 161 output_port_count_++;
161 Send(new MidiMsg_AddOutputPort(info)); 162 Send(new MidiMsg_AddOutputPort(info));
162 } 163 }
163 164
164 void MidiHost::SetInputPortState(uint32_t port, 165 void MidiHost::SetInputPortState(uint32_t port, PortState state) {
165 midi::MidiPortState state) {
166 Send(new MidiMsg_SetInputPortState(port, state)); 166 Send(new MidiMsg_SetInputPortState(port, state));
167 } 167 }
168 168
169 void MidiHost::SetOutputPortState(uint32_t port, 169 void MidiHost::SetOutputPortState(uint32_t port, PortState state) {
170 midi::MidiPortState state) {
171 Send(new MidiMsg_SetOutputPortState(port, state)); 170 Send(new MidiMsg_SetOutputPortState(port, state));
172 } 171 }
173 172
174 void MidiHost::ReceiveMidiData(uint32_t port, 173 void MidiHost::ReceiveMidiData(uint32_t port,
175 const uint8_t* data, 174 const uint8_t* data,
176 size_t length, 175 size_t length,
177 double timestamp) { 176 double timestamp) {
178 TRACE_EVENT0("midi", "MidiHost::ReceiveMidiData"); 177 TRACE_EVENT0("midi", "MidiHost::ReceiveMidiData");
179 178
180 base::AutoLock auto_lock(messages_queues_lock_); 179 base::AutoLock auto_lock(messages_queues_lock_);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 bytes_sent_since_last_acknowledgement_)); 219 bytes_sent_since_last_acknowledgement_));
221 bytes_sent_since_last_acknowledgement_ = 0; 220 bytes_sent_since_last_acknowledgement_ = 0;
222 } 221 }
223 } 222 }
224 223
225 void MidiHost::Detach() { 224 void MidiHost::Detach() {
226 midi_manager_ = nullptr; 225 midi_manager_ = nullptr;
227 } 226 }
228 227
229 } // namespace content 228 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/midi_host.h ('k') | content/browser/media/midi_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698