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

Side by Side Diff: third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp

Issue 1963063002: Web MIDI: Tune Request [0xf6] wasn't handled correctly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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 | « third_party/WebKit/LayoutTests/webmidi/send-system-messages-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 return false; 141 return false;
142 } 142 }
143 143
144 bool acceptCurrentMessage() 144 bool acceptCurrentMessage()
145 { 145 {
146 DCHECK(isStatusByte()); 146 DCHECK(isStatusByte());
147 DCHECK(!isSysex()); 147 DCHECK(!isSysex());
148 DCHECK(!isReservedStatusByte()); 148 DCHECK(!isReservedStatusByte());
149 DCHECK(!isRealTimeMessage()); 149 DCHECK(!isRealTimeMessage());
150 DCHECK(!isEndOfSysex());
150 static const int channelMessageLength[7] = { 3, 3, 3, 3, 2, 2, 3 }; // f or 0x8*, 0x9*, ..., 0xe* 151 static const int channelMessageLength[7] = { 3, 3, 3, 3, 2, 2, 3 }; // f or 0x8*, 0x9*, ..., 0xe*
151 static const int systemMessageLength[7] = { 2, 3, 2, 0, 0, 1, 0 }; // fo r 0xf1, 0xf2, ..., 0xf7 152 static const int systemMessageLength[7] = { 2, 3, 2, 0, 0, 1, 0 }; // fo r 0xf1, 0xf2, ..., 0xf7
152 size_t length = isSystemMessage() ? systemMessageLength[m_data[m_offset] - 0xf1] : channelMessageLength[(m_data[m_offset] >> 4) - 8]; 153 size_t length = isSystemMessage() ? systemMessageLength[m_data[m_offset] - 0xf1] : channelMessageLength[(m_data[m_offset] >> 4) - 8];
153 size_t count = 1; 154 m_offset++;
154 for (m_offset++; !isEndOfData(); m_offset++) { 155 DCHECK_GT(length, 0UL);
156 if (length == 1)
157 return true;
158 for (size_t count = 1; !isEndOfData(); m_offset++) {
155 if (isReservedStatusByte()) 159 if (isReservedStatusByte())
156 return false; 160 return false;
157 if (isRealTimeMessage()) 161 if (isRealTimeMessage())
158 continue; 162 continue;
159 if (isStatusByte()) 163 if (isStatusByte())
160 return false; 164 return false;
161 if (++count == length) { 165 if (++count == length) {
162 m_offset++; 166 m_offset++;
163 return true; 167 return true;
164 } 168 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 { 243 {
240 send(unsignedData, 0.0, exceptionState); 244 send(unsignedData, 0.0, exceptionState);
241 } 245 }
242 246
243 DEFINE_TRACE(MIDIOutput) 247 DEFINE_TRACE(MIDIOutput)
244 { 248 {
245 MIDIPort::trace(visitor); 249 MIDIPort::trace(visitor);
246 } 250 }
247 251
248 } // namespace blink 252 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webmidi/send-system-messages-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698