Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 88183002: HTMLMediaElement::clearMediaPlayer should acquire MediaElementAudioSourceNode::lock() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // See http://crbug.com/233654 for more details. 353 // See http://crbug.com/233654 for more details.
354 m_completelyLoaded = true; 354 m_completelyLoaded = true;
355 355
356 // Destroying the player may cause a resource load to be canceled, 356 // Destroying the player may cause a resource load to be canceled,
357 // which could result in Document::dispatchWindowLoadEvent() being 357 // which could result in Document::dispatchWindowLoadEvent() being
358 // called via ResourceFetch::didLoadResource() then 358 // called via ResourceFetch::didLoadResource() then
359 // FrameLoader::loadDone(). To prevent load event dispatching during 359 // FrameLoader::loadDone(). To prevent load event dispatching during
360 // object destruction, we use Document::incrementLoadEventDelayCount(). 360 // object destruction, we use Document::incrementLoadEventDelayCount().
361 // See http://crbug.com/275223 for more details. 361 // See http://crbug.com/275223 for more details.
362 document().incrementLoadEventDelayCount(); 362 document().incrementLoadEventDelayCount();
363 m_player.clear(); 363
364 #if ENABLE(WEB_AUDIO) 364 clearMediaPlayerAndAudioSourceProviderClient();
365 if (audioSourceProvider()) 365
366 audioSourceProvider()->setClient(0);
367 #endif
368 document().decrementLoadEventDelayCount(); 366 document().decrementLoadEventDelayCount();
369 } 367 }
370 368
371 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) 369 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument)
372 { 370 {
373 LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); 371 LOG(Media, "HTMLMediaElement::didMoveToNewDocument");
374 372
375 if (m_shouldDelayLoadEvent) { 373 if (m_shouldDelayLoadEvent) {
376 document().incrementLoadEventDelayCount(); 374 document().incrementLoadEventDelayCount();
377 // Note: Keeping the load event delay count increment on oldDocument tha t was added 375 // Note: Keeping the load event delay count increment on oldDocument tha t was added
(...skipping 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after
3376 // 6 - Abort the overall resource selection algorithm. 3374 // 6 - Abort the overall resource selection algorithm.
3377 m_currentSourceNode = 0; 3375 m_currentSourceNode = 0;
3378 3376
3379 // Reset m_readyState since m_player is gone. 3377 // Reset m_readyState since m_player is gone.
3380 m_readyState = HAVE_NOTHING; 3378 m_readyState = HAVE_NOTHING;
3381 updateMediaController(); 3379 updateMediaController();
3382 if (RuntimeEnabledFeatures::videoTrackEnabled()) 3380 if (RuntimeEnabledFeatures::videoTrackEnabled())
3383 updateActiveTextTrackCues(0); 3381 updateActiveTextTrackCues(0);
3384 } 3382 }
3385 3383
3384 void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClient()
3385 {
3386 #if ENABLE(WEB_AUDIO)
3387 if (m_audioSourceNode)
3388 m_audioSourceNode->lock();
3389
3390 if (audioSourceProvider())
3391 audioSourceProvider()->setClient(0);
3392 #endif
3393
3394 m_player.clear();
3395
3396 #if ENABLE(WEB_AUDIO)
3397 if (m_audioSourceNode)
3398 m_audioSourceNode->unlock();
3399 #endif
3400 }
3401
3386 void HTMLMediaElement::clearMediaPlayer(int flags) 3402 void HTMLMediaElement::clearMediaPlayer(int flags)
3387 { 3403 {
3388 removeAllInbandTracks(); 3404 removeAllInbandTracks();
3389 3405
3390 closeMediaSource(); 3406 closeMediaSource();
3391 3407
3392 m_player.clear(); 3408 clearMediaPlayerAndAudioSourceProviderClient();
3393 #if ENABLE(WEB_AUDIO) 3409
3394 if (audioSourceProvider())
3395 audioSourceProvider()->setClient(0);
3396 #endif
3397 stopPeriodicTimers(); 3410 stopPeriodicTimers();
3398 m_loadTimer.stop(); 3411 m_loadTimer.stop();
3399 3412
3400 m_pendingActionFlags &= ~flags; 3413 m_pendingActionFlags &= ~flags;
3401 m_loadState = WaitingForSource; 3414 m_loadState = WaitingForSource;
3402 3415
3403 if (m_textTracks) 3416 if (m_textTracks)
3404 configureTextTrackDisplay(AssumeNoVisibleChange); 3417 configureTextTrackDisplay(AssumeNoVisibleChange);
3405 } 3418 }
3406 3419
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 m_audioSourceNode->unlock(); 3712 m_audioSourceNode->unlock();
3700 } 3713 }
3701 #endif 3714 #endif
3702 } 3715 }
3703 3716
3704 #if ENABLE(WEB_AUDIO) 3717 #if ENABLE(WEB_AUDIO)
3705 void HTMLMediaElement::setAudioSourceNode(MediaElementAudioSourceNode* sourceNod e) 3718 void HTMLMediaElement::setAudioSourceNode(MediaElementAudioSourceNode* sourceNod e)
3706 { 3719 {
3707 m_audioSourceNode = sourceNode; 3720 m_audioSourceNode = sourceNode;
3708 3721
3722 if (m_audioSourceNode)
3723 m_audioSourceNode->lock();
3724
3709 if (audioSourceProvider()) 3725 if (audioSourceProvider())
3710 audioSourceProvider()->setClient(m_audioSourceNode); 3726 audioSourceProvider()->setClient(m_audioSourceNode);
3727
3728 if (m_audioSourceNode)
3729 m_audioSourceNode->unlock();
3711 } 3730 }
3712 3731
3713 AudioSourceProvider* HTMLMediaElement::audioSourceProvider() 3732 AudioSourceProvider* HTMLMediaElement::audioSourceProvider()
3714 { 3733 {
3715 if (m_player) 3734 if (m_player)
3716 return m_player->audioSourceProvider(); 3735 return m_player->audioSourceProvider();
3717 3736
3718 return 0; 3737 return 0;
3719 } 3738 }
3720 #endif 3739 #endif
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
3872 { 3891 {
3873 scheduleLayerUpdate(); 3892 scheduleLayerUpdate();
3874 } 3893 }
3875 3894
3876 bool HTMLMediaElement::isInteractiveContent() const 3895 bool HTMLMediaElement::isInteractiveContent() const
3877 { 3896 {
3878 return fastHasAttribute(controlsAttr); 3897 return fastHasAttribute(controlsAttr);
3879 } 3898 }
3880 3899
3881 } 3900 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698