| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 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 : SuspendableObject(access->getExecutionContext()), | 49 : ContextLifecycleObserver(access->getExecutionContext()), |
| 50 m_id(id), | 50 m_id(id), |
| 51 m_manufacturer(manufacturer), | 51 m_manufacturer(manufacturer), |
| 52 m_name(name), | 52 m_name(name), |
| 53 m_type(type), | 53 m_type(type), |
| 54 m_version(version), | 54 m_version(version), |
| 55 m_access(this, access), | 55 m_access(this, access), |
| 56 m_connection(ConnectionStateClosed) { | 56 m_connection(ConnectionStateClosed) { |
| 57 DCHECK(access); | 57 DCHECK(access); |
| 58 DCHECK(type == TypeInput || type == TypeOutput); | 58 DCHECK(type == TypeInput || type == TypeOutput); |
| 59 DCHECK(state == PortState::DISCONNECTED || state == PortState::CONNECTED); | 59 DCHECK(state == PortState::DISCONNECTED || state == PortState::CONNECTED); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 void MIDIPort::contextDestroyed() { | 158 void MIDIPort::contextDestroyed() { |
| 159 // Should be "closed" to assume there are no pending activities. | 159 // Should be "closed" to assume there are no pending activities. |
| 160 m_connection = ConnectionStateClosed; | 160 m_connection = ConnectionStateClosed; |
| 161 } | 161 } |
| 162 | 162 |
| 163 DEFINE_TRACE(MIDIPort) { | 163 DEFINE_TRACE(MIDIPort) { |
| 164 visitor->trace(m_access); | 164 visitor->trace(m_access); |
| 165 EventTargetWithInlineData::trace(visitor); | 165 EventTargetWithInlineData::trace(visitor); |
| 166 SuspendableObject::trace(visitor); | 166 ContextLifecycleObserver::trace(visitor); |
| 167 } | 167 } |
| 168 | 168 |
| 169 DEFINE_TRACE_WRAPPERS(MIDIPort) { | 169 DEFINE_TRACE_WRAPPERS(MIDIPort) { |
| 170 visitor->traceWrappers(m_access); | 170 visitor->traceWrappers(m_access); |
| 171 EventTargetWithInlineData::traceWrappers(visitor); | 171 EventTargetWithInlineData::traceWrappers(visitor); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void MIDIPort::open() { | 174 void MIDIPort::open() { |
| 175 switch (m_state) { | 175 switch (m_state) { |
| 176 case PortState::DISCONNECTED: | 176 case PortState::DISCONNECTED: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 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 |