| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 return m_cdm.get(); | 270 return m_cdm.get(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 DEFINE_TRACE(MediaKeys) { | 273 DEFINE_TRACE(MediaKeys) { |
| 274 visitor->trace(m_pendingActions); | 274 visitor->trace(m_pendingActions); |
| 275 visitor->trace(m_mediaElement); | 275 visitor->trace(m_mediaElement); |
| 276 ActiveDOMObject::trace(visitor); | 276 ActiveDOMObject::trace(visitor); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void MediaKeys::contextDestroyed() { | 279 void MediaKeys::contextDestroyed() { |
| 280 ActiveDOMObject::contextDestroyed(); | 280 if (m_timer.isActive()) |
| 281 m_timer.stop(); |
| 282 m_pendingActions.clear(); |
| 281 | 283 |
| 282 // We don't need the CDM anymore. Only destroyed after all related | 284 // We don't need the CDM anymore. Only destroyed after all related |
| 283 // ActiveDOMObjects have been stopped. | 285 // ActiveDOMObjects have been stopped. |
| 284 m_cdm.reset(); | 286 m_cdm.reset(); |
| 285 } | 287 } |
| 286 | 288 |
| 287 bool MediaKeys::hasPendingActivity() const { | 289 bool MediaKeys::hasPendingActivity() const { |
| 288 // Remain around if there are pending events. | 290 // Remain around if there are pending events. |
| 289 DVLOG(MEDIA_KEYS_LOG_LEVEL) | 291 DVLOG(MEDIA_KEYS_LOG_LEVEL) |
| 290 << __func__ << "(" << this << ")" | 292 << __func__ << "(" << this << ")" |
| 291 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") | 293 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") |
| 292 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); | 294 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); |
| 293 | 295 |
| 294 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; | 296 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; |
| 295 } | 297 } |
| 296 | 298 |
| 297 void MediaKeys::stop() { | |
| 298 ActiveDOMObject::stop(); | |
| 299 | |
| 300 if (m_timer.isActive()) | |
| 301 m_timer.stop(); | |
| 302 m_pendingActions.clear(); | |
| 303 } | |
| 304 | |
| 305 } // namespace blink | 299 } // namespace blink |
| OLD | NEW |