OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 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 3498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3509 | 3509 |
3510 void HTMLMediaElement::stop() | 3510 void HTMLMediaElement::stop() |
3511 { | 3511 { |
3512 WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this); | 3512 WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this); |
3513 | 3513 |
3514 m_active = false; | 3514 m_active = false; |
3515 userCancelledLoad(); | 3515 userCancelledLoad(); |
3516 | 3516 |
3517 // Stop the playback without generating events | 3517 // Stop the playback without generating events |
3518 m_playing = false; | 3518 m_playing = false; |
| 3519 m_paused = true; |
| 3520 m_seeking = false; |
3519 setPausedInternal(true); | 3521 setPausedInternal(true); |
3520 | 3522 |
3521 if (renderer()) | 3523 if (renderer()) |
3522 renderer()->updateFromElement(); | 3524 renderer()->updateFromElement(); |
3523 | 3525 |
3524 stopPeriodicTimers(); | 3526 stopPeriodicTimers(); |
3525 cancelPendingEventsAndCallbacks(); | 3527 cancelPendingEventsAndCallbacks(); |
3526 | 3528 |
3527 m_asyncEventQueue->close(); | 3529 m_asyncEventQueue->close(); |
| 3530 |
| 3531 // Ensure that hasPendingActivity() is not preventing garbage collection, si
nce otherwise this |
| 3532 // media element will simply leak. |
| 3533 ASSERT(!hasPendingActivity()); |
3528 } | 3534 } |
3529 | 3535 |
3530 bool HTMLMediaElement::hasPendingActivity() const | 3536 bool HTMLMediaElement::hasPendingActivity() const |
3531 { | 3537 { |
3532 // After the document becomes inactive, no events can ever be fired. | |
3533 if (!document().isActive()) | |
3534 return false; | |
3535 | |
3536 // The delaying-the-load-event flag is set by resource selection algorithm w
hen looking for a | 3538 // The delaying-the-load-event flag is set by resource selection algorithm w
hen looking for a |
3537 // resource to load, before networkState has reached to NETWORK_LOADING. | 3539 // resource to load, before networkState has reached to NETWORK_LOADING. |
3538 if (m_shouldDelayLoadEvent) | 3540 if (m_shouldDelayLoadEvent) |
3539 return true; | 3541 return true; |
3540 | 3542 |
3541 // When networkState is NETWORK_LOADING, progress and stalled events may be
fired. | 3543 // When networkState is NETWORK_LOADING, progress and stalled events may be
fired. |
3542 if (m_networkState == NETWORK_LOADING) | 3544 if (m_networkState == NETWORK_LOADING) |
3543 return true; | 3545 return true; |
3544 | 3546 |
3545 // When playing or if playback may continue, timeupdate events may be fired. | 3547 // When playing or if playback may continue, timeupdate events may be fired. |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4045 | 4047 |
4046 #if ENABLE(WEB_AUDIO) | 4048 #if ENABLE(WEB_AUDIO) |
4047 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 4049 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
4048 { | 4050 { |
4049 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 4051 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
4050 audioSourceProvider()->setClient(0); | 4052 audioSourceProvider()->setClient(0); |
4051 } | 4053 } |
4052 #endif | 4054 #endif |
4053 | 4055 |
4054 } | 4056 } |
OLD | NEW |