Index: Source/core/html/HTMLSourceElement.cpp |
diff --git a/Source/core/html/HTMLSourceElement.cpp b/Source/core/html/HTMLSourceElement.cpp |
index 2023a075bcdd35da2ec7e5fb02e160478b54ae35..4e26a11a7ee6e7ff2cf8e2c41dc2b3225af3ced2 100644 |
--- a/Source/core/html/HTMLSourceElement.cpp |
+++ b/Source/core/html/HTMLSourceElement.cpp |
@@ -27,7 +27,7 @@ |
#include "core/html/HTMLSourceElement.h" |
#include "HTMLNames.h" |
-#include "core/events/Event.h" |
+#include "core/events/EventSender.h" |
#include "core/html/HTMLMediaElement.h" |
#include "platform/Logging.h" |
@@ -37,9 +37,14 @@ namespace WebCore { |
using namespace HTMLNames; |
+static SourceEventSender& sourceErrorEventSender() |
+{ |
+ DEFINE_STATIC_LOCAL(SourceEventSender, sharedErrorEventSender, (EventTypeNames::error)); |
+ return sharedErrorEventSender; |
+} |
+ |
inline HTMLSourceElement::HTMLSourceElement(Document& document) |
: HTMLElement(sourceTag, document) |
- , m_errorEventTimer(this, &HTMLSourceElement::errorEventTimerFired) |
{ |
WTF_LOG(Media, "HTMLSourceElement::HTMLSourceElement - %p", this); |
ScriptWrappable::init(this); |
@@ -50,6 +55,11 @@ PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(Document& document) |
return adoptRef(new HTMLSourceElement(document)); |
} |
+HTMLSourceElement::~HTMLSourceElement() |
+{ |
+ sourceErrorEventSender().cancelEvent(this); |
+} |
+ |
Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode* insertionPoint) |
{ |
HTMLElement::insertedInto(insertionPoint); |
@@ -87,21 +97,19 @@ void HTMLSourceElement::setType(const AtomicString& type) |
void HTMLSourceElement::scheduleErrorEvent() |
{ |
WTF_LOG(Media, "HTMLSourceElement::scheduleErrorEvent - %p", this); |
- if (m_errorEventTimer.isActive()) |
- return; |
- |
- m_errorEventTimer.startOneShot(0, FROM_HERE); |
+ sourceErrorEventSender().dispatchEventSoon(this); |
} |
void HTMLSourceElement::cancelPendingErrorEvent() |
{ |
WTF_LOG(Media, "HTMLSourceElement::cancelPendingErrorEvent - %p", this); |
- m_errorEventTimer.stop(); |
+ sourceErrorEventSender().cancelEvent(this); |
} |
-void HTMLSourceElement::errorEventTimerFired(Timer<HTMLSourceElement>*) |
+void HTMLSourceElement::dispatchPendingEvent(SourceEventSender* eventSender) |
{ |
- WTF_LOG(Media, "HTMLSourceElement::errorEventTimerFired - %p", this); |
+ ASSERT_UNUSED(eventSender, eventSender == &sourceErrorEventSender()); |
+ WTF_LOG(Media, "HTMLSourceElement::dispatchPendingEvent - %p", this); |
esprehn
2014/04/24 20:49:56
All these logs seem kind of silly.
|
dispatchEvent(Event::createCancelable(EventTypeNames::error)); |
} |