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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 , m_tracksAreReady(true) | 277 , m_tracksAreReady(true) |
278 , m_haveVisibleTextTrack(false) | 278 , m_haveVisibleTextTrack(false) |
279 , m_processingPreferenceChange(false) | 279 , m_processingPreferenceChange(false) |
280 #if ENABLE(OILPAN) | 280 #if ENABLE(OILPAN) |
281 , m_isFinalizing(false) | 281 , m_isFinalizing(false) |
282 #endif | 282 #endif |
283 , m_lastTextTrackUpdateTime(-1) | 283 , m_lastTextTrackUpdateTime(-1) |
284 , m_textTracks(nullptr) | 284 , m_textTracks(nullptr) |
285 , m_ignoreTrackDisplayUpdate(0) | 285 , m_ignoreTrackDisplayUpdate(0) |
286 #if ENABLE(WEB_AUDIO) | 286 #if ENABLE(WEB_AUDIO) |
287 , m_audioSourceNode(0) | 287 , m_audioSourceNode(nullptr) |
288 #endif | 288 #endif |
289 { | 289 { |
290 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); | 290 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); |
291 | 291 |
292 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement"); | 292 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement"); |
293 ScriptWrappable::init(this); | 293 ScriptWrappable::init(this); |
294 | 294 |
295 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes
ture()) | 295 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes
ture()) |
296 m_userGestureRequiredForPlay = true; | 296 m_userGestureRequiredForPlay = true; |
297 | 297 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // supplementable table.) Handled for now by entering an | 365 // supplementable table.) Handled for now by entering an |
366 // is-finalizing state, which is explicitly checked for if the | 366 // is-finalizing state, which is explicitly checked for if the |
367 // player tries to access the media element during shutdown. | 367 // player tries to access the media element during shutdown. |
368 // | 368 // |
369 // FIXME: Oilpan: move the media player to the heap instead and | 369 // FIXME: Oilpan: move the media player to the heap instead and |
370 // avoid having to finalize it from here; this whole #if block | 370 // avoid having to finalize it from here; this whole #if block |
371 // could then be removed (along with the state bit it depends on.) | 371 // could then be removed (along with the state bit it depends on.) |
372 // crbug.com/378229 | 372 // crbug.com/378229 |
373 m_isFinalizing = true; | 373 m_isFinalizing = true; |
374 #endif | 374 #endif |
375 clearMediaPlayerAndAudioSourceProviderClient(); | 375 |
| 376 // The m_audioSourceNode is either dead already or it is dying together with |
| 377 // this HTMLMediaElement which it strongly keeps alive. |
| 378 #if !ENABLE(OILPAN) |
| 379 ASSERT(!m_audioSourceNode); |
| 380 #endif |
| 381 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
376 | 382 |
377 #if !ENABLE(OILPAN) | 383 #if !ENABLE(OILPAN) |
378 document().decrementLoadEventDelayCount(); | 384 document().decrementLoadEventDelayCount(); |
379 #endif | 385 #endif |
380 } | 386 } |
381 | 387 |
382 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) | 388 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) |
383 { | 389 { |
384 WTF_LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); | 390 WTF_LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); |
385 | 391 |
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 | 3118 |
3113 // 6 - Abort the overall resource selection algorithm. | 3119 // 6 - Abort the overall resource selection algorithm. |
3114 m_currentSourceNode = nullptr; | 3120 m_currentSourceNode = nullptr; |
3115 | 3121 |
3116 // Reset m_readyState since m_player is gone. | 3122 // Reset m_readyState since m_player is gone. |
3117 m_readyState = HAVE_NOTHING; | 3123 m_readyState = HAVE_NOTHING; |
3118 updateMediaController(); | 3124 updateMediaController(); |
3119 updateActiveTextTrackCues(0); | 3125 updateActiveTextTrackCues(0); |
3120 } | 3126 } |
3121 | 3127 |
3122 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClient() | 3128 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin
g() |
3123 { | 3129 { |
3124 #if ENABLE(WEB_AUDIO) | 3130 #if ENABLE(WEB_AUDIO) |
3125 if (m_audioSourceNode) | |
3126 m_audioSourceNode->lock(); | |
3127 | |
3128 if (audioSourceProvider()) | 3131 if (audioSourceProvider()) |
3129 audioSourceProvider()->setClient(0); | 3132 audioSourceProvider()->setClient(0); |
3130 #endif | 3133 #endif |
3131 | |
3132 m_player.clear(); | 3134 m_player.clear(); |
3133 | |
3134 #if ENABLE(WEB_AUDIO) | |
3135 if (m_audioSourceNode) | |
3136 m_audioSourceNode->unlock(); | |
3137 #endif | |
3138 } | 3135 } |
3139 | 3136 |
3140 void HTMLMediaElement::clearMediaPlayer(int flags) | 3137 void HTMLMediaElement::clearMediaPlayer(int flags) |
3141 { | 3138 { |
3142 forgetResourceSpecificTracks(); | 3139 forgetResourceSpecificTracks(); |
3143 | 3140 |
3144 closeMediaSource(); | 3141 closeMediaSource(); |
3145 | 3142 |
3146 m_delayingLoadForPreloadNone = false; | 3143 m_delayingLoadForPreloadNone = false; |
3147 | 3144 |
3148 clearMediaPlayerAndAudioSourceProviderClient(); | 3145 #if ENABLE(WEB_AUDIO) |
| 3146 if (m_audioSourceNode) |
| 3147 m_audioSourceNode->lock(); |
| 3148 #endif |
| 3149 |
| 3150 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
| 3151 |
| 3152 #if ENABLE(WEB_AUDIO) |
| 3153 if (m_audioSourceNode) |
| 3154 m_audioSourceNode->unlock(); |
| 3155 #endif |
3149 | 3156 |
3150 stopPeriodicTimers(); | 3157 stopPeriodicTimers(); |
3151 m_loadTimer.stop(); | 3158 m_loadTimer.stop(); |
3152 | 3159 |
3153 m_pendingActionFlags &= ~flags; | 3160 m_pendingActionFlags &= ~flags; |
3154 m_loadState = WaitingForSource; | 3161 m_loadState = WaitingForSource; |
3155 | 3162 |
3156 if (m_textTracks) | 3163 if (m_textTracks) |
3157 configureTextTrackDisplay(AssumeNoVisibleChange); | 3164 configureTextTrackDisplay(AssumeNoVisibleChange); |
3158 } | 3165 } |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3650 } | 3657 } |
3651 | 3658 |
3652 void HTMLMediaElement::trace(Visitor* visitor) | 3659 void HTMLMediaElement::trace(Visitor* visitor) |
3653 { | 3660 { |
3654 visitor->trace(m_error); | 3661 visitor->trace(m_error); |
3655 visitor->trace(m_currentSourceNode); | 3662 visitor->trace(m_currentSourceNode); |
3656 visitor->trace(m_nextChildNodeToConsider); | 3663 visitor->trace(m_nextChildNodeToConsider); |
3657 visitor->trace(m_textTracks); | 3664 visitor->trace(m_textTracks); |
3658 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3665 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
3659 visitor->trace(m_mediaController); | 3666 visitor->trace(m_mediaController); |
| 3667 #if ENABLE(WEB_AUDIO) |
| 3668 visitor->registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakM
embers>(this); |
| 3669 #endif |
3660 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); | 3670 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); |
3661 HTMLElement::trace(visitor); | 3671 HTMLElement::trace(visitor); |
3662 } | 3672 } |
3663 | 3673 |
| 3674 #if ENABLE(WEB_AUDIO) |
| 3675 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
| 3676 { |
| 3677 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
| 3678 audioSourceProvider()->setClient(0); |
3664 } | 3679 } |
| 3680 #endif |
| 3681 |
| 3682 } |
OLD | NEW |