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 #if !ENABLE(OILPAN) | |
377 ASSERT(!m_audioSourceNode); | |
378 #endif | |
379 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | |
acolwell GONE FROM CHROMIUM
2014/06/10 17:07:17
This makes me nervous. This is safe because we can
zerny-chromium
2014/06/10 19:42:29
Yes. The HTMLMediaElement can only die after the M
| |
376 | 380 |
377 #if !ENABLE(OILPAN) | 381 #if !ENABLE(OILPAN) |
378 document().decrementLoadEventDelayCount(); | 382 document().decrementLoadEventDelayCount(); |
379 #endif | 383 #endif |
380 } | 384 } |
381 | 385 |
382 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) | 386 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) |
383 { | 387 { |
384 WTF_LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); | 388 WTF_LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); |
385 | 389 |
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3112 | 3116 |
3113 // 6 - Abort the overall resource selection algorithm. | 3117 // 6 - Abort the overall resource selection algorithm. |
3114 m_currentSourceNode = nullptr; | 3118 m_currentSourceNode = nullptr; |
3115 | 3119 |
3116 // Reset m_readyState since m_player is gone. | 3120 // Reset m_readyState since m_player is gone. |
3117 m_readyState = HAVE_NOTHING; | 3121 m_readyState = HAVE_NOTHING; |
3118 updateMediaController(); | 3122 updateMediaController(); |
3119 updateActiveTextTrackCues(0); | 3123 updateActiveTextTrackCues(0); |
3120 } | 3124 } |
3121 | 3125 |
3126 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin g() | |
3127 { | |
3128 #if ENABLE(WEB_AUDIO) | |
3129 if (audioSourceProvider()) | |
3130 audioSourceProvider()->setClient(0); | |
3131 #endif | |
3132 m_player.clear(); | |
3133 } | |
3134 | |
3122 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClient() | 3135 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClient() |
acolwell GONE FROM CHROMIUM
2014/06/10 17:07:17
nit: How about just moving the body of this functi
zerny-chromium
2014/06/10 19:42:29
Done.
| |
3123 { | 3136 { |
3124 #if ENABLE(WEB_AUDIO) | 3137 #if ENABLE(WEB_AUDIO) |
3125 if (m_audioSourceNode) | 3138 if (m_audioSourceNode) |
3126 m_audioSourceNode->lock(); | 3139 m_audioSourceNode->lock(); |
3127 | |
3128 if (audioSourceProvider()) | |
3129 audioSourceProvider()->setClient(0); | |
3130 #endif | 3140 #endif |
3131 | 3141 |
3132 m_player.clear(); | 3142 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
3133 | 3143 |
3134 #if ENABLE(WEB_AUDIO) | 3144 #if ENABLE(WEB_AUDIO) |
3135 if (m_audioSourceNode) | 3145 if (m_audioSourceNode) |
3136 m_audioSourceNode->unlock(); | 3146 m_audioSourceNode->unlock(); |
3137 #endif | 3147 #endif |
3138 } | 3148 } |
3139 | 3149 |
3140 void HTMLMediaElement::clearMediaPlayer(int flags) | 3150 void HTMLMediaElement::clearMediaPlayer(int flags) |
3141 { | 3151 { |
3142 forgetResourceSpecificTracks(); | 3152 forgetResourceSpecificTracks(); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3649 HTMLElement::defaultEventHandler(event); | 3659 HTMLElement::defaultEventHandler(event); |
3650 } | 3660 } |
3651 | 3661 |
3652 void HTMLMediaElement::trace(Visitor* visitor) | 3662 void HTMLMediaElement::trace(Visitor* visitor) |
3653 { | 3663 { |
3654 visitor->trace(m_error); | 3664 visitor->trace(m_error); |
3655 visitor->trace(m_currentSourceNode); | 3665 visitor->trace(m_currentSourceNode); |
3656 visitor->trace(m_nextChildNodeToConsider); | 3666 visitor->trace(m_nextChildNodeToConsider); |
3657 visitor->trace(m_textTracks); | 3667 visitor->trace(m_textTracks); |
3658 visitor->trace(m_textTracksWhenResourceSelectionBegan); | 3668 visitor->trace(m_textTracksWhenResourceSelectionBegan); |
3669 visitor->registerWeakMembers<HTMLMediaElement, &HTMLMediaElement::clearWeakM embers>(this); | |
3659 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); | 3670 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); |
3660 HTMLElement::trace(visitor); | 3671 HTMLElement::trace(visitor); |
3661 } | 3672 } |
3662 | 3673 |
3674 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | |
3675 { | |
3676 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | |
3677 audioSourceProvider()->setClient(0); | |
3663 } | 3678 } |
3679 | |
3680 } | |
OLD | NEW |