Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 return false; | 139 return false; |
| 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()); |
|
yhirano
2016/05/10 16:08:24
DCHECK(!isEndOfSysEx());
Takashi Toyoshima
2016/05/11 05:59:16
Done.
| |
| 150 static const int channelMessageLength[7] = { 3, 3, 3, 3, 2, 2, 3 }; // f or 0x8*, 0x9*, ..., 0xe* | 150 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 | 151 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]; | 152 size_t length = isSystemMessage() ? systemMessageLength[m_data[m_offset] - 0xf1] : channelMessageLength[(m_data[m_offset] >> 4) - 8]; |
|
yhirano
2016/05/10 16:08:24
DCHECK_GT(length, 0);
Takashi Toyoshima
2016/05/11 05:59:16
Good point.
I also added new test items that input
| |
| 153 size_t count = 1; | 153 m_offset++; |
| 154 for (m_offset++; !isEndOfData(); m_offset++) { | 154 if (length == 1) |
| 155 return true; | |
| 156 for (size_t count = 1; !isEndOfData(); m_offset++) { | |
| 155 if (isReservedStatusByte()) | 157 if (isReservedStatusByte()) |
| 156 return false; | 158 return false; |
| 157 if (isRealTimeMessage()) | 159 if (isRealTimeMessage()) |
| 158 continue; | 160 continue; |
| 159 if (isStatusByte()) | 161 if (isStatusByte()) |
| 160 return false; | 162 return false; |
| 161 if (++count == length) { | 163 if (++count == length) { |
| 162 m_offset++; | 164 m_offset++; |
| 163 return true; | 165 return true; |
| 164 } | 166 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 { | 241 { |
| 240 send(unsignedData, 0.0, exceptionState); | 242 send(unsignedData, 0.0, exceptionState); |
| 241 } | 243 } |
| 242 | 244 |
| 243 DEFINE_TRACE(MIDIOutput) | 245 DEFINE_TRACE(MIDIOutput) |
| 244 { | 246 { |
| 245 MIDIPort::trace(visitor); | 247 MIDIPort::trace(visitor); |
| 246 } | 248 } |
| 247 | 249 |
| 248 } // namespace blink | 250 } // namespace blink |
| OLD | NEW |