Title: [174270] trunk/Source/WebCore
Revision
174270
Author
[email protected]
Date
2014-10-03 10:15:51 -0700 (Fri, 03 Oct 2014)

Log Message

EventSender dispatches should be per-Document
https://bugs.webkit.org/show_bug.cgi?id=136051

Reviewed by Andreas Kling.

EventSender uses a Timer to asynchronously dispatch the same event to multiple
elements of the same type on a future run loop. However, we previously dispatched events
to elements from any Document rather than the one that requested the event send.

This patch changes EventSender to be associated with a single Document. EventSenders
for each Document are lazily allocated. Further per-Document or global optimizations
are possible.

This change also lays the groundwork for making EventSender-related DOM events
deterministic during web replay, tracked at <https://webkit.org/b/137090>.

No new tests, covered by fast/text/svg-font-trigger-load-event.html.

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMAllInOne.cpp:
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::implicitClose):
Dispatch pending events for this document only. Rename local variable f to frame.

* dom/Document.h:
(WebCore::Document::sharedEventSenders):
* dom/EventSender.h:
(WebCore::EventSender::EventSender):
(WebCore::EventSender::hasPendingEvents):
(WebCore::EventSender<T>::dispatchEventSoon):
(WebCore::EventSender<T>::cancelEvent):
(WebCore::EventSender<T>::dispatchPendingEvents):
(WebCore::EventSender<T>::EventSender): Deleted. The type argument was not necessary.
* dom/SharedEventSenders.cpp: Added. Lazily creates event senders as they are requested.
(WebCore::SharedEventSenders::linkLoadEventSender):
(WebCore::SharedEventSenders::styleLoadEventSender):
(WebCore::SharedEventSenders::imageBeforeloadEventSender):
(WebCore::SharedEventSenders::imageLoadEventSender):
(WebCore::SharedEventSenders::imageErrorEventSender):
* dom/SharedEventSenders.h: Added.
(WebCore::SharedEventSenders::SharedEventSenders):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::~HTMLLinkElement):
(WebCore::HTMLLinkElement::dispatchPendingEvent):
(WebCore::HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources):
(WebCore::linkLoadEventSender): Deleted.
(WebCore::HTMLLinkElement::dispatchPendingLoadEvents): Deleted.
* html/HTMLLinkElement.h:
* html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::~HTMLStyleElement):
(WebCore::HTMLStyleElement::dispatchPendingEvent):
(WebCore::HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources):
(WebCore::styleLoadEventSender): Deleted.
(WebCore::HTMLStyleElement::dispatchPendingLoadEvents): Deleted.
* html/HTMLStyleElement.h:
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::beforeLoadEventSender):
(WebCore::ImageLoader::loadEventSender):
(WebCore::ImageLoader::errorEventSender):
(WebCore::ImageLoader::dispatchPendingEvent):
(WebCore::beforeLoadEventSender): Deleted.
(WebCore::loadEventSender): Deleted.
(WebCore::errorEventSender): Deleted.
(WebCore::ImageLoader::dispatchPendingBeforeLoadEvents): Deleted.
(WebCore::ImageLoader::dispatchPendingLoadEvents): Deleted.
(WebCore::ImageLoader::dispatchPendingErrorEvents): Deleted.
* loader/ImageLoader.h:
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::append): Remove an early call to the EventSender for image
beforeload events. This was a performance optimization, but is no longer safe since the
document (and thus the event sender) may not be available in a synchronous document write.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (174269 => 174270)


--- trunk/Source/WebCore/CMakeLists.txt	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-10-03 17:15:51 UTC (rev 174270)
@@ -1437,6 +1437,7 @@
     dom/SecurityContext.cpp
     dom/SelectorQuery.cpp
     dom/ShadowRoot.cpp
+    dom/SharedEventSenders.cpp
     dom/SpaceSplitString.cpp
     dom/StaticNodeList.cpp
     dom/StringCallback.cpp

Modified: trunk/Source/WebCore/ChangeLog (174269 => 174270)


--- trunk/Source/WebCore/ChangeLog	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/ChangeLog	2014-10-03 17:15:51 UTC (rev 174270)
@@ -1,3 +1,81 @@
+2014-10-01  Brian J. Burg  <[email protected]>
+
+        EventSender dispatches should be per-Document
+        https://bugs.webkit.org/show_bug.cgi?id=136051
+
+        Reviewed by Andreas Kling.
+
+        EventSender uses a Timer to asynchronously dispatch the same event to multiple
+        elements of the same type on a future run loop. However, we previously dispatched events
+        to elements from any Document rather than the one that requested the event send.
+
+        This patch changes EventSender to be associated with a single Document. EventSenders
+        for each Document are lazily allocated. Further per-Document or global optimizations
+        are possible.
+
+        This change also lays the groundwork for making EventSender-related DOM events
+        deterministic during web replay, tracked at <https://webkit.org/b/137090>.
+
+        No new tests, covered by fast/text/svg-font-trigger-load-event.html.
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/DOMAllInOne.cpp:
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::implicitClose):
+        Dispatch pending events for this document only. Rename local variable f to frame.
+
+        * dom/Document.h:
+        (WebCore::Document::sharedEventSenders):
+        * dom/EventSender.h:
+        (WebCore::EventSender::EventSender):
+        (WebCore::EventSender::hasPendingEvents):
+        (WebCore::EventSender<T>::dispatchEventSoon):
+        (WebCore::EventSender<T>::cancelEvent):
+        (WebCore::EventSender<T>::dispatchPendingEvents):
+        (WebCore::EventSender<T>::EventSender): Deleted. The type argument was not necessary.
+        * dom/SharedEventSenders.cpp: Added. Lazily creates event senders as they are requested.
+        (WebCore::SharedEventSenders::linkLoadEventSender):
+        (WebCore::SharedEventSenders::styleLoadEventSender):
+        (WebCore::SharedEventSenders::imageBeforeloadEventSender):
+        (WebCore::SharedEventSenders::imageLoadEventSender):
+        (WebCore::SharedEventSenders::imageErrorEventSender):
+        * dom/SharedEventSenders.h: Added.
+        (WebCore::SharedEventSenders::SharedEventSenders):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::~HTMLLinkElement):
+        (WebCore::HTMLLinkElement::dispatchPendingEvent):
+        (WebCore::HTMLLinkElement::notifyLoadedSheetAndAllCriticalSubresources):
+        (WebCore::linkLoadEventSender): Deleted.
+        (WebCore::HTMLLinkElement::dispatchPendingLoadEvents): Deleted.
+        * html/HTMLLinkElement.h:
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::~HTMLStyleElement):
+        (WebCore::HTMLStyleElement::dispatchPendingEvent):
+        (WebCore::HTMLStyleElement::notifyLoadedSheetAndAllCriticalSubresources):
+        (WebCore::styleLoadEventSender): Deleted.
+        (WebCore::HTMLStyleElement::dispatchPendingLoadEvents): Deleted.
+        * html/HTMLStyleElement.h:
+        * loader/ImageLoader.cpp:
+        (WebCore::ImageLoader::beforeLoadEventSender):
+        (WebCore::ImageLoader::loadEventSender):
+        (WebCore::ImageLoader::errorEventSender):
+        (WebCore::ImageLoader::dispatchPendingEvent):
+        (WebCore::beforeLoadEventSender): Deleted.
+        (WebCore::loadEventSender): Deleted.
+        (WebCore::errorEventSender): Deleted.
+        (WebCore::ImageLoader::dispatchPendingBeforeLoadEvents): Deleted.
+        (WebCore::ImageLoader::dispatchPendingLoadEvents): Deleted.
+        (WebCore::ImageLoader::dispatchPendingErrorEvents): Deleted.
+        * loader/ImageLoader.h:
+        * xml/parser/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::append): Remove an early call to the EventSender for image
+        beforeload events. This was a performance optimization, but is no longer safe since the
+        document (and thus the event sender) may not be available in a synchronous document write.
+
 2014-10-03  Myles C. Maxfield  <[email protected]>
 
         TextRun::length() should return an unsigned

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (174269 => 174270)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-10-03 17:15:51 UTC (rev 174270)
@@ -13778,6 +13778,20 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\dom\SharedEventSenders.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\dom\SpaceSplitString.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -20583,6 +20597,7 @@
     <ClInclude Include="..\dom\SecurityContext.h" />
     <ClInclude Include="..\dom\SelectorQuery.h" />
     <ClInclude Include="..\dom\SimulatedClickOptions.h" />
+    <ClInclude Include="..\dom\SharedEventSenders.h" />
     <ClInclude Include="..\dom\SpaceSplitString.h" />
     <ClInclude Include="..\dom\StaticHashSetNodeList.h" />
     <ClInclude Include="..\dom\StaticNodeList.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (174269 => 174270)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-10-03 17:15:51 UTC (rev 174270)
@@ -3354,6 +3354,9 @@
     <ClCompile Include="..\dom\SelectorQuery.cpp">
       <Filter>dom</Filter>
     </ClCompile>
+    <ClCompile Include="..\dom\SharedEventSenders.cpp">
+      <Filter>dom</Filter>
+    </ClCompile>
     <ClCompile Include="..\dom\SpaceSplitString.cpp">
       <Filter>dom</Filter>
     </ClCompile>
@@ -10452,6 +10455,9 @@
     <ClInclude Include="..\dom\SelectorQuery.h">
       <Filter>dom</Filter>
     </ClInclude>
+    <ClInclude Include="..\dom\SharedEventSenders.h">
+      <Filter>dom</Filter>
+    </ClInclude>
     <ClInclude Include="..\dom\SimulatedClickOptions.h">
       <Filter>dom</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (174269 => 174270)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-10-03 17:15:51 UTC (rev 174270)
@@ -5517,6 +5517,9 @@
 		C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */; };
 		C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		C400D10918F1C8F60090D863 /* EventLoopInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C400D10818F1C8F60090D863 /* EventLoopInput.cpp */; };
+		C49474A119A2847C009B3DE8 /* SharedEventSenders.h in Headers */ = {isa = PBXBuildFile; fileRef = C49474A019A2847C009B3DE8 /* SharedEventSenders.h */; };
+		C49474A819A2D612009B3DE8 /* EventSender.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5CB1B314EDAB6F00BB2795 /* EventSender.h */; };
+		C49474AA19A2E2E5009B3DE8 /* SharedEventSenders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C49474A919A2E2E5009B3DE8 /* SharedEventSenders.cpp */; };
 		C4CD629A18383766007EBAF1 /* FrameSnapshotting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */; };
 		C4CD629B18383766007EBAF1 /* FrameSnapshotting.h in Headers */ = {isa = PBXBuildFile; fileRef = C4CD629918383766007EBAF1 /* FrameSnapshotting.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; };
@@ -12935,6 +12938,8 @@
 		C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserverRegistry.h; sourceTree = "<group>"; };
 		C3E61C653A64807A83E76FB8 /* MathMLMencloseElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLMencloseElement.cpp; sourceTree = "<group>"; };
 		C400D10818F1C8F60090D863 /* EventLoopInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventLoopInput.cpp; sourceTree = "<group>"; };
+		C49474A019A2847C009B3DE8 /* SharedEventSenders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedEventSenders.h; sourceTree = "<group>"; };
+		C49474A919A2E2E5009B3DE8 /* SharedEventSenders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedEventSenders.cpp; sourceTree = "<group>"; };
 		C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameSnapshotting.cpp; sourceTree = "<group>"; };
 		C4CD629918383766007EBAF1 /* FrameSnapshotting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameSnapshotting.h; sourceTree = "<group>"; };
 		C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; };
@@ -22792,6 +22797,8 @@
 				E45322AA140CE267005A0F92 /* SelectorQuery.h */,
 				A6D169611346B49B000EB770 /* ShadowRoot.cpp */,
 				A6D169631346B4C1000EB770 /* ShadowRoot.h */,
+				C49474A919A2E2E5009B3DE8 /* SharedEventSenders.cpp */,
+				C49474A019A2847C009B3DE8 /* SharedEventSenders.h */,
 				31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */,
 				D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */,
 				D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */,
@@ -23386,6 +23393,7 @@
 				070363E0181A1CDC00C074A5 /* AVAudioCaptureSource.h in Headers */,
 				070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */,
 				070363E4181A1CDC00C074A5 /* AVMediaCaptureSource.h in Headers */,
+				C49474A819A2D612009B3DE8 /* EventSender.h in Headers */,
 				CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */,
 				070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */,
 				29A812380FBB9C1D00510293 /* AXObjectCache.h in Headers */,
@@ -26425,6 +26433,7 @@
 				85031B4F0A44EFC700F992E0 /* UIEventWithKeyState.h in Headers */,
 				AA4739D21757AFEC00E76767 /* UIRequestEvent.h in Headers */,
 				9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */,
+				C49474A119A2847C009B3DE8 /* SharedEventSenders.h in Headers */,
 				A863E2011343412000274926 /* UnicodeBidi.h in Headers */,
 				E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */,
 				D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */,
@@ -28091,6 +28100,7 @@
 				8931DE5B14C44C44000DC9D2 /* JSBlobCustom.cpp in Sources */,
 				1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */,
 				65DF323909D1DE65000BE325 /* JSCanvasGradient.cpp in Sources */,
+				C49474AA19A2E2E5009B3DE8 /* SharedEventSenders.cpp in Sources */,
 				65DF323B09D1DE65000BE325 /* JSCanvasPattern.cpp in Sources */,
 				49EED1421051969400099FAB /* JSCanvasRenderingContext.cpp in Sources */,
 				49EED1441051969400099FAB /* JSCanvasRenderingContext2D.cpp in Sources */,

Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (174269 => 174270)


--- trunk/Source/WebCore/dom/DOMAllInOne.cpp	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp	2014-10-03 17:15:51 UTC (rev 174270)
@@ -124,6 +124,7 @@
 #include "SecurityContext.cpp"
 #include "SelectorQuery.cpp"
 #include "ShadowRoot.cpp"
+#include "SharedEventSenders.cpp"
 #include "SpaceSplitString.cpp"
 #include "StaticNodeList.cpp"
 #include "StyledElement.cpp"

Modified: trunk/Source/WebCore/dom/Document.cpp (174269 => 174270)


--- trunk/Source/WebCore/dom/Document.cpp	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/dom/Document.cpp	2014-10-03 17:15:51 UTC (rev 174270)
@@ -138,6 +138,7 @@
 #include "SelectorQuery.h"
 #include "Settings.h"
 #include "ShadowRoot.h"
+#include "SharedEventSenders.h"
 #include "StyleProperties.h"
 #include "StyleResolver.h"
 #include "StyleSheetContents.h"
@@ -471,6 +472,7 @@
     , m_sawElementsInKnownNamespaces(false)
     , m_isSrcdocDocument(false)
     , m_eventQueue(*this)
+    , m_sharedEventSenders(std::make_unique<SharedEventSenders>())
     , m_weakFactory(this)
 #if ENABLE(FULLSCREEN_API)
     , m_areKeysEnabledInFullScreen(0)
@@ -2422,21 +2424,19 @@
     //  -When any new HTMLLinkElement is inserted into the document
     // But those add a dynamic component to the favicon that has UI 
     // ramifications, and we need to decide what is the Right Thing To Do(tm)
-    Frame* f = frame();
-    if (f) {
-        f->loader().icon().startLoader();
-        f->animation().startAnimationsIfNotSuspended(this);
-
-        // FIXME: We shouldn't be dispatching pending events globally on all Documents here.
-        // For now, only do this when there is a Frame, otherwise this could cause JS reentrancy
-        // below SVG font parsing, for example. <https://webkit.org/b/136269>
-        ImageLoader::dispatchPendingBeforeLoadEvents();
-        ImageLoader::dispatchPendingLoadEvents();
-        ImageLoader::dispatchPendingErrorEvents();
-        HTMLLinkElement::dispatchPendingLoadEvents();
-        HTMLStyleElement::dispatchPendingLoadEvents();
+    Frame* frame = this->frame();
+    if (frame) {
+        frame->loader().icon().startLoader();
+        frame->animation().startAnimationsIfNotSuspended(this);
     }
 
+    sharedEventSenders().imageBeforeloadEventSender().dispatchPendingEvents();
+    sharedEventSenders().imageLoadEventSender().dispatchPendingEvents();
+    sharedEventSenders().imageErrorEventSender().dispatchPendingEvents();
+
+    sharedEventSenders().linkLoadEventSender().dispatchPendingEvents();
+    sharedEventSenders().styleLoadEventSender().dispatchPendingEvents();
+
     // To align the HTML load event and the SVGLoad event for the outermost <svg> element, fire it from
     // here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false",
     // which is the default, for ='' its fired at a later time, once all external resources finished loading).
@@ -2447,15 +2447,15 @@
     enqueuePageshowEvent(PageshowEventNotPersisted);
     enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue());
     
-    if (f)
-        f->loader().handledOnloadEvents();
+    if (frame)
+        frame->loader().handledOnloadEvents();
 #ifdef INSTRUMENT_LAYOUT_SCHEDULING
     if (!ownerElement())
         printf("onload fired at %lld\n", elapsedTime().count());
 #endif
 
     // An event handler may have removed the frame
-    if (!frame()) {
+    if (!this->frame()) {
         m_processingLoadEvent = false;
         return;
     }
@@ -2464,7 +2464,7 @@
     // fires. This will improve onload scores, and other browsers do it.
     // If they wanna cheat, we can too. -dwh
 
-    if (frame()->navigationScheduler().locationChangePending() && elapsedTime() < settings()->layoutInterval()) {
+    if (this->frame()->navigationScheduler().locationChangePending() && elapsedTime() < settings()->layoutInterval()) {
         // Just bail out. Before or during the onload we were shifted to another page.
         // The old i-Bench suite does this. When this happens don't bother painting or laying out.        
         m_processingLoadEvent = false;
@@ -2472,7 +2472,7 @@
         return;
     }
 
-    frame()->loader().checkCallImplicitClose();
+    this->frame()->loader().checkCallImplicitClose();
     
     // We used to force a synchronous display and flush here.  This really isn't
     // necessary and can in fact be actively harmful if pages are loading at a rate of > 60fps
@@ -2489,7 +2489,7 @@
     m_processingLoadEvent = false;
 
 #if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(EFL)
-    if (f && hasLivingRenderTree() && AXObjectCache::accessibilityEnabled()) {
+    if (frame && hasLivingRenderTree() && AXObjectCache::accessibilityEnabled()) {
         // The AX cache may have been cleared at this point, but we need to make sure it contains an
         // AX object to send the notification to. getOrCreate will make sure that an valid AX object
         // exists in the cache (we ignore the return value because we don't need it here). This is 

Modified: trunk/Source/WebCore/dom/Document.h (174269 => 174270)


--- trunk/Source/WebCore/dom/Document.h	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/dom/Document.h	2014-10-03 17:15:51 UTC (rev 174270)
@@ -144,6 +144,7 @@
 class SerializedScriptValue;
 class SegmentedString;
 class Settings;
+class SharedEventSenders;
 class StyleResolver;
 class StyleSheet;
 class StyleSheetContents;
@@ -1119,6 +1120,8 @@
     void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject);
     virtual DocumentEventQueue& eventQueue() const override { return m_eventQueue; }
 
+    SharedEventSenders& sharedEventSenders() const { return *m_sharedEventSenders; }
+
     WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener*);
     WEBCORE_EXPORT void removeMediaCanStartListener(MediaCanStartListener*);
     MediaCanStartListener* takeAnyMediaCanStartListener();
@@ -1576,6 +1579,8 @@
     RenderPtr<RenderView> m_renderView;
     mutable DocumentEventQueue m_eventQueue;
 
+    const std::unique_ptr<SharedEventSenders> m_sharedEventSenders;
+
     WeakPtrFactory<Document> m_weakFactory;
 
     HashSet<MediaCanStartListener*> m_mediaCanStartListeners;

Modified: trunk/Source/WebCore/dom/EventSender.h (174269 => 174270)


--- trunk/Source/WebCore/dom/EventSender.h	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/dom/EventSender.h	2014-10-03 17:15:51 UTC (rev 174270)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,10 +32,15 @@
 
 namespace WebCore {
 
-template<typename T> class EventSender {
+template <typename T>
+class EventSender {
     WTF_MAKE_NONCOPYABLE(EventSender); WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit EventSender(const AtomicString& eventType);
+    EventSender(const AtomicString& eventType)
+        : m_eventType(eventType)
+        , m_timer(this, &EventSender::timerFired)
+    {
+    }
 
     const AtomicString& eventType() const { return m_eventType; }
     void dispatchEventSoon(T&);
@@ -42,9 +48,9 @@
     void dispatchPendingEvents();
 
 #ifndef NDEBUG
-    bool hasPendingEvents(T& sender) const
+    bool hasPendingEvents(T& client) const
     {
-        return m_dispatchSoonList.find(&sender) != notFound || m_dispatchingList.find(&sender) != notFound;
+        return m_dispatchSoonList.find(&client) != notFound || m_dispatchingList.find(&client) != notFound;
     }
 #endif
 
@@ -57,34 +63,31 @@
     Vector<T*> m_dispatchingList;
 };
 
-template<typename T> EventSender<T>::EventSender(const AtomicString& eventType)
-    : m_eventType(eventType)
-    , m_timer(this, &EventSender::timerFired)
+template <typename T>
+void EventSender<T>::dispatchEventSoon(T& client)
 {
-}
-
-template<typename T> void EventSender<T>::dispatchEventSoon(T& sender)
-{
-    m_dispatchSoonList.append(&sender);
+    m_dispatchSoonList.append(&client);
     if (!m_timer.isActive())
         m_timer.startOneShot(0);
 }
 
-template<typename T> void EventSender<T>::cancelEvent(T& sender)
+template<typename T>
+void EventSender<T>::cancelEvent(T& client)
 {
-    // Remove instances of this sender from both lists.
+    // Remove instances of this client from both lists.
     // Use loops because we allow multiple instances to get into the lists.
     for (auto& event : m_dispatchSoonList) {
-        if (event == &sender)
+        if (event == &client)
             event = nullptr;
     }
     for (auto& event : m_dispatchingList) {
-        if (event == &sender)
+        if (event == &client)
             event = nullptr;
     }
 }
 
-template<typename T> void EventSender<T>::dispatchPendingEvents()
+template<typename T>
+void EventSender<T>::dispatchPendingEvents()
 {
     // Need to avoid re-entering this function; if new dispatches are
     // scheduled before the parent finishes processing the list, they
@@ -94,13 +97,11 @@
 
     m_timer.stop();
 
-    m_dispatchSoonList.checkConsistency();
-
     m_dispatchingList.swap(m_dispatchSoonList);
     for (auto& event : m_dispatchingList) {
-        if (T* sender = event) {
+        if (T* client = event) {
             event = nullptr;
-            sender->dispatchPendingEvent(this);
+            client->dispatchPendingEvent(*this);
         }
     }
     m_dispatchingList.clear();

Added: trunk/Source/WebCore/dom/SharedEventSenders.cpp (0 => 174270)


--- trunk/Source/WebCore/dom/SharedEventSenders.cpp	                        (rev 0)
+++ trunk/Source/WebCore/dom/SharedEventSenders.cpp	2014-10-03 17:15:51 UTC (rev 174270)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SharedEventSenders.h"
+
+#include "HTMLLinkElement.h"
+#include "HTMLStyleElement.h"
+#include "ImageLoader.h"
+
+namespace WebCore {
+
+EventSender<HTMLLinkElement>& SharedEventSenders::linkLoadEventSender()
+{
+    if (!m_linkLoadEventSender)
+        m_linkLoadEventSender = std::make_unique<EventSender<HTMLLinkElement>>(eventNames().loadEvent);
+
+    return *m_linkLoadEventSender;
+}
+
+EventSender<HTMLStyleElement>& SharedEventSenders::styleLoadEventSender()
+{
+    if (!m_styleLoadEventSender)
+        m_styleLoadEventSender = std::make_unique<EventSender<HTMLStyleElement>>(eventNames().loadEvent);
+
+    return *m_styleLoadEventSender;
+}
+
+EventSender<ImageLoader>& SharedEventSenders::imageBeforeloadEventSender()
+{
+    if (!m_imageBeforeloadEventSender)
+        m_imageBeforeloadEventSender = std::make_unique<EventSender<ImageLoader>>(eventNames().beforeloadEvent);
+
+    return *m_imageBeforeloadEventSender;
+}
+
+EventSender<ImageLoader>& SharedEventSenders::imageLoadEventSender()
+{
+    if (!m_imageLoadEventSender)
+        m_imageLoadEventSender = std::make_unique<EventSender<ImageLoader>>(eventNames().loadEvent);
+
+    return *m_imageLoadEventSender;
+}
+
+EventSender<ImageLoader>& SharedEventSenders::imageErrorEventSender()
+{
+    if (!m_imageErrorEventSender)
+        m_imageErrorEventSender = std::make_unique<EventSender<ImageLoader>>(eventNames().errorEvent);
+
+    return *m_imageErrorEventSender;
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/dom/SharedEventSenders.h (0 => 174270)


--- trunk/Source/WebCore/dom/SharedEventSenders.h	                        (rev 0)
+++ trunk/Source/WebCore/dom/SharedEventSenders.h	2014-10-03 17:15:51 UTC (rev 174270)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SharedEventSenders_h
+#define SharedEventSenders_h
+
+#include "EventNames.h"
+#include "EventSender.h"
+
+namespace WebCore {
+
+class HTMLLinkElement;
+class HTMLStyleElement;
+class ImageLoader;
+
+class SharedEventSenders {
+    WTF_MAKE_NONCOPYABLE(SharedEventSenders); WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit SharedEventSenders() { }
+
+    EventSender<HTMLLinkElement>& linkLoadEventSender();
+    EventSender<HTMLStyleElement>& styleLoadEventSender();
+    EventSender<ImageLoader>& imageBeforeloadEventSender();
+    EventSender<ImageLoader>& imageLoadEventSender();
+    EventSender<ImageLoader>& imageErrorEventSender();
+private:
+    std::unique_ptr<EventSender<HTMLLinkElement>> m_linkLoadEventSender;
+    std::unique_ptr<EventSender<HTMLStyleElement>> m_styleLoadEventSender;
+    std::unique_ptr<EventSender<ImageLoader>> m_imageBeforeloadEventSender;
+    std::unique_ptr<EventSender<ImageLoader>> m_imageLoadEventSender;
+    std::unique_ptr<EventSender<ImageLoader>> m_imageErrorEventSender;
+};
+
+} // namespace WebCore
+
+#endif // SharedEventSenders_h

Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (174269 => 174270)


--- trunk/Source/WebCore/html/HTMLLinkElement.cpp	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp	2014-10-03 17:15:51 UTC (rev 174270)
@@ -33,7 +33,6 @@
 #include "Document.h"
 #include "DocumentStyleSheetCollection.h"
 #include "Event.h"
-#include "EventSender.h"
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
@@ -47,6 +46,7 @@
 #include "RenderStyle.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
+#include "SharedEventSenders.h"
 #include "StyleInheritedData.h"
 #include "StyleResolveForDocument.h"
 #include "StyleSheetContents.h"
@@ -57,12 +57,6 @@
 
 using namespace HTMLNames;
 
-static LinkEventSender& linkLoadEventSender()
-{
-    DEPRECATED_DEFINE_STATIC_LOCAL(LinkEventSender, sharedLoadEventSender, (eventNames().loadEvent));
-    return sharedLoadEventSender;
-}
-
 inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document& document, bool createdByParser)
     : HTMLElement(tagName, document)
     , m_linkLoader(this)
@@ -94,7 +88,7 @@
     if (inDocument())
         document().styleSheetCollection().removeStyleSheetCandidateNode(*this);
 
-    linkLoadEventSender().cancelEvent(*this);
+    document().sharedEventSenders().linkLoadEventSender().cancelEvent(*this);
 }
 
 void HTMLLinkElement::setDisabledState(bool disabled)
@@ -361,14 +355,10 @@
     return false;
 }
 
-void HTMLLinkElement::dispatchPendingLoadEvents()
+void HTMLLinkElement::dispatchPendingEvent(EventSender<HTMLLinkElement>& eventSender)
 {
-    linkLoadEventSender().dispatchPendingEvents();
-}
+    ASSERT_UNUSED(eventSender, &eventSender == &document().sharedEventSenders().linkLoadEventSender());
 
-void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender)
-{
-    ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender());
     if (m_loadedSheet)
         linkLoaded();
     else
@@ -380,7 +370,7 @@
     if (m_firedLoad)
         return;
     m_loadedSheet = !errorOccurred;
-    linkLoadEventSender().dispatchEventSoon(*this);
+    document().sharedEventSenders().linkLoadEventSender().dispatchEventSoon(*this);
     m_firedLoad = true;
 }
 

Modified: trunk/Source/WebCore/html/HTMLLinkElement.h (174269 => 174270)


--- trunk/Source/WebCore/html/HTMLLinkElement.h	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/html/HTMLLinkElement.h	2014-10-03 17:15:51 UTC (rev 174270)
@@ -40,7 +40,6 @@
 class URL;
 
 template<typename T> class EventSender;
-typedef EventSender<HTMLLinkElement> LinkEventSender;
 
 class HTMLLinkElement final : public HTMLElement, public CachedStyleSheetClient, public LinkLoaderClient {
 public:
@@ -68,8 +67,7 @@
     void setSizes(const String&);
     DOMSettableTokenList* sizes() const;
 
-    void dispatchPendingEvent(LinkEventSender*);
-    static void dispatchPendingLoadEvents();
+    void dispatchPendingEvent(EventSender<HTMLLinkElement>&);
 
 private:
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;

Modified: trunk/Source/WebCore/html/HTMLStyleElement.cpp (174269 => 174270)


--- trunk/Source/WebCore/html/HTMLStyleElement.cpp	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/html/HTMLStyleElement.cpp	2014-10-03 17:15:51 UTC (rev 174270)
@@ -27,23 +27,18 @@
 #include "Attribute.h"
 #include "Document.h"
 #include "Event.h"
-#include "EventSender.h"
 #include "HTMLNames.h"
 #include "MediaList.h"
 #include "RuntimeEnabledFeatures.h"
 #include "ScriptableDocumentParser.h"
 #include "ShadowRoot.h"
+#include "SharedEventSenders.h"
 #include "StyleSheetContents.h"
 
 namespace WebCore {
 
 using namespace HTMLNames;
 
-static StyleEventSender& styleLoadEventSender()
-{
-    DEPRECATED_DEFINE_STATIC_LOCAL(StyleEventSender, sharedLoadEventSender, (eventNames().loadEvent));
-    return sharedLoadEventSender;
-}
 
 inline HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document& document, bool createdByParser)
     : HTMLElement(tagName, document)
@@ -60,7 +55,7 @@
     // Therefore we can't ASSERT(m_scopedStyleRegistrationState == NotRegistered).
     m_styleSheetOwner.clearDocumentData(document(), *this);
 
-    styleLoadEventSender().cancelEvent(*this);
+    document().sharedEventSenders().styleLoadEventSender().cancelEvent(*this);
 }
 
 PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagName, Document& document, bool createdByParser)
@@ -114,14 +109,10 @@
     m_styleSheetOwner.childrenChanged(*this);
 }
 
-void HTMLStyleElement::dispatchPendingLoadEvents()
+void HTMLStyleElement::dispatchPendingEvent(EventSender<HTMLStyleElement>& eventSender)
 {
-    styleLoadEventSender().dispatchPendingEvents();
-}
+    ASSERT_UNUSED(eventSender, &eventSender == &document().sharedEventSenders().styleLoadEventSender());
 
-void HTMLStyleElement::dispatchPendingEvent(StyleEventSender* eventSender)
-{
-    ASSERT_UNUSED(eventSender, eventSender == &styleLoadEventSender());
     if (m_loadedSheet)
         dispatchEvent(Event::create(eventNames().loadEvent, false, false));
     else
@@ -133,7 +124,7 @@
     if (m_firedLoad)
         return;
     m_loadedSheet = !errorOccurred;
-    styleLoadEventSender().dispatchEventSoon(*this);
+    document().sharedEventSenders().styleLoadEventSender().dispatchEventSoon(*this);
     m_firedLoad = true;
 }
 

Modified: trunk/Source/WebCore/html/HTMLStyleElement.h (174269 => 174270)


--- trunk/Source/WebCore/html/HTMLStyleElement.h	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/html/HTMLStyleElement.h	2014-10-03 17:15:51 UTC (rev 174270)
@@ -32,7 +32,6 @@
 class StyleSheet;
 
 template<typename T> class EventSender;
-typedef EventSender<HTMLStyleElement> StyleEventSender;
 
 class HTMLStyleElement final : public HTMLElement {
 public:
@@ -44,8 +43,7 @@
     bool disabled() const;
     void setDisabled(bool);
 
-    void dispatchPendingEvent(StyleEventSender*);
-    static void dispatchPendingLoadEvents();
+    void dispatchPendingEvent(EventSender<HTMLStyleElement>&);
 
 private:
     HTMLStyleElement(const QualifiedName&, Document&, bool createdByParser);

Modified: trunk/Source/WebCore/loader/ImageLoader.cpp (174269 => 174270)


--- trunk/Source/WebCore/loader/ImageLoader.cpp	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/loader/ImageLoader.cpp	2014-10-03 17:15:51 UTC (rev 174270)
@@ -29,7 +29,6 @@
 #include "Document.h"
 #include "Element.h"
 #include "Event.h"
-#include "EventSender.h"
 #include "Frame.h"
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
@@ -38,6 +37,7 @@
 #include "RenderImage.h"
 #include "RenderSVGImage.h"
 #include "SecurityOrigin.h"
+#include "SharedEventSenders.h"
 #include <wtf/NeverDestroyed.h>
 
 #if ENABLE(VIDEO)
@@ -63,22 +63,19 @@
 
 namespace WebCore {
 
-static ImageEventSender& beforeLoadEventSender()
+EventSender<ImageLoader>& ImageLoader::beforeLoadEventSender() const
 {
-    static NeverDestroyed<ImageEventSender> sender(eventNames().beforeloadEvent);
-    return sender;
+    return m_element.document().sharedEventSenders().imageBeforeloadEventSender();
 }
 
-static ImageEventSender& loadEventSender()
+EventSender<ImageLoader>& ImageLoader::loadEventSender() const
 {
-    static NeverDestroyed<ImageEventSender> sender(eventNames().loadEvent);
-    return sender;
+    return m_element.document().sharedEventSenders().imageLoadEventSender();
 }
 
-static ImageEventSender& errorEventSender()
+EventSender<ImageLoader>& ImageLoader::errorEventSender() const
 {
-    static NeverDestroyed<ImageEventSender> sender(eventNames().errorEvent);
-    return sender;
+    return m_element.document().sharedEventSenders().imageErrorEventSender();
 }
 
 static inline bool pageIsBeingDismissed(Document& document)
@@ -379,10 +376,10 @@
     element().deref();
 }
 
-void ImageLoader::dispatchPendingEvent(ImageEventSender* eventSender)
+void ImageLoader::dispatchPendingEvent(EventSender<ImageLoader>& eventSender)
 {
-    ASSERT(eventSender == &beforeLoadEventSender() || eventSender == &loadEventSender() || eventSender == &errorEventSender());
-    const AtomicString& eventType = eventSender->eventType();
+    ASSERT(&eventSender == &beforeLoadEventSender() || &eventSender == &loadEventSender() || &eventSender == &errorEventSender());
+    const AtomicString& eventType = eventSender.eventType();
     if (eventType == eventNames().beforeloadEvent)
         dispatchPendingBeforeLoadEvent();
     if (eventType == eventNames().loadEvent)
@@ -448,21 +445,6 @@
     updatedHasPendingEvent();
 }
 
-void ImageLoader::dispatchPendingBeforeLoadEvents()
-{
-    beforeLoadEventSender().dispatchPendingEvents();
-}
-
-void ImageLoader::dispatchPendingLoadEvents()
-{
-    loadEventSender().dispatchPendingEvents();
-}
-
-void ImageLoader::dispatchPendingErrorEvents()
-{
-    errorEventSender().dispatchPendingEvents();
-}
-
 void ImageLoader::elementDidMoveToNewDocument()
 {
     clearFailedLoadURL();

Modified: trunk/Source/WebCore/loader/ImageLoader.h (174269 => 174270)


--- trunk/Source/WebCore/loader/ImageLoader.h	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/loader/ImageLoader.h	2014-10-03 17:15:51 UTC (rev 174270)
@@ -35,7 +35,6 @@
 class RenderImageResource;
 
 template<typename T> class EventSender;
-typedef EventSender<ImageLoader> ImageEventSender;
 
 class ImageLoader : public CachedImageClient {
     WTF_MAKE_FAST_ALLOCATED;
@@ -65,11 +64,11 @@
     bool hasPendingBeforeLoadEvent() const { return m_hasPendingBeforeLoadEvent; }
     bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; }
 
-    void dispatchPendingEvent(ImageEventSender*);
+    void dispatchPendingEvent(EventSender<ImageLoader>&);
 
-    static void dispatchPendingBeforeLoadEvents();
-    static void dispatchPendingLoadEvents();
-    static void dispatchPendingErrorEvents();
+    EventSender<ImageLoader>& beforeLoadEventSender() const;
+    EventSender<ImageLoader>& loadEventSender() const;
+    EventSender<ImageLoader>& errorEventSender() const;
 
 protected:
     explicit ImageLoader(Element&);

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (174269 => 174270)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2014-10-03 16:57:10 UTC (rev 174269)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2014-10-03 17:15:51 UTC (rev 174270)
@@ -120,9 +120,6 @@
     }
 
     doWrite(source.toString());
-
-    // After parsing, go ahead and dispatch image beforeload events.
-    ImageLoader::dispatchPendingBeforeLoadEvents();
 }
 
 void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* m, TextPosition position)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to