| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 m_state = Invoked; | 92 m_state = Invoked; |
| 93 m_errorCallback->handleEvent(error.get()); | 93 m_errorCallback->handleEvent(error.get()); |
| 94 clear(); | 94 clear(); |
| 95 } else { | 95 } else { |
| 96 m_state = Rejected; | 96 m_state = Rejected; |
| 97 m_error = error; | 97 m_error = error; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 void MIDIAccessPromise::then(PassRefPtr<MIDISuccessCallback> successCallback, Pa
ssRefPtr<MIDIErrorCallback> errorCallback) | 102 void MIDIAccessPromise::then(PassOwnPtr<MIDISuccessCallback> successCallback, Pa
ssOwnPtr<MIDIErrorCallback> errorCallback) |
| 103 { | 103 { |
| 104 // Lazily request access. | 104 // Lazily request access. |
| 105 if (!m_access) | 105 if (!m_access) |
| 106 m_access = MIDIAccess::create(executionContext(), this); | 106 m_access = MIDIAccess::create(executionContext(), this); |
| 107 | 107 |
| 108 switch (m_state) { | 108 switch (m_state) { |
| 109 case Accepted: | 109 case Accepted: |
| 110 m_state = Invoked; | 110 m_state = Invoked; |
| 111 successCallback->handleEvent(m_access.get(), m_options->sysex); | 111 successCallback->handleEvent(m_access.get(), m_options->sysex); |
| 112 clear(); | 112 clear(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 131 { | 131 { |
| 132 ASSERT(m_state == Invoked); | 132 ASSERT(m_state == Invoked); |
| 133 m_access.clear(); | 133 m_access.clear(); |
| 134 m_error.clear(); | 134 m_error.clear(); |
| 135 m_options.clear(); | 135 m_options.clear(); |
| 136 m_successCallback.clear(); | 136 m_successCallback.clear(); |
| 137 m_errorCallback.clear(); | 137 m_errorCallback.clear(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace WebCore | 140 } // namespace WebCore |
| OLD | NEW |