OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) | 105 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) |
106 , m_proxyWidget(0) | 106 , m_proxyWidget(0) |
107 #endif | 107 #endif |
108 , m_restrictions(NoRestrictions) | 108 , m_restrictions(NoRestrictions) |
109 , m_preload(MediaPlayer::Auto) | 109 , m_preload(MediaPlayer::Auto) |
110 , m_displayMode(Unknown) | 110 , m_displayMode(Unknown) |
111 , m_processingMediaPlayerCallback(0) | 111 , m_processingMediaPlayerCallback(0) |
112 , m_playing(false) | 112 , m_playing(false) |
113 , m_isWaitingUntilMediaCanStart(false) | 113 , m_isWaitingUntilMediaCanStart(false) |
114 , m_shouldDelayLoadEvent(false) | 114 , m_shouldDelayLoadEvent(false) |
115 , m_isWaitingToDecrementLoadEventDelayCount(false) | |
116 , m_haveFiredLoadedData(false) | 115 , m_haveFiredLoadedData(false) |
117 , m_inActiveDocument(true) | 116 , m_inActiveDocument(true) |
118 , m_autoplaying(true) | 117 , m_autoplaying(true) |
119 , m_muted(false) | 118 , m_muted(false) |
120 , m_paused(true) | 119 , m_paused(true) |
121 , m_seeking(false) | 120 , m_seeking(false) |
122 , m_sentStalledEvent(false) | 121 , m_sentStalledEvent(false) |
123 , m_sentEndEvent(false) | 122 , m_sentEndEvent(false) |
124 , m_pausedInternal(false) | 123 , m_pausedInternal(false) |
125 , m_sendProgressEvents(true) | 124 , m_sendProgressEvents(true) |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 364 |
366 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) | 365 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
367 { | 366 { |
368 m_pendingEvents.append(Event::create(eventName, false, true)); | 367 m_pendingEvents.append(Event::create(eventName, false, true)); |
369 if (!m_asyncEventTimer.isActive()) | 368 if (!m_asyncEventTimer.isActive()) |
370 m_asyncEventTimer.startOneShot(0); | 369 m_asyncEventTimer.startOneShot(0); |
371 } | 370 } |
372 | 371 |
373 void HTMLMediaElement::asyncEventTimerFired(Timer<HTMLMediaElement>*) | 372 void HTMLMediaElement::asyncEventTimerFired(Timer<HTMLMediaElement>*) |
374 { | 373 { |
375 // If we are waiting to release our delay on the load event, do that first a
nd post | |
376 // the pending events on the next go around. | |
377 if (m_isWaitingToDecrementLoadEventDelayCount) { | |
378 setShouldDelayLoadEvent(false); | |
379 if (!m_asyncEventTimer.isActive()) | |
380 m_asyncEventTimer.startOneShot(0); | |
381 return; | |
382 } | |
383 | |
384 Vector<RefPtr<Event> > pendingEvents; | 374 Vector<RefPtr<Event> > pendingEvents; |
385 ExceptionCode ec = 0; | 375 ExceptionCode ec = 0; |
386 | 376 |
387 m_pendingEvents.swap(pendingEvents); | 377 m_pendingEvents.swap(pendingEvents); |
388 unsigned count = pendingEvents.size(); | 378 unsigned count = pendingEvents.size(); |
389 for (unsigned ndx = 0; ndx < count; ++ndx) { | 379 for (unsigned ndx = 0; ndx < count; ++ndx) { |
390 if (pendingEvents[ndx]->type() == eventNames().canplayEvent) { | 380 if (pendingEvents[ndx]->type() == eventNames().canplayEvent) { |
391 m_dispatchingCanPlayEvent = true; | 381 m_dispatchingCanPlayEvent = true; |
392 dispatchEvent(pendingEvents[ndx].release(), ec); | 382 dispatchEvent(pendingEvents[ndx].release(), ec); |
393 m_dispatchingCanPlayEvent = false; | 383 m_dispatchingCanPlayEvent = false; |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 bool HTMLMediaElement::isURLAttribute(Attribute* attribute) const | 2095 bool HTMLMediaElement::isURLAttribute(Attribute* attribute) const |
2106 { | 2096 { |
2107 return attribute->name() == srcAttr; | 2097 return attribute->name() == srcAttr; |
2108 } | 2098 } |
2109 | 2099 |
2110 void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay) | 2100 void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay) |
2111 { | 2101 { |
2112 if (m_shouldDelayLoadEvent == shouldDelay) | 2102 if (m_shouldDelayLoadEvent == shouldDelay) |
2113 return; | 2103 return; |
2114 | 2104 |
2115 // Don't decrement the load event delay if we are in the middle of a callbac
k from | |
2116 // the media engine. The load event is sent synchronously and may trigger a
script that | |
2117 // causes the document to be come inactive and that will clear the media eng
ine, causing | |
2118 // the return to be a rough one. | |
2119 if (!shouldDelay && processingMediaPlayerCallback()) { | |
2120 m_isWaitingToDecrementLoadEventDelayCount = true; | |
2121 | |
2122 // Instead of creating yet-another-timer, reuse the async event timer wh
ich is always | |
2123 // used as a one-shot. | |
2124 if (!m_asyncEventTimer.isActive()) | |
2125 m_asyncEventTimer.startOneShot(0); | |
2126 return; | |
2127 } | |
2128 | |
2129 m_shouldDelayLoadEvent = shouldDelay; | 2105 m_shouldDelayLoadEvent = shouldDelay; |
2130 m_isWaitingToDecrementLoadEventDelayCount = false; | |
2131 if (shouldDelay) | 2106 if (shouldDelay) |
2132 document()->incrementLoadEventDelayCount(); | 2107 document()->incrementLoadEventDelayCount(); |
2133 else | 2108 else |
2134 document()->decrementLoadEventDelayCount(); | 2109 document()->decrementLoadEventDelayCount(); |
2135 } | 2110 } |
2136 | 2111 |
2137 } | 2112 } |
2138 | 2113 |
2139 #endif | 2114 #endif |
OLD | NEW |