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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 | 375 |
376 setHasCustomStyleCallbacks(); | 376 setHasCustomStyleCallbacks(); |
377 addElementToDocumentMap(this, &document); | 377 addElementToDocumentMap(this, &document); |
378 } | 378 } |
379 | 379 |
380 HTMLMediaElement::~HTMLMediaElement() | 380 HTMLMediaElement::~HTMLMediaElement() |
381 { | 381 { |
382 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); | 382 WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); |
383 | 383 |
384 #if ENABLE(OILPAN) | 384 #if ENABLE(OILPAN) |
385 // If the HTMLMediaElement dies with the document we are not | 385 ASSERT(!m_shouldDelayLoadEvent); |
Mads Ager (chromium)
2014/09/15 07:01:18
From an Oilpan perspective it is really nice to ge
philipj_slow
2014/09/15 13:07:44
No, loading can start without a wrapper, all you n
| |
386 // allowed to touch the document to adjust delay load event counts | |
387 // because the document could have been already | |
388 // destructed. However, if the HTMLMediaElement dies with the | |
389 // document there is no need to change the delayed load counts | |
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 | |
392 // determine if the document is alive via the ActiveDOMObject | |
393 // which is a context lifecycle observer. If the Document has been | |
394 // destructed ActiveDOMObject::executionContext() returns 0. | |
395 if (ActiveDOMObject::executionContext()) | |
396 setShouldDelayLoadEvent(false); | |
397 #else | 386 #else |
398 // HTMLMediaElement and m_asyncEventQueue always become unreachable | 387 // HTMLMediaElement and m_asyncEventQueue always become unreachable |
399 // together. So HTMLMediaElemenet and m_asyncEventQueue are destructed in | 388 // together. So HTMLMediaElemenet and m_asyncEventQueue are destructed in |
400 // the same GC. We don't need to close it explicitly in Oilpan. | 389 // the same GC. We don't need to close it explicitly in Oilpan. |
401 m_asyncEventQueue->close(); | 390 m_asyncEventQueue->close(); |
402 | 391 |
403 setShouldDelayLoadEvent(false); | 392 setShouldDelayLoadEvent(false); |
Mads Ager (chromium)
2014/09/15 07:01:18
This should be ASSERT(!m_shouldDelayLoadEvent) as
philipj_slow
2014/09/15 13:07:44
That was the previous CL, and the assert failed as
| |
404 | 393 |
405 if (m_textTracks) | 394 if (m_textTracks) |
406 m_textTracks->clearOwner(); | 395 m_textTracks->clearOwner(); |
407 m_audioTracks->shutdown(); | 396 m_audioTracks->shutdown(); |
408 m_videoTracks->shutdown(); | 397 m_videoTracks->shutdown(); |
409 | 398 |
410 if (m_mediaController) { | 399 if (m_mediaController) { |
411 m_mediaController->removeMediaElement(this); | 400 m_mediaController->removeMediaElement(this); |
412 m_mediaController = nullptr; | 401 m_mediaController = nullptr; |
413 } | 402 } |
(...skipping 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3461 renderer()->updateFromElement(); | 3450 renderer()->updateFromElement(); |
3462 | 3451 |
3463 stopPeriodicTimers(); | 3452 stopPeriodicTimers(); |
3464 cancelPendingEventsAndCallbacks(); | 3453 cancelPendingEventsAndCallbacks(); |
3465 | 3454 |
3466 m_asyncEventQueue->close(); | 3455 m_asyncEventQueue->close(); |
3467 } | 3456 } |
3468 | 3457 |
3469 bool HTMLMediaElement::hasPendingActivity() const | 3458 bool HTMLMediaElement::hasPendingActivity() const |
3470 { | 3459 { |
3471 return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents(); | 3460 if (!document().isActive()) |
3461 return false; | |
3462 | |
3463 if (m_shouldDelayLoadEvent) | |
3464 return true; | |
3465 | |
3466 if (m_networkState == NETWORK_LOADING) | |
3467 return true; | |
3468 | |
3469 if (potentiallyPlaying()) | |
3470 return true; | |
3471 | |
3472 if (m_seeking) | |
3473 return true; | |
3474 | |
3475 if (m_asyncEventQueue->hasPendingEvents()) | |
3476 return true; | |
3477 | |
3478 if (m_mediaSource) | |
3479 return true; | |
3480 | |
3481 return false; | |
3472 } | 3482 } |
3473 | 3483 |
3474 void HTMLMediaElement::contextDestroyed() | 3484 void HTMLMediaElement::contextDestroyed() |
3475 { | 3485 { |
3476 // With Oilpan the ExecutionContext is weakly referenced from the media | 3486 // With Oilpan the ExecutionContext is weakly referenced from the media |
3477 // controller and so it will clear itself on destruction. | 3487 // controller and so it will clear itself on destruction. |
3478 #if !ENABLE(OILPAN) | 3488 #if !ENABLE(OILPAN) |
3479 if (m_mediaController) | 3489 if (m_mediaController) |
3480 m_mediaController->clearExecutionContext(); | 3490 m_mediaController->clearExecutionContext(); |
3481 #endif | 3491 #endif |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3983 | 3993 |
3984 #if ENABLE(WEB_AUDIO) | 3994 #if ENABLE(WEB_AUDIO) |
3985 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3995 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3986 { | 3996 { |
3987 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 3997 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
3988 audioSourceProvider()->setClient(0); | 3998 audioSourceProvider()->setClient(0); |
3989 } | 3999 } |
3990 #endif | 4000 #endif |
3991 | 4001 |
3992 } | 4002 } |
OLD | NEW |