Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1212)

Unified Diff: Source/core/html/HTMLSourceElement.cpp

Issue 258503007: Use EventSender class in HTMLSourceElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLSourceElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « Source/core/html/HTMLSourceElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698