| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 ExecutionContext* MIDIPort::getExecutionContext() const { | 148 ExecutionContext* MIDIPort::getExecutionContext() const { |
| 149 return m_access->getExecutionContext(); | 149 return m_access->getExecutionContext(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool MIDIPort::hasPendingActivity() const { | 152 bool MIDIPort::hasPendingActivity() const { |
| 153 // MIDIPort should survive if ConnectionState is "open" or can be "open" via | 153 // MIDIPort should survive if ConnectionState is "open" or can be "open" via |
| 154 // a MIDIConnectionEvent even if there are no references from JavaScript. | 154 // a MIDIConnectionEvent even if there are no references from JavaScript. |
| 155 return m_connection != ConnectionStateClosed; | 155 return m_connection != ConnectionStateClosed; |
| 156 } | 156 } |
| 157 | 157 |
| 158 void MIDIPort::contextDestroyed() { | 158 void MIDIPort::contextDestroyed(ExecutionContext*) { |
| 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 ContextLifecycleObserver::trace(visitor); | 166 ContextLifecycleObserver::trace(visitor); |
| 167 } | 167 } |
| 168 | 168 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |