OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 bool HTMLMediaElement::mediaTracksEnabledInternally() { | 356 bool HTMLMediaElement::mediaTracksEnabledInternally() { |
357 return RuntimeEnabledFeatures::audioVideoTracksEnabled() || | 357 return RuntimeEnabledFeatures::audioVideoTracksEnabled() || |
358 RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled(); | 358 RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled(); |
359 } | 359 } |
360 | 360 |
361 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, | 361 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, |
362 Document& document) | 362 Document& document) |
363 : HTMLElement(tagName, document), | 363 : HTMLElement(tagName, document), |
364 SuspendableObject(&document), | 364 SuspendableObject(&document), |
365 m_loadTimer(this, &HTMLMediaElement::loadTimerFired), | 365 m_loadTimer(TaskRunnerHelper::get(TaskType::Unthrottled, &document), |
366 m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired), | 366 this, |
367 m_playbackProgressTimer(this, | 367 &HTMLMediaElement::loadTimerFired), |
368 &HTMLMediaElement::playbackProgressTimerFired), | 368 m_progressEventTimer( |
369 m_audioTracksTimer(this, &HTMLMediaElement::audioTracksTimerFired), | 369 TaskRunnerHelper::get(TaskType::Unthrottled, &document), |
| 370 this, |
| 371 &HTMLMediaElement::progressEventTimerFired), |
| 372 m_playbackProgressTimer( |
| 373 TaskRunnerHelper::get(TaskType::Unthrottled, &document), |
| 374 this, |
| 375 &HTMLMediaElement::playbackProgressTimerFired), |
| 376 m_audioTracksTimer( |
| 377 TaskRunnerHelper::get(TaskType::Unthrottled, &document), |
| 378 this, |
| 379 &HTMLMediaElement::audioTracksTimerFired), |
370 m_viewportFillDebouncerTimer( | 380 m_viewportFillDebouncerTimer( |
| 381 TaskRunnerHelper::get(TaskType::Unthrottled, &document), |
371 this, | 382 this, |
372 &HTMLMediaElement::viewportFillDebouncerTimerFired), | 383 &HTMLMediaElement::viewportFillDebouncerTimerFired), |
373 m_checkViewportIntersectionTimer( | 384 m_checkViewportIntersectionTimer( |
| 385 TaskRunnerHelper::get(TaskType::Unthrottled, &document), |
374 this, | 386 this, |
375 &HTMLMediaElement::checkViewportIntersectionTimerFired), | 387 &HTMLMediaElement::checkViewportIntersectionTimerFired), |
376 m_playedTimeRanges(), | 388 m_playedTimeRanges(), |
377 m_asyncEventQueue(GenericEventQueue::create(this)), | 389 m_asyncEventQueue(GenericEventQueue::create(this)), |
378 m_playbackRate(1.0f), | 390 m_playbackRate(1.0f), |
379 m_defaultPlaybackRate(1.0f), | 391 m_defaultPlaybackRate(1.0f), |
380 m_networkState(kNetworkEmpty), | 392 m_networkState(kNetworkEmpty), |
381 m_readyState(kHaveNothing), | 393 m_readyState(kHaveNothing), |
382 m_readyStateMaximum(kHaveNothing), | 394 m_readyStateMaximum(kHaveNothing), |
383 m_volume(1.0f), | 395 m_volume(1.0f), |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 // FrameLoader::checkCompleted(). But it's guaranteed that the load event | 471 // FrameLoader::checkCompleted(). But it's guaranteed that the load event |
460 // doesn't get dispatched during the object destruction. | 472 // doesn't get dispatched during the object destruction. |
461 // See Document::isDelayingLoadEvent(). | 473 // See Document::isDelayingLoadEvent(). |
462 // Also see http://crbug.com/275223 for more details. | 474 // Also see http://crbug.com/275223 for more details. |
463 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 475 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
464 } | 476 } |
465 | 477 |
466 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) { | 478 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) { |
467 BLINK_MEDIA_LOG << "didMoveToNewDocument(" << (void*)this << ")"; | 479 BLINK_MEDIA_LOG << "didMoveToNewDocument(" << (void*)this << ")"; |
468 | 480 |
| 481 m_loadTimer.moveToNewTaskRunner( |
| 482 TaskRunnerHelper::get(TaskType::Unthrottled, &document())); |
| 483 m_progressEventTimer.moveToNewTaskRunner( |
| 484 TaskRunnerHelper::get(TaskType::Unthrottled, &document())); |
| 485 m_playbackProgressTimer.moveToNewTaskRunner( |
| 486 TaskRunnerHelper::get(TaskType::Unthrottled, &document())); |
| 487 m_audioTracksTimer.moveToNewTaskRunner( |
| 488 TaskRunnerHelper::get(TaskType::Unthrottled, &document())); |
| 489 m_viewportFillDebouncerTimer.moveToNewTaskRunner( |
| 490 TaskRunnerHelper::get(TaskType::Unthrottled, &document())); |
| 491 m_checkViewportIntersectionTimer.moveToNewTaskRunner( |
| 492 TaskRunnerHelper::get(TaskType::Unthrottled, &document())); |
| 493 |
469 m_autoplayUmaHelper->didMoveToNewDocument(oldDocument); | 494 m_autoplayUmaHelper->didMoveToNewDocument(oldDocument); |
470 // If any experiment is enabled, then we want to enable a user gesture by | 495 // If any experiment is enabled, then we want to enable a user gesture by |
471 // default, otherwise the experiment does nothing. | 496 // default, otherwise the experiment does nothing. |
472 bool oldDocumentRequiresUserGesture = | 497 bool oldDocumentRequiresUserGesture = |
473 computeLockedPendingUserGesture(oldDocument); | 498 computeLockedPendingUserGesture(oldDocument); |
474 bool newDocumentRequiresUserGesture = | 499 bool newDocumentRequiresUserGesture = |
475 computeLockedPendingUserGesture(document()); | 500 computeLockedPendingUserGesture(document()); |
476 if (newDocumentRequiresUserGesture && !oldDocumentRequiresUserGesture) | 501 if (newDocumentRequiresUserGesture && !oldDocumentRequiresUserGesture) |
477 m_lockedPendingUserGesture = true; | 502 m_lockedPendingUserGesture = true; |
478 | 503 |
(...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4106 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4131 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
4107 } | 4132 } |
4108 | 4133 |
4109 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4134 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
4110 m_mostlyFillingViewport = true; | 4135 m_mostlyFillingViewport = true; |
4111 if (m_webMediaPlayer) | 4136 if (m_webMediaPlayer) |
4112 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4137 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
4113 } | 4138 } |
4114 | 4139 |
4115 } // namespace blink | 4140 } // namespace blink |
OLD | NEW |