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

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

Issue 552303006: Prevent more script-observable cases of HTMLMediaElement GC (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: make gc-while-seeking.html non-flaky Created 6 years, 3 months 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 | « LayoutTests/media/track/track-remove-track.html ('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 3505 matching lines...) Expand 10 before | Expand all | Expand 10 after
3516 renderer()->updateFromElement(); 3516 renderer()->updateFromElement();
3517 3517
3518 stopPeriodicTimers(); 3518 stopPeriodicTimers();
3519 cancelPendingEventsAndCallbacks(); 3519 cancelPendingEventsAndCallbacks();
3520 3520
3521 m_asyncEventQueue->close(); 3521 m_asyncEventQueue->close();
3522 } 3522 }
3523 3523
3524 bool HTMLMediaElement::hasPendingActivity() const 3524 bool HTMLMediaElement::hasPendingActivity() const
3525 { 3525 {
3526 return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents(); 3526 // After the document becomes inactive, no events can ever be fired.
3527 if (!document().isActive()) {
3528 ASSERT(!m_asyncEventQueue->hasPendingEvents());
3529 return false;
3530 }
3531
3532 // The delaying-the-load-event flag is set by resource selection algorithm w hen looking for a
3533 // resource to load, before networkState has reached to NETWORK_LOADING.
3534 if (m_shouldDelayLoadEvent)
3535 return true;
3536
3537 // When networkState is NETWORK_LOADING, progress and stalled events may be fired.
3538 if (m_networkState == NETWORK_LOADING)
3539 return true;
3540
3541 // When playing or if playback may continue, timeupdate events may be fired.
3542 if (couldPlayIfEnoughData())
3543 return true;
3544
3545 // When the seek finishes timeupdate and seeked events will be fired.
3546 if (m_seeking)
3547 return true;
3548
3549 // When connected to a MediaSource, e.g. setting MediaSource.duration will c ause a
3550 // durationchange event to be fired.
3551 if (m_mediaSource)
3552 return true;
3553
3554 // Wait for any pending events to be fired.
3555 if (m_asyncEventQueue->hasPendingEvents())
3556 return true;
3557
3558 return false;
3527 } 3559 }
3528 3560
3529 void HTMLMediaElement::contextDestroyed() 3561 void HTMLMediaElement::contextDestroyed()
3530 { 3562 {
3531 // With Oilpan the ExecutionContext is weakly referenced from the media 3563 // With Oilpan the ExecutionContext is weakly referenced from the media
3532 // controller and so it will clear itself on destruction. 3564 // controller and so it will clear itself on destruction.
3533 #if !ENABLE(OILPAN) 3565 #if !ENABLE(OILPAN)
3534 if (m_mediaController) 3566 if (m_mediaController)
3535 m_mediaController->clearExecutionContext(); 3567 m_mediaController->clearExecutionContext();
3536 #endif 3568 #endif
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
4009 4041
4010 #if ENABLE(WEB_AUDIO) 4042 #if ENABLE(WEB_AUDIO)
4011 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 4043 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
4012 { 4044 {
4013 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 4045 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
4014 audioSourceProvider()->setClient(0); 4046 audioSourceProvider()->setClient(0);
4015 } 4047 }
4016 #endif 4048 #endif
4017 4049
4018 } 4050 }
OLDNEW
« no previous file with comments | « LayoutTests/media/track/track-remove-track.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698