| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return; | 83 return; |
| 84 | 84 |
| 85 if (getConnection() != ConnectionStateOpen) | 85 if (getConnection() != ConnectionStateOpen) |
| 86 return; | 86 return; |
| 87 | 87 |
| 88 // Drop sysex message here when the client does not request it. Note that th
is is not a security check but an | 88 // Drop sysex message here when the client does not request it. Note that th
is is not a security check but an |
| 89 // automatic filtering for clients that do not want sysex message. Also note
that sysex message will never be sent | 89 // automatic filtering for clients that do not want sysex message. Also note
that sysex message will never be sent |
| 90 // unless the current process has an explicit permission to handle sysex mes
sage. | 90 // unless the current process has an explicit permission to handle sysex mes
sage. |
| 91 if (data[0] == 0xf0 && !midiAccess()->sysexEnabled()) | 91 if (data[0] == 0xf0 && !midiAccess()->sysexEnabled()) |
| 92 return; | 92 return; |
| 93 RefPtr<DOMUint8Array> array = DOMUint8Array::create(data, length); | 93 // TODO(junov) crbug.com/536816: |
| 94 dispatchEvent(MIDIMessageEvent::create(timeStamp, array)); | 94 // Use createOrNull instead of deprecatedCreateOrCrash. Requires determining |
| 95 // the appropriate course of action for dealing with allocation failures, wh
ich |
| 96 // is currently not specified in the spec. Specification notwithstanding, sh
ould |
| 97 // we just drop the event (silently fail) instead of crashing the process? W
e could |
| 98 // also just dispatch the event with null data. |
| 99 RefPtr<DOMUint8Array> array = DOMUint8Array::deprecatedCreateOrCrash(data, l
ength); |
| 100 dispatchEvent(MIDIMessageEvent::create(timeStamp, array.release())); |
| 95 } | 101 } |
| 96 | 102 |
| 97 DEFINE_TRACE(MIDIInput) | 103 DEFINE_TRACE(MIDIInput) |
| 98 { | 104 { |
| 99 MIDIPort::trace(visitor); | 105 MIDIPort::trace(visitor); |
| 100 } | 106 } |
| 101 | 107 |
| 102 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |