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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 return; | 103 return; |
104 | 104 |
105 // For now disallow all System Exclusive messages even if we | 105 // For now disallow all System Exclusive messages even if we |
106 // have permission. | 106 // have permission. |
107 // TODO(toyoshim): allow System Exclusive if browser has granted | 107 // TODO(toyoshim): allow System Exclusive if browser has granted |
108 // this client access. We'll likely need to pass a GURL | 108 // this client access. We'll likely need to pass a GURL |
109 // here to compare against our permissions. | 109 // here to compare against our permissions. |
110 if (data.size() > 0 && data[0] >= kSysExMessage) | 110 if (data.size() > 0 && data[0] >= kSysExMessage) |
111 return; | 111 return; |
112 | 112 |
113 #if defined(OS_ANDROID) | |
114 // TODO(toyoshim): figure out why data() method does not compile on Android. | |
scherkus (not reviewing)
2013/08/19 17:28:20
AFAIK data() is part of C++11 :)
Takashi Toyoshima
2013/08/19 18:03:40
Agreed. http://www.cplusplus.com/reference/vector/
| |
115 NOTIMPLEMENTED(); | |
116 #else | |
117 midi_manager_->DispatchSendMIDIData( | 113 midi_manager_->DispatchSendMIDIData( |
118 this, | 114 this, |
119 port, | 115 port, |
120 data.data(), | 116 &data.front(), |
scherkus (not reviewing)
2013/08/19 17:28:20
FYI technically this would segfault calling front(
Takashi Toyoshima
2013/08/19 18:03:40
Oh, I didn't think empty cases.
Actually, a render
| |
121 data.size(), | 117 data.size(), |
122 timestamp); | 118 timestamp); |
123 #endif | |
124 | 119 |
125 sent_bytes_in_flight_ += data.size(); | 120 sent_bytes_in_flight_ += data.size(); |
126 } | 121 } |
127 | 122 |
128 void MIDIHost::ReceiveMIDIData( | 123 void MIDIHost::ReceiveMIDIData( |
129 int port_index, | 124 int port_index, |
130 const uint8* data, | 125 const uint8* data, |
131 size_t length, | 126 size_t length, |
132 double timestamp) { | 127 double timestamp) { |
133 TRACE_EVENT0("midi", "MIDIHost::ReceiveMIDIData"); | 128 TRACE_EVENT0("midi", "MIDIHost::ReceiveMIDIData"); |
(...skipping 24 matching lines...) Expand all Loading... | |
158 | 153 |
159 if (bytes_sent_since_last_acknowledgement_ >= | 154 if (bytes_sent_since_last_acknowledgement_ >= |
160 kAcknowledgementThresholdBytes) { | 155 kAcknowledgementThresholdBytes) { |
161 Send(new MIDIMsg_AcknowledgeSentData( | 156 Send(new MIDIMsg_AcknowledgeSentData( |
162 bytes_sent_since_last_acknowledgement_)); | 157 bytes_sent_since_last_acknowledgement_)); |
163 bytes_sent_since_last_acknowledgement_ = 0; | 158 bytes_sent_since_last_acknowledgement_ = 0; |
164 } | 159 } |
165 } | 160 } |
166 | 161 |
167 } // namespace content | 162 } // namespace content |
OLD | NEW |