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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 m_userGestureRequiredForPlay = true; | 374 m_userGestureRequiredForPlay = true; |
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 ASSERT(!m_shouldDelayLoadEvent); |
385 // If the HTMLMediaElement dies with the document we are not | 385 |
386 // allowed to touch the document to adjust delay load event counts | 386 #if !ENABLE(OILPAN) |
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 | |
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); | |
404 | |
405 if (m_textTracks) | 392 if (m_textTracks) |
406 m_textTracks->clearOwner(); | 393 m_textTracks->clearOwner(); |
407 m_audioTracks->shutdown(); | 394 m_audioTracks->shutdown(); |
408 m_videoTracks->shutdown(); | 395 m_videoTracks->shutdown(); |
409 | 396 |
410 if (m_mediaController) { | 397 if (m_mediaController) { |
411 m_mediaController->removeMediaElement(this); | 398 m_mediaController->removeMediaElement(this); |
412 m_mediaController = nullptr; | 399 m_mediaController = nullptr; |
413 } | 400 } |
414 #endif | 401 #endif |
(...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3459 | 3446 |
3460 if (renderer()) | 3447 if (renderer()) |
3461 renderer()->updateFromElement(); | 3448 renderer()->updateFromElement(); |
3462 | 3449 |
3463 stopPeriodicTimers(); | 3450 stopPeriodicTimers(); |
3464 cancelPendingEventsAndCallbacks(); | 3451 cancelPendingEventsAndCallbacks(); |
3465 | 3452 |
3466 m_asyncEventQueue->close(); | 3453 m_asyncEventQueue->close(); |
3467 } | 3454 } |
3468 | 3455 |
3469 bool HTMLMediaElement::hasPendingActivity() const | 3456 bool HTMLMediaElement::hasPendingActivity() const |
scherkus (not reviewing)
2014/09/12 19:05:00
nice!
| |
3470 { | 3457 { |
3471 return (hasAudio() && isPlaying()) || m_asyncEventQueue->hasPendingEvents(); | 3458 if (!document().isActive()) |
3459 return false; | |
3460 | |
3461 if (m_shouldDelayLoadEvent) | |
3462 return true; | |
3463 | |
3464 if (m_networkState == NETWORK_LOADING) | |
3465 return true; | |
3466 | |
3467 if (potentiallyPlaying()) | |
3468 return true; | |
3469 | |
3470 if (m_seeking) | |
3471 return true; | |
3472 | |
3473 if (m_asyncEventQueue->hasPendingEvents()) | |
3474 return true; | |
3475 | |
3476 if (m_mediaSource) | |
3477 return true; | |
3478 | |
3479 return false; | |
3472 } | 3480 } |
3473 | 3481 |
3474 void HTMLMediaElement::contextDestroyed() | 3482 void HTMLMediaElement::contextDestroyed() |
3475 { | 3483 { |
3476 // With Oilpan the ExecutionContext is weakly referenced from the media | 3484 // With Oilpan the ExecutionContext is weakly referenced from the media |
3477 // controller and so it will clear itself on destruction. | 3485 // controller and so it will clear itself on destruction. |
3478 #if !ENABLE(OILPAN) | 3486 #if !ENABLE(OILPAN) |
3479 if (m_mediaController) | 3487 if (m_mediaController) |
3480 m_mediaController->clearExecutionContext(); | 3488 m_mediaController->clearExecutionContext(); |
3481 #endif | 3489 #endif |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3983 | 3991 |
3984 #if ENABLE(WEB_AUDIO) | 3992 #if ENABLE(WEB_AUDIO) |
3985 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 3993 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
3986 { | 3994 { |
3987 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 3995 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
3988 audioSourceProvider()->setClient(0); | 3996 audioSourceProvider()->setClient(0); |
3989 } | 3997 } |
3990 #endif | 3998 #endif |
3991 | 3999 |
3992 } | 4000 } |
OLD | NEW |