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

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: 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 // allowed to touch the document to adjust delay load event counts 386 // allowed to touch the document to adjust delay load event counts
387 // because the document could have been already 387 // because the document could have been already
388 // destructed. However, if the HTMLMediaElement dies with the 388 // destructed. However, if the HTMLMediaElement dies with the
389 // document there is no need to change the delayed load counts 389 // document there is no need to change the delayed load counts
390 // because no load event will fire anyway. If the document is 390 // because no load event will fire anyway. If the document is
391 // still alive we do have to decrement the load delay counts. We 391 // still alive we do have to decrement the load delay counts. We
392 // determine if the document is alive via the ActiveDOMObject 392 // determine if the document is alive via the ActiveDOMObject
393 // which is a context lifecycle observer. If the Document has been 393 // which is a context lifecycle observer. If the Document has been
394 // destructed ActiveDOMObject::executionContext() returns 0. 394 // destructed ActiveDOMObject::executionContext() returns 0.
395 if (ActiveDOMObject::executionContext()) 395 if (ActiveDOMObject::executionContext())
396 setShouldDelayLoadEvent(false); 396 setShouldDelayLoadEvent(false);
acolwell GONE FROM CHROMIUM 2014/09/11 16:33:40 You might be able to remove this and the one below
397 #else 397 #else
398 // HTMLMediaElement and m_asyncEventQueue always become unreachable 398 // HTMLMediaElement and m_asyncEventQueue always become unreachable
399 // together. So HTMLMediaElemenet and m_asyncEventQueue are destructed in 399 // together. So HTMLMediaElemenet and m_asyncEventQueue are destructed in
400 // the same GC. We don't need to close it explicitly in Oilpan. 400 // the same GC. We don't need to close it explicitly in Oilpan.
401 m_asyncEventQueue->close(); 401 m_asyncEventQueue->close();
402 402
403 setShouldDelayLoadEvent(false); 403 setShouldDelayLoadEvent(false);
404 404
405 if (m_textTracks) 405 if (m_textTracks)
406 m_textTracks->clearOwner(); 406 m_textTracks->clearOwner();
(...skipping 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after
3461 renderer()->updateFromElement(); 3461 renderer()->updateFromElement();
3462 3462
3463 stopPeriodicTimers(); 3463 stopPeriodicTimers();
3464 cancelPendingEventsAndCallbacks(); 3464 cancelPendingEventsAndCallbacks();
3465 3465
3466 m_asyncEventQueue->close(); 3466 m_asyncEventQueue->close();
3467 } 3467 }
3468 3468
3469 bool HTMLMediaElement::hasPendingActivity() const 3469 bool HTMLMediaElement::hasPendingActivity() const
3470 { 3470 {
3471 return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents(); 3471 if (m_shouldDelayLoadEvent)
3472 return true;
3473
3474 if (m_networkState == NETWORK_LOADING)
3475 return true;
3476
3477 if (potentiallyPlaying())
Ken Russell (switch to Gerrit) 2014/09/11 18:20:56 Consider the case where a video is set to loop and
acolwell GONE FROM CHROMIUM 2014/09/11 19:02:24 I believe it we add an m_readyStateMaximum = HAVE_
philipj_slow 2014/09/12 14:05:20 I'll add "if (!document().isActive()) return false
3478 return true;
3479
3480 if (m_seeking)
3481 return true;
3482
3483 if (m_asyncEventQueue->hasPendingEvents())
3484 return true;
3485
3486 return false;
3472 } 3487 }
3473 3488
3474 void HTMLMediaElement::contextDestroyed() 3489 void HTMLMediaElement::contextDestroyed()
3475 { 3490 {
3476 // With Oilpan the ExecutionContext is weakly referenced from the media 3491 // With Oilpan the ExecutionContext is weakly referenced from the media
3477 // controller and so it will clear itself on destruction. 3492 // controller and so it will clear itself on destruction.
3478 #if !ENABLE(OILPAN) 3493 #if !ENABLE(OILPAN)
3479 if (m_mediaController) 3494 if (m_mediaController)
3480 m_mediaController->clearExecutionContext(); 3495 m_mediaController->clearExecutionContext();
3481 #endif 3496 #endif
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
3983 3998
3984 #if ENABLE(WEB_AUDIO) 3999 #if ENABLE(WEB_AUDIO)
3985 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 4000 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3986 { 4001 {
3987 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 4002 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
3988 audioSourceProvider()->setClient(0); 4003 audioSourceProvider()->setClient(0);
3989 } 4004 }
3990 #endif 4005 #endif
3991 4006
3992 } 4007 }
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