| 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 29 matching lines...) Expand all Loading... |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 MIDIPort::MIDIPort(MIDIAccess* access, | 42 MIDIPort::MIDIPort(MIDIAccess* access, |
| 43 const String& id, | 43 const String& id, |
| 44 const String& manufacturer, | 44 const String& manufacturer, |
| 45 const String& name, | 45 const String& name, |
| 46 TypeCode type, | 46 TypeCode type, |
| 47 const String& version, | 47 const String& version, |
| 48 PortState state) | 48 PortState state) |
| 49 : ActiveScriptWrappable(this), | 49 : ActiveScriptWrappable(this), |
| 50 ActiveDOMObject(access->getExecutionContext()), | 50 SuspendableObject(access->getExecutionContext()), |
| 51 m_id(id), | 51 m_id(id), |
| 52 m_manufacturer(manufacturer), | 52 m_manufacturer(manufacturer), |
| 53 m_name(name), | 53 m_name(name), |
| 54 m_type(type), | 54 m_type(type), |
| 55 m_version(version), | 55 m_version(version), |
| 56 m_access(this, access), | 56 m_access(this, access), |
| 57 m_connection(ConnectionStateClosed) { | 57 m_connection(ConnectionStateClosed) { |
| 58 DCHECK(access); | 58 DCHECK(access); |
| 59 DCHECK(type == TypeInput || type == TypeOutput); | 59 DCHECK(type == TypeInput || type == TypeOutput); |
| 60 DCHECK(state == PortState::DISCONNECTED || state == PortState::CONNECTED); | 60 DCHECK(state == PortState::DISCONNECTED || state == PortState::CONNECTED); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 void MIDIPort::contextDestroyed() { | 159 void MIDIPort::contextDestroyed() { |
| 160 // Should be "closed" to assume there are no pending activities. | 160 // Should be "closed" to assume there are no pending activities. |
| 161 m_connection = ConnectionStateClosed; | 161 m_connection = ConnectionStateClosed; |
| 162 } | 162 } |
| 163 | 163 |
| 164 DEFINE_TRACE(MIDIPort) { | 164 DEFINE_TRACE(MIDIPort) { |
| 165 visitor->trace(m_access); | 165 visitor->trace(m_access); |
| 166 EventTargetWithInlineData::trace(visitor); | 166 EventTargetWithInlineData::trace(visitor); |
| 167 ActiveDOMObject::trace(visitor); | 167 SuspendableObject::trace(visitor); |
| 168 } | 168 } |
| 169 | 169 |
| 170 DEFINE_TRACE_WRAPPERS(MIDIPort) { | 170 DEFINE_TRACE_WRAPPERS(MIDIPort) { |
| 171 visitor->traceWrappers(m_access); | 171 visitor->traceWrappers(m_access); |
| 172 EventTargetWithInlineData::traceWrappers(visitor); | 172 EventTargetWithInlineData::traceWrappers(visitor); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void MIDIPort::open() { | 175 void MIDIPort::open() { |
| 176 switch (m_state) { | 176 switch (m_state) { |
| 177 case PortState::DISCONNECTED: | 177 case PortState::DISCONNECTED: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 205 DCHECK(state != PortState::DISCONNECTED || connection != ConnectionStateOpen); | 205 DCHECK(state != PortState::DISCONNECTED || connection != ConnectionStateOpen); |
| 206 if (m_state == state && m_connection == connection) | 206 if (m_state == state && m_connection == connection) |
| 207 return; | 207 return; |
| 208 m_state = state; | 208 m_state = state; |
| 209 m_connection = connection; | 209 m_connection = connection; |
| 210 dispatchEvent(MIDIConnectionEvent::create(this)); | 210 dispatchEvent(MIDIConnectionEvent::create(this)); |
| 211 m_access->dispatchEvent(MIDIConnectionEvent::create(this)); | 211 m_access->dispatchEvent(MIDIConnectionEvent::create(this)); |
| 212 } | 212 } |
| 213 | 213 |
| 214 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |