| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. |
| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 map.add(document, set); | 170 map.add(document, set); |
| 171 } | 171 } |
| 172 | 172 |
| 173 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
ent, bool createdByParser) | 173 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
ent, bool createdByParser) |
| 174 : HTMLElement(tagName, document) | 174 : HTMLElement(tagName, document) |
| 175 , ActiveDOMObject(document, this) | 175 , ActiveDOMObject(document, this) |
| 176 , m_loadTimer(this, &HTMLMediaElement::loadTimerFired) | 176 , m_loadTimer(this, &HTMLMediaElement::loadTimerFired) |
| 177 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) | 177 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) |
| 178 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFire
d) | 178 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFire
d) |
| 179 , m_playedTimeRanges() | 179 , m_playedTimeRanges() |
| 180 , m_asyncEventQueue(GenericEventQueue::create(this)) |
| 180 , m_playbackRate(1.0f) | 181 , m_playbackRate(1.0f) |
| 181 , m_defaultPlaybackRate(1.0f) | 182 , m_defaultPlaybackRate(1.0f) |
| 182 , m_webkitPreservesPitch(true) | 183 , m_webkitPreservesPitch(true) |
| 183 , m_networkState(NETWORK_EMPTY) | 184 , m_networkState(NETWORK_EMPTY) |
| 184 , m_readyState(HAVE_NOTHING) | 185 , m_readyState(HAVE_NOTHING) |
| 185 , m_readyStateMaximum(HAVE_NOTHING) | 186 , m_readyStateMaximum(HAVE_NOTHING) |
| 186 , m_volume(1.0f) | 187 , m_volume(1.0f) |
| 187 , m_lastSeekTime(0) | 188 , m_lastSeekTime(0) |
| 188 , m_previousProgress(0) | 189 , m_previousProgress(0) |
| 189 , m_previousProgressTime(numeric_limits<double>::max()) | 190 , m_previousProgressTime(numeric_limits<double>::max()) |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 } | 535 } |
| 535 | 536 |
| 536 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) | 537 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
| 537 { | 538 { |
| 538 #if LOG_MEDIA_EVENTS | 539 #if LOG_MEDIA_EVENTS |
| 539 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st
ring().ascii().data()); | 540 LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.st
ring().ascii().data()); |
| 540 #endif | 541 #endif |
| 541 RefPtr<Event> event = Event::create(eventName, false, true); | 542 RefPtr<Event> event = Event::create(eventName, false, true); |
| 542 event->setTarget(this); | 543 event->setTarget(this); |
| 543 | 544 |
| 544 m_asyncEventQueue.enqueueEvent(event.release()); | 545 m_asyncEventQueue->enqueueEvent(event.release()); |
| 545 } | 546 } |
| 546 | 547 |
| 547 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) | 548 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) |
| 548 { | 549 { |
| 549 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef
oreload', which can make arbitrary DOM mutations. | 550 RefPtr<HTMLMediaElement> protect(this); // loadNextSourceChild may fire 'bef
oreload', which can make arbitrary DOM mutations. |
| 550 | 551 |
| 551 if (m_pendingLoadFlags & MediaResource) { | 552 if (m_pendingLoadFlags & MediaResource) { |
| 552 if (m_loadState == LoadingFromSourceElement) | 553 if (m_loadState == LoadingFromSourceElement) |
| 553 loadNextSourceChild(); | 554 loadNextSourceChild(); |
| 554 else | 555 else |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 // 5 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. | 1173 // 5 - Set the element's delaying-the-load-event flag to false. This stops d
elaying the load event. |
| 1173 setShouldDelayLoadEvent(false); | 1174 setShouldDelayLoadEvent(false); |
| 1174 | 1175 |
| 1175 // 6 - Abort the overall resource selection algorithm. | 1176 // 6 - Abort the overall resource selection algorithm. |
| 1176 m_currentSourceNode = 0; | 1177 m_currentSourceNode = 0; |
| 1177 } | 1178 } |
| 1178 | 1179 |
| 1179 void HTMLMediaElement::cancelPendingEventsAndCallbacks() | 1180 void HTMLMediaElement::cancelPendingEventsAndCallbacks() |
| 1180 { | 1181 { |
| 1181 LOG(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks"); | 1182 LOG(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks"); |
| 1182 m_asyncEventQueue.cancelAllEvents(); | 1183 m_asyncEventQueue->cancelAllEvents(); |
| 1183 | 1184 |
| 1184 for (Node* node = firstChild(); node; node = node->nextSibling()) { | 1185 for (Node* node = firstChild(); node; node = node->nextSibling()) { |
| 1185 if (node->hasTagName(sourceTag)) | 1186 if (node->hasTagName(sourceTag)) |
| 1186 static_cast<HTMLSourceElement*>(node)->cancelPendingErrorEvent(); | 1187 static_cast<HTMLSourceElement*>(node)->cancelPendingErrorEvent(); |
| 1187 } | 1188 } |
| 1188 } | 1189 } |
| 1189 | 1190 |
| 1190 Document* HTMLMediaElement::mediaPlayerOwningDocument() | 1191 Document* HTMLMediaElement::mediaPlayerOwningDocument() |
| 1191 { | 1192 { |
| 1192 Document* d = document(); | 1193 Document* d = document(); |
| (...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3171 ExceptionCode ec; | 3172 ExceptionCode ec; |
| 3172 load(ec); | 3173 load(ec); |
| 3173 } | 3174 } |
| 3174 | 3175 |
| 3175 if (renderer()) | 3176 if (renderer()) |
| 3176 renderer()->updateFromElement(); | 3177 renderer()->updateFromElement(); |
| 3177 } | 3178 } |
| 3178 | 3179 |
| 3179 bool HTMLMediaElement::hasPendingActivity() const | 3180 bool HTMLMediaElement::hasPendingActivity() const |
| 3180 { | 3181 { |
| 3181 return m_asyncEventQueue.hasPendingEvents(); | 3182 return m_asyncEventQueue->hasPendingEvents(); |
| 3182 } | 3183 } |
| 3183 | 3184 |
| 3184 void HTMLMediaElement::mediaVolumeDidChange() | 3185 void HTMLMediaElement::mediaVolumeDidChange() |
| 3185 { | 3186 { |
| 3186 LOG(Media, "HTMLMediaElement::mediaVolumeDidChange"); | 3187 LOG(Media, "HTMLMediaElement::mediaVolumeDidChange"); |
| 3187 updateVolume(); | 3188 updateVolume(); |
| 3188 } | 3189 } |
| 3189 | 3190 |
| 3190 void HTMLMediaElement::defaultEventHandler(Event* event) | 3191 void HTMLMediaElement::defaultEventHandler(Event* event) |
| 3191 { | 3192 { |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3785 | 3786 |
| 3786 bool HTMLMediaElement::shouldDisableSleep() const | 3787 bool HTMLMediaElement::shouldDisableSleep() const |
| 3787 { | 3788 { |
| 3788 return m_player && !m_player->paused() && hasVideo() && hasAudio() && !loop(
); | 3789 return m_player && !m_player->paused() && hasVideo() && hasAudio() && !loop(
); |
| 3789 } | 3790 } |
| 3790 #endif | 3791 #endif |
| 3791 | 3792 |
| 3792 } | 3793 } |
| 3793 | 3794 |
| 3794 #endif | 3795 #endif |
| OLD | NEW |