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

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

Issue 2480523003: Remove EventSender from HTMLSourceElement (Closed)
Patch Set: Created 4 years, 1 month 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 | « third_party/WebKit/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: third_party/WebKit/Source/core/html/HTMLSourceElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLSourceElement.cpp b/third_party/WebKit/Source/core/html/HTMLSourceElement.cpp
index 736a2af7ec40d11101c41de3f22ff87cb8287e1d..ef1628994099f582c704dcb0c1123ae827bedae4 100644
--- a/third_party/WebKit/Source/core/html/HTMLSourceElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSourceElement.cpp
@@ -30,8 +30,8 @@
#include "core/css/MediaQueryList.h"
#include "core/css/MediaQueryMatcher.h"
#include "core/dom/Document.h"
+#include "core/dom/TaskRunnerHelper.h"
#include "core/events/Event.h"
-#include "core/events/EventSender.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/HTMLPictureElement.h"
@@ -41,12 +41,6 @@ namespace blink {
using namespace HTMLNames;
-static SourceEventSender& sourceErrorEventSender() {
- DEFINE_STATIC_LOCAL(SourceEventSender, sharedErrorEventSender,
- (SourceEventSender::create(EventTypeNames::error)));
- return sharedErrorEventSender;
-}
-
class HTMLSourceElement::Listener final : public MediaQueryListListener {
public:
explicit Listener(HTMLSourceElement* element) : m_element(element) {}
@@ -140,16 +134,21 @@ void HTMLSourceElement::setType(const AtomicString& type) {
void HTMLSourceElement::scheduleErrorEvent() {
DVLOG(SOURCE_LOG_LEVEL) << "scheduleErrorEvent - " << (void*)this;
- sourceErrorEventSender().dispatchEventSoon(this);
+
+ m_pendingErrorEvent =
+ TaskRunnerHelper::get(TaskType::DOMManipulation, &document())
+ ->postCancellableTask(
+ BLINK_FROM_HERE,
+ WTF::bind(&HTMLSourceElement::dispatchPendingEvent,
+ wrapPersistent(this)));
}
void HTMLSourceElement::cancelPendingErrorEvent() {
DVLOG(SOURCE_LOG_LEVEL) << "cancelPendingErrorEvent - " << (void*)this;
- sourceErrorEventSender().cancelEvent(this);
+ m_pendingErrorEvent.cancel();
}
-void HTMLSourceElement::dispatchPendingEvent(SourceEventSender* eventSender) {
- DCHECK_EQ(eventSender, &sourceErrorEventSender());
+void HTMLSourceElement::dispatchPendingEvent() {
DVLOG(SOURCE_LOG_LEVEL) << "dispatchPendingEvent - " << (void*)this;
dispatchEvent(Event::createCancelable(EventTypeNames::error));
}
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSourceElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698