| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 break; | 183 break; |
| 184 case PortState::OPENED: | 184 case PortState::OPENED: |
| 185 NOTREACHED(); | 185 NOTREACHED(); |
| 186 break; | 186 break; |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 ScriptPromise MIDIPort::accept(ScriptState* scriptState) { | 190 ScriptPromise MIDIPort::accept(ScriptState* scriptState) { |
| 191 return ScriptPromise::cast( | 191 return ScriptPromise::cast( |
| 192 scriptState, | 192 scriptState, |
| 193 toV8(this, scriptState->context()->Global(), scriptState->isolate())); | 193 ToV8(this, scriptState->context()->Global(), scriptState->isolate())); |
| 194 } | 194 } |
| 195 | 195 |
| 196 ScriptPromise MIDIPort::reject(ScriptState* scriptState, | 196 ScriptPromise MIDIPort::reject(ScriptState* scriptState, |
| 197 ExceptionCode ec, | 197 ExceptionCode ec, |
| 198 const String& message) { | 198 const String& message) { |
| 199 return ScriptPromise::rejectWithDOMException( | 199 return ScriptPromise::rejectWithDOMException( |
| 200 scriptState, DOMException::create(ec, message)); | 200 scriptState, DOMException::create(ec, message)); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void MIDIPort::setStates(PortState state, ConnectionState connection) { | 203 void MIDIPort::setStates(PortState state, ConnectionState connection) { |
| 204 DCHECK(state != PortState::DISCONNECTED || connection != ConnectionStateOpen); | 204 DCHECK(state != PortState::DISCONNECTED || connection != ConnectionStateOpen); |
| 205 if (m_state == state && m_connection == connection) | 205 if (m_state == state && m_connection == connection) |
| 206 return; | 206 return; |
| 207 m_state = state; | 207 m_state = state; |
| 208 m_connection = connection; | 208 m_connection = connection; |
| 209 dispatchEvent(MIDIConnectionEvent::create(this)); | 209 dispatchEvent(MIDIConnectionEvent::create(this)); |
| 210 m_access->dispatchEvent(MIDIConnectionEvent::create(this)); | 210 m_access->dispatchEvent(MIDIConnectionEvent::create(this)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace blink | 213 } // namespace blink |
| OLD | NEW |