| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 m_options.clear(); | 69 m_options.clear(); |
| 70 } else { | 70 } else { |
| 71 m_state = Accepted; | 71 m_state = Accepted; |
| 72 } | 72 } |
| 73 unsetPendingActivity(this); | 73 unsetPendingActivity(this); |
| 74 } | 74 } |
| 75 m_successCallback.clear(); | 75 m_successCallback.clear(); |
| 76 m_errorCallback.clear(); | 76 m_errorCallback.clear(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void MIDIAccessPromise::reject(DOMError* error) | 79 void MIDIAccessPromise::reject(PassRefPtr<DOMError> error) |
| 80 { | 80 { |
| 81 if (m_state == Pending) { | 81 if (m_state == Pending) { |
| 82 if (m_errorCallback) { | 82 if (m_errorCallback) { |
| 83 m_state = Invoked; | 83 m_state = Invoked; |
| 84 m_errorCallback->handleEvent(error); | 84 m_errorCallback->handleEvent(error.leakRef()); |
| 85 } else { | 85 } else { |
| 86 m_state = Rejected; | 86 m_state = Rejected; |
| 87 m_error = adoptRef(error); | 87 m_error = error; |
| 88 } | 88 } |
| 89 unsetPendingActivity(this); | 89 unsetPendingActivity(this); |
| 90 } | 90 } |
| 91 m_successCallback.clear(); | 91 m_successCallback.clear(); |
| 92 m_errorCallback.clear(); | 92 m_errorCallback.clear(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void MIDIAccessPromise::then(PassRefPtr<MIDISuccessCallback> successCallback, Pa
ssRefPtr<MIDIErrorCallback> errorCallback) | 95 void MIDIAccessPromise::then(PassRefPtr<MIDISuccessCallback> successCallback, Pa
ssRefPtr<MIDIErrorCallback> errorCallback) |
| 96 { | 96 { |
| 97 switch (m_state) { | 97 switch (m_state) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 109 m_errorCallback = errorCallback; | 109 m_errorCallback = errorCallback; |
| 110 break; | 110 break; |
| 111 case Invoked: | 111 case Invoked: |
| 112 break; | 112 break; |
| 113 default: | 113 default: |
| 114 ASSERT_NOT_REACHED(); | 114 ASSERT_NOT_REACHED(); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace WebCore | 118 } // namespace WebCore |
| OLD | NEW |