<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[174270] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/174270">174270</a></dd>
<dt>Author</dt> <dd>burg@cs.washington.edu</dd>
<dt>Date</dt> <dd>2014-10-03 10:15:51 -0700 (Fri, 03 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomDOMAllInOnecpp">trunk/Source/WebCore/dom/DOMAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCoredomEventSenderh">trunk/Source/WebCore/dom/EventSender.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementcpp">trunk/Source/WebCore/html/HTMLLinkElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementh">trunk/Source/WebCore/html/HTMLLinkElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLStyleElementcpp">trunk/Source/WebCore/html/HTMLStyleElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLStyleElementh">trunk/Source/WebCore/html/HTMLStyleElement.h</a></li>
<li><a href="#trunkSourceWebCoreloaderImageLoadercpp">trunk/Source/WebCore/loader/ImageLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderImageLoaderh">trunk/Source/WebCore/loader/ImageLoader.h</a></li>
<li><a href="#trunkSourceWebCorexmlparserXMLDocumentParsercpp">trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoredomSharedEventSenderscpp">trunk/Source/WebCore/dom/SharedEventSenders.cpp</a></li>
<li><a href="#trunkSourceWebCoredomSharedEventSendersh">trunk/Source/WebCore/dom/SharedEventSenders.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1437,6 +1437,7 @@
</span><span class="cx"> dom/SecurityContext.cpp
</span><span class="cx"> dom/SelectorQuery.cpp
</span><span class="cx"> dom/ShadowRoot.cpp
</span><ins>+ dom/SharedEventSenders.cpp
</ins><span class="cx"> dom/SpaceSplitString.cpp
</span><span class="cx"> dom/StaticNodeList.cpp
</span><span class="cx"> dom/StringCallback.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,81 @@
</span><ins>+2014-10-01 Brian J. Burg <burg@cs.washington.edu>
+
+ 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.
+
</ins><span class="cx"> 2014-10-03 Myles C. Maxfield <mmaxfield@apple.com>
</span><span class="cx">
</span><span class="cx"> TextRun::length() should return an unsigned
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -13778,6 +13778,20 @@
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</span><span class="cx"> </ClCompile>
</span><ins>+ <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>
</ins><span class="cx"> <ClCompile Include="..\dom\SpaceSplitString.cpp">
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</span><span class="lines">@@ -20583,6 +20597,7 @@
</span><span class="cx"> <ClInclude Include="..\dom\SecurityContext.h" />
</span><span class="cx"> <ClInclude Include="..\dom\SelectorQuery.h" />
</span><span class="cx"> <ClInclude Include="..\dom\SimulatedClickOptions.h" />
</span><ins>+ <ClInclude Include="..\dom\SharedEventSenders.h" />
</ins><span class="cx"> <ClInclude Include="..\dom\SpaceSplitString.h" />
</span><span class="cx"> <ClInclude Include="..\dom\StaticHashSetNodeList.h" />
</span><span class="cx"> <ClInclude Include="..\dom\StaticNodeList.h" />
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -3354,6 +3354,9 @@
</span><span class="cx"> <ClCompile Include="..\dom\SelectorQuery.cpp">
</span><span class="cx"> <Filter>dom</Filter>
</span><span class="cx"> </ClCompile>
</span><ins>+ <ClCompile Include="..\dom\SharedEventSenders.cpp">
+ <Filter>dom</Filter>
+ </ClCompile>
</ins><span class="cx"> <ClCompile Include="..\dom\SpaceSplitString.cpp">
</span><span class="cx"> <Filter>dom</Filter>
</span><span class="cx"> </ClCompile>
</span><span class="lines">@@ -10452,6 +10455,9 @@
</span><span class="cx"> <ClInclude Include="..\dom\SelectorQuery.h">
</span><span class="cx"> <Filter>dom</Filter>
</span><span class="cx"> </ClInclude>
</span><ins>+ <ClInclude Include="..\dom\SharedEventSenders.h">
+ <Filter>dom</Filter>
+ </ClInclude>
</ins><span class="cx"> <ClInclude Include="..\dom\SimulatedClickOptions.h">
</span><span class="cx"> <Filter>dom</Filter>
</span><span class="cx"> </ClInclude>
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -5517,6 +5517,9 @@
</span><span class="cx">                 C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */; };
</span><span class="cx">                 C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 C400D10918F1C8F60090D863 /* EventLoopInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C400D10818F1C8F60090D863 /* EventLoopInput.cpp */; };
</span><ins>+                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 */; };
</ins><span class="cx">                 C4CD629A18383766007EBAF1 /* FrameSnapshotting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */; };
</span><span class="cx">                 C4CD629B18383766007EBAF1 /* FrameSnapshotting.h in Headers */ = {isa = PBXBuildFile; fileRef = C4CD629918383766007EBAF1 /* FrameSnapshotting.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; };
</span><span class="lines">@@ -12935,6 +12938,8 @@
</span><span class="cx">                 C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserverRegistry.h; sourceTree = "<group>"; };
</span><span class="cx">                 C3E61C653A64807A83E76FB8 /* MathMLMencloseElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLMencloseElement.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 C400D10818F1C8F60090D863 /* EventLoopInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventLoopInput.cpp; sourceTree = "<group>"; };
</span><ins>+                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>"; };
</ins><span class="cx">                 C4CD629818383766007EBAF1 /* FrameSnapshotting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameSnapshotting.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 C4CD629918383766007EBAF1 /* FrameSnapshotting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameSnapshotting.h; sourceTree = "<group>"; };
</span><span class="cx">                 C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -22792,6 +22797,8 @@
</span><span class="cx">                                 E45322AA140CE267005A0F92 /* SelectorQuery.h */,
</span><span class="cx">                                 A6D169611346B49B000EB770 /* ShadowRoot.cpp */,
</span><span class="cx">                                 A6D169631346B4C1000EB770 /* ShadowRoot.h */,
</span><ins>+                                C49474A919A2E2E5009B3DE8 /* SharedEventSenders.cpp */,
+                                C49474A019A2847C009B3DE8 /* SharedEventSenders.h */,
</ins><span class="cx">                                 31741AAB16635E45008A5B7E /* SimulatedClickOptions.h */,
</span><span class="cx">                                 D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */,
</span><span class="cx">                                 D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */,
</span><span class="lines">@@ -23386,6 +23393,7 @@
</span><span class="cx">                                 070363E0181A1CDC00C074A5 /* AVAudioCaptureSource.h in Headers */,
</span><span class="cx">                                 070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */,
</span><span class="cx">                                 070363E4181A1CDC00C074A5 /* AVMediaCaptureSource.h in Headers */,
</span><ins>+                                C49474A819A2D612009B3DE8 /* EventSender.h in Headers */,
</ins><span class="cx">                                 CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */,
</span><span class="cx">                                 070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */,
</span><span class="cx">                                 29A812380FBB9C1D00510293 /* AXObjectCache.h in Headers */,
</span><span class="lines">@@ -26425,6 +26433,7 @@
</span><span class="cx">                                 85031B4F0A44EFC700F992E0 /* UIEventWithKeyState.h in Headers */,
</span><span class="cx">                                 AA4739D21757AFEC00E76767 /* UIRequestEvent.h in Headers */,
</span><span class="cx">                                 9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */,
</span><ins>+                                C49474A119A2847C009B3DE8 /* SharedEventSenders.h in Headers */,
</ins><span class="cx">                                 A863E2011343412000274926 /* UnicodeBidi.h in Headers */,
</span><span class="cx">                                 E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */,
</span><span class="cx">                                 D086FE9809D53AAB005BC74D /* UnlinkCommand.h in Headers */,
</span><span class="lines">@@ -28091,6 +28100,7 @@
</span><span class="cx">                                 8931DE5B14C44C44000DC9D2 /* JSBlobCustom.cpp in Sources */,
</span><span class="cx">                                 1449E287107D4DB400B5793F /* JSCallbackData.cpp in Sources */,
</span><span class="cx">                                 65DF323909D1DE65000BE325 /* JSCanvasGradient.cpp in Sources */,
</span><ins>+                                C49474AA19A2E2E5009B3DE8 /* SharedEventSenders.cpp in Sources */,
</ins><span class="cx">                                 65DF323B09D1DE65000BE325 /* JSCanvasPattern.cpp in Sources */,
</span><span class="cx">                                 49EED1421051969400099FAB /* JSCanvasRenderingContext.cpp in Sources */,
</span><span class="cx">                                 49EED1441051969400099FAB /* JSCanvasRenderingContext2D.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx"> #include "SecurityContext.cpp"
</span><span class="cx"> #include "SelectorQuery.cpp"
</span><span class="cx"> #include "ShadowRoot.cpp"
</span><ins>+#include "SharedEventSenders.cpp"
</ins><span class="cx"> #include "SpaceSplitString.cpp"
</span><span class="cx"> #include "StaticNodeList.cpp"
</span><span class="cx"> #include "StyledElement.cpp"
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -138,6 +138,7 @@
</span><span class="cx"> #include "SelectorQuery.h"
</span><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span><ins>+#include "SharedEventSenders.h"
</ins><span class="cx"> #include "StyleProperties.h"
</span><span class="cx"> #include "StyleResolver.h"
</span><span class="cx"> #include "StyleSheetContents.h"
</span><span class="lines">@@ -471,6 +472,7 @@
</span><span class="cx"> , m_sawElementsInKnownNamespaces(false)
</span><span class="cx"> , m_isSrcdocDocument(false)
</span><span class="cx"> , m_eventQueue(*this)
</span><ins>+ , m_sharedEventSenders(std::make_unique<SharedEventSenders>())
</ins><span class="cx"> , m_weakFactory(this)
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> , m_areKeysEnabledInFullScreen(0)
</span><span class="lines">@@ -2422,21 +2424,19 @@
</span><span class="cx"> // -When any new HTMLLinkElement is inserted into the document
</span><span class="cx"> // But those add a dynamic component to the favicon that has UI
</span><span class="cx"> // ramifications, and we need to decide what is the Right Thing To Do(tm)
</span><del>- 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();
</del><ins>+ Frame* frame = this->frame();
+ if (frame) {
+ frame->loader().icon().startLoader();
+ frame->animation().startAnimationsIfNotSuspended(this);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ sharedEventSenders().imageBeforeloadEventSender().dispatchPendingEvents();
+ sharedEventSenders().imageLoadEventSender().dispatchPendingEvents();
+ sharedEventSenders().imageErrorEventSender().dispatchPendingEvents();
+
+ sharedEventSenders().linkLoadEventSender().dispatchPendingEvents();
+ sharedEventSenders().styleLoadEventSender().dispatchPendingEvents();
+
</ins><span class="cx"> // To align the HTML load event and the SVGLoad event for the outermost <svg> element, fire it from
</span><span class="cx"> // here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false",
</span><span class="cx"> // which is the default, for ='true' its fired at a later time, once all external resources finished loading).
</span><span class="lines">@@ -2447,15 +2447,15 @@
</span><span class="cx"> enqueuePageshowEvent(PageshowEventNotPersisted);
</span><span class="cx"> enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue());
</span><span class="cx">
</span><del>- if (f)
- f->loader().handledOnloadEvents();
</del><ins>+ if (frame)
+ frame->loader().handledOnloadEvents();
</ins><span class="cx"> #ifdef INSTRUMENT_LAYOUT_SCHEDULING
</span><span class="cx"> if (!ownerElement())
</span><span class="cx"> printf("onload fired at %lld\n", elapsedTime().count());
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // An event handler may have removed the frame
</span><del>- if (!frame()) {
</del><ins>+ if (!this->frame()) {
</ins><span class="cx"> m_processingLoadEvent = false;
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -2464,7 +2464,7 @@
</span><span class="cx"> // fires. This will improve onload scores, and other browsers do it.
</span><span class="cx"> // If they wanna cheat, we can too. -dwh
</span><span class="cx">
</span><del>- if (frame()->navigationScheduler().locationChangePending() && elapsedTime() < settings()->layoutInterval()) {
</del><ins>+ if (this->frame()->navigationScheduler().locationChangePending() && elapsedTime() < settings()->layoutInterval()) {
</ins><span class="cx"> // Just bail out. Before or during the onload we were shifted to another page.
</span><span class="cx"> // The old i-Bench suite does this. When this happens don't bother painting or laying out.
</span><span class="cx"> m_processingLoadEvent = false;
</span><span class="lines">@@ -2472,7 +2472,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- frame()->loader().checkCallImplicitClose();
</del><ins>+ this->frame()->loader().checkCallImplicitClose();
</ins><span class="cx">
</span><span class="cx"> // We used to force a synchronous display and flush here. This really isn't
</span><span class="cx"> // necessary and can in fact be actively harmful if pages are loading at a rate of > 60fps
</span><span class="lines">@@ -2489,7 +2489,7 @@
</span><span class="cx"> m_processingLoadEvent = false;
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(EFL)
</span><del>- if (f && hasLivingRenderTree() && AXObjectCache::accessibilityEnabled()) {
</del><ins>+ if (frame && hasLivingRenderTree() && AXObjectCache::accessibilityEnabled()) {
</ins><span class="cx"> // The AX cache may have been cleared at this point, but we need to make sure it contains an
</span><span class="cx"> // AX object to send the notification to. getOrCreate will make sure that an valid AX object
</span><span class="cx"> // exists in the cache (we ignore the return value because we don't need it here). This is
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -144,6 +144,7 @@
</span><span class="cx"> class SerializedScriptValue;
</span><span class="cx"> class SegmentedString;
</span><span class="cx"> class Settings;
</span><ins>+class SharedEventSenders;
</ins><span class="cx"> class StyleResolver;
</span><span class="cx"> class StyleSheet;
</span><span class="cx"> class StyleSheetContents;
</span><span class="lines">@@ -1119,6 +1120,8 @@
</span><span class="cx"> void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject);
</span><span class="cx"> virtual DocumentEventQueue& eventQueue() const override { return m_eventQueue; }
</span><span class="cx">
</span><ins>+ SharedEventSenders& sharedEventSenders() const { return *m_sharedEventSenders; }
+
</ins><span class="cx"> WEBCORE_EXPORT void addMediaCanStartListener(MediaCanStartListener*);
</span><span class="cx"> WEBCORE_EXPORT void removeMediaCanStartListener(MediaCanStartListener*);
</span><span class="cx"> MediaCanStartListener* takeAnyMediaCanStartListener();
</span><span class="lines">@@ -1576,6 +1579,8 @@
</span><span class="cx"> RenderPtr<RenderView> m_renderView;
</span><span class="cx"> mutable DocumentEventQueue m_eventQueue;
</span><span class="cx">
</span><ins>+ const std::unique_ptr<SharedEventSenders> m_sharedEventSenders;
+
</ins><span class="cx"> WeakPtrFactory<Document> m_weakFactory;
</span><span class="cx">
</span><span class="cx"> HashSet<MediaCanStartListener*> m_mediaCanStartListeners;
</span></span></pre></div>
<a id="trunkSourceWebCoredomEventSenderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventSender.h (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> * Copyright (C) 2012 Apple Inc. All rights reserved.
</span><ins>+ * Copyright (C) 2014 University of Washington. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -31,10 +32,15 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-template<typename T> class EventSender {
</del><ins>+template <typename T>
+class EventSender {
</ins><span class="cx"> WTF_MAKE_NONCOPYABLE(EventSender); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- explicit EventSender(const AtomicString& eventType);
</del><ins>+ EventSender(const AtomicString& eventType)
+ : m_eventType(eventType)
+ , m_timer(this, &EventSender::timerFired)
+ {
+ }
</ins><span class="cx">
</span><span class="cx"> const AtomicString& eventType() const { return m_eventType; }
</span><span class="cx"> void dispatchEventSoon(T&);
</span><span class="lines">@@ -42,9 +48,9 @@
</span><span class="cx"> void dispatchPendingEvents();
</span><span class="cx">
</span><span class="cx"> #ifndef NDEBUG
</span><del>- bool hasPendingEvents(T& sender) const
</del><ins>+ bool hasPendingEvents(T& client) const
</ins><span class="cx"> {
</span><del>- return m_dispatchSoonList.find(&sender) != notFound || m_dispatchingList.find(&sender) != notFound;
</del><ins>+ return m_dispatchSoonList.find(&client) != notFound || m_dispatchingList.find(&client) != notFound;
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -57,34 +63,31 @@
</span><span class="cx"> Vector<T*> m_dispatchingList;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-template<typename T> EventSender<T>::EventSender(const AtomicString& eventType)
- : m_eventType(eventType)
- , m_timer(this, &EventSender::timerFired)
</del><ins>+template <typename T>
+void EventSender<T>::dispatchEventSoon(T& client)
</ins><span class="cx"> {
</span><del>-}
-
-template<typename T> void EventSender<T>::dispatchEventSoon(T& sender)
-{
- m_dispatchSoonList.append(&sender);
</del><ins>+ m_dispatchSoonList.append(&client);
</ins><span class="cx"> if (!m_timer.isActive())
</span><span class="cx"> m_timer.startOneShot(0);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<typename T> void EventSender<T>::cancelEvent(T& sender)
</del><ins>+template<typename T>
+void EventSender<T>::cancelEvent(T& client)
</ins><span class="cx"> {
</span><del>- // Remove instances of this sender from both lists.
</del><ins>+ // Remove instances of this client from both lists.
</ins><span class="cx"> // Use loops because we allow multiple instances to get into the lists.
</span><span class="cx"> for (auto& event : m_dispatchSoonList) {
</span><del>- if (event == &sender)
</del><ins>+ if (event == &client)
</ins><span class="cx"> event = nullptr;
</span><span class="cx"> }
</span><span class="cx"> for (auto& event : m_dispatchingList) {
</span><del>- if (event == &sender)
</del><ins>+ if (event == &client)
</ins><span class="cx"> event = nullptr;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<typename T> void EventSender<T>::dispatchPendingEvents()
</del><ins>+template<typename T>
+void EventSender<T>::dispatchPendingEvents()
</ins><span class="cx"> {
</span><span class="cx"> // Need to avoid re-entering this function; if new dispatches are
</span><span class="cx"> // scheduled before the parent finishes processing the list, they
</span><span class="lines">@@ -94,13 +97,11 @@
</span><span class="cx">
</span><span class="cx"> m_timer.stop();
</span><span class="cx">
</span><del>- m_dispatchSoonList.checkConsistency();
-
</del><span class="cx"> m_dispatchingList.swap(m_dispatchSoonList);
</span><span class="cx"> for (auto& event : m_dispatchingList) {
</span><del>- if (T* sender = event) {
</del><ins>+ if (T* client = event) {
</ins><span class="cx"> event = nullptr;
</span><del>- sender->dispatchPendingEvent(this);
</del><ins>+ client->dispatchPendingEvent(*this);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> m_dispatchingList.clear();
</span></span></pre></div>
<a id="trunkSourceWebCoredomSharedEventSenderscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/SharedEventSenders.cpp (0 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/SharedEventSenders.cpp         (rev 0)
+++ trunk/Source/WebCore/dom/SharedEventSenders.cpp        2014-10-03 17:15:51 UTC (rev 174270)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ * 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
</ins></span></pre></div>
<a id="trunkSourceWebCoredomSharedEventSendersh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/dom/SharedEventSenders.h (0 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/SharedEventSenders.h         (rev 0)
+++ trunk/Source/WebCore/dom/SharedEventSenders.h        2014-10-03 17:15:51 UTC (rev 174270)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * 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
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "DocumentStyleSheetCollection.h"
</span><span class="cx"> #include "Event.h"
</span><del>-#include "EventSender.h"
</del><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameLoader.h"
</span><span class="cx"> #include "FrameLoaderClient.h"
</span><span class="lines">@@ -47,6 +46,7 @@
</span><span class="cx"> #include "RenderStyle.h"
</span><span class="cx"> #include "SecurityOrigin.h"
</span><span class="cx"> #include "Settings.h"
</span><ins>+#include "SharedEventSenders.h"
</ins><span class="cx"> #include "StyleInheritedData.h"
</span><span class="cx"> #include "StyleResolveForDocument.h"
</span><span class="cx"> #include "StyleSheetContents.h"
</span><span class="lines">@@ -57,12 +57,6 @@
</span><span class="cx">
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx">
</span><del>-static LinkEventSender& linkLoadEventSender()
-{
- DEPRECATED_DEFINE_STATIC_LOCAL(LinkEventSender, sharedLoadEventSender, (eventNames().loadEvent));
- return sharedLoadEventSender;
-}
-
</del><span class="cx"> inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document& document, bool createdByParser)
</span><span class="cx"> : HTMLElement(tagName, document)
</span><span class="cx"> , m_linkLoader(this)
</span><span class="lines">@@ -94,7 +88,7 @@
</span><span class="cx"> if (inDocument())
</span><span class="cx"> document().styleSheetCollection().removeStyleSheetCandidateNode(*this);
</span><span class="cx">
</span><del>- linkLoadEventSender().cancelEvent(*this);
</del><ins>+ document().sharedEventSenders().linkLoadEventSender().cancelEvent(*this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void HTMLLinkElement::setDisabledState(bool disabled)
</span><span class="lines">@@ -361,14 +355,10 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void HTMLLinkElement::dispatchPendingLoadEvents()
</del><ins>+void HTMLLinkElement::dispatchPendingEvent(EventSender<HTMLLinkElement>& eventSender)
</ins><span class="cx"> {
</span><del>- linkLoadEventSender().dispatchPendingEvents();
-}
</del><ins>+ ASSERT_UNUSED(eventSender, &eventSender == &document().sharedEventSenders().linkLoadEventSender());
</ins><span class="cx">
</span><del>-void HTMLLinkElement::dispatchPendingEvent(LinkEventSender* eventSender)
-{
- ASSERT_UNUSED(eventSender, eventSender == &linkLoadEventSender());
</del><span class="cx"> if (m_loadedSheet)
</span><span class="cx"> linkLoaded();
</span><span class="cx"> else
</span><span class="lines">@@ -380,7 +370,7 @@
</span><span class="cx"> if (m_firedLoad)
</span><span class="cx"> return;
</span><span class="cx"> m_loadedSheet = !errorOccurred;
</span><del>- linkLoadEventSender().dispatchEventSoon(*this);
</del><ins>+ document().sharedEventSenders().linkLoadEventSender().dispatchEventSoon(*this);
</ins><span class="cx"> m_firedLoad = true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.h (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -40,7 +40,6 @@
</span><span class="cx"> class URL;
</span><span class="cx">
</span><span class="cx"> template<typename T> class EventSender;
</span><del>-typedef EventSender<HTMLLinkElement> LinkEventSender;
</del><span class="cx">
</span><span class="cx"> class HTMLLinkElement final : public HTMLElement, public CachedStyleSheetClient, public LinkLoaderClient {
</span><span class="cx"> public:
</span><span class="lines">@@ -68,8 +67,7 @@
</span><span class="cx"> void setSizes(const String&);
</span><span class="cx"> DOMSettableTokenList* sizes() const;
</span><span class="cx">
</span><del>- void dispatchPendingEvent(LinkEventSender*);
- static void dispatchPendingLoadEvents();
</del><ins>+ void dispatchPendingEvent(EventSender<HTMLLinkElement>&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLStyleElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLStyleElement.cpp (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -27,23 +27,18 @@
</span><span class="cx"> #include "Attribute.h"
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "Event.h"
</span><del>-#include "EventSender.h"
</del><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "MediaList.h"
</span><span class="cx"> #include "RuntimeEnabledFeatures.h"
</span><span class="cx"> #include "ScriptableDocumentParser.h"
</span><span class="cx"> #include "ShadowRoot.h"
</span><ins>+#include "SharedEventSenders.h"
</ins><span class="cx"> #include "StyleSheetContents.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx">
</span><del>-static StyleEventSender& styleLoadEventSender()
-{
- DEPRECATED_DEFINE_STATIC_LOCAL(StyleEventSender, sharedLoadEventSender, (eventNames().loadEvent));
- return sharedLoadEventSender;
-}
</del><span class="cx">
</span><span class="cx"> inline HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document& document, bool createdByParser)
</span><span class="cx"> : HTMLElement(tagName, document)
</span><span class="lines">@@ -60,7 +55,7 @@
</span><span class="cx"> // Therefore we can't ASSERT(m_scopedStyleRegistrationState == NotRegistered).
</span><span class="cx"> m_styleSheetOwner.clearDocumentData(document(), *this);
</span><span class="cx">
</span><del>- styleLoadEventSender().cancelEvent(*this);
</del><ins>+ document().sharedEventSenders().styleLoadEventSender().cancelEvent(*this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagName, Document& document, bool createdByParser)
</span><span class="lines">@@ -114,14 +109,10 @@
</span><span class="cx"> m_styleSheetOwner.childrenChanged(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void HTMLStyleElement::dispatchPendingLoadEvents()
</del><ins>+void HTMLStyleElement::dispatchPendingEvent(EventSender<HTMLStyleElement>& eventSender)
</ins><span class="cx"> {
</span><del>- styleLoadEventSender().dispatchPendingEvents();
-}
</del><ins>+ ASSERT_UNUSED(eventSender, &eventSender == &document().sharedEventSenders().styleLoadEventSender());
</ins><span class="cx">
</span><del>-void HTMLStyleElement::dispatchPendingEvent(StyleEventSender* eventSender)
-{
- ASSERT_UNUSED(eventSender, eventSender == &styleLoadEventSender());
</del><span class="cx"> if (m_loadedSheet)
</span><span class="cx"> dispatchEvent(Event::create(eventNames().loadEvent, false, false));
</span><span class="cx"> else
</span><span class="lines">@@ -133,7 +124,7 @@
</span><span class="cx"> if (m_firedLoad)
</span><span class="cx"> return;
</span><span class="cx"> m_loadedSheet = !errorOccurred;
</span><del>- styleLoadEventSender().dispatchEventSoon(*this);
</del><ins>+ document().sharedEventSenders().styleLoadEventSender().dispatchEventSoon(*this);
</ins><span class="cx"> m_firedLoad = true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLStyleElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLStyleElement.h (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> class StyleSheet;
</span><span class="cx">
</span><span class="cx"> template<typename T> class EventSender;
</span><del>-typedef EventSender<HTMLStyleElement> StyleEventSender;
</del><span class="cx">
</span><span class="cx"> class HTMLStyleElement final : public HTMLElement {
</span><span class="cx"> public:
</span><span class="lines">@@ -44,8 +43,7 @@
</span><span class="cx"> bool disabled() const;
</span><span class="cx"> void setDisabled(bool);
</span><span class="cx">
</span><del>- void dispatchPendingEvent(StyleEventSender*);
- static void dispatchPendingLoadEvents();
</del><ins>+ void dispatchPendingEvent(EventSender<HTMLStyleElement>&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> HTMLStyleElement(const QualifiedName&, Document&, bool createdByParser);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderImageLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ImageLoader.cpp (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "Element.h"
</span><span class="cx"> #include "Event.h"
</span><del>-#include "EventSender.h"
</del><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "HTMLObjectElement.h"
</span><span class="lines">@@ -38,6 +37,7 @@
</span><span class="cx"> #include "RenderImage.h"
</span><span class="cx"> #include "RenderSVGImage.h"
</span><span class="cx"> #include "SecurityOrigin.h"
</span><ins>+#include "SharedEventSenders.h"
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span><span class="lines">@@ -63,22 +63,19 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-static ImageEventSender& beforeLoadEventSender()
</del><ins>+EventSender<ImageLoader>& ImageLoader::beforeLoadEventSender() const
</ins><span class="cx"> {
</span><del>- static NeverDestroyed<ImageEventSender> sender(eventNames().beforeloadEvent);
- return sender;
</del><ins>+ return m_element.document().sharedEventSenders().imageBeforeloadEventSender();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static ImageEventSender& loadEventSender()
</del><ins>+EventSender<ImageLoader>& ImageLoader::loadEventSender() const
</ins><span class="cx"> {
</span><del>- static NeverDestroyed<ImageEventSender> sender(eventNames().loadEvent);
- return sender;
</del><ins>+ return m_element.document().sharedEventSenders().imageLoadEventSender();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static ImageEventSender& errorEventSender()
</del><ins>+EventSender<ImageLoader>& ImageLoader::errorEventSender() const
</ins><span class="cx"> {
</span><del>- static NeverDestroyed<ImageEventSender> sender(eventNames().errorEvent);
- return sender;
</del><ins>+ return m_element.document().sharedEventSenders().imageErrorEventSender();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline bool pageIsBeingDismissed(Document& document)
</span><span class="lines">@@ -379,10 +376,10 @@
</span><span class="cx"> element().deref();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ImageLoader::dispatchPendingEvent(ImageEventSender* eventSender)
</del><ins>+void ImageLoader::dispatchPendingEvent(EventSender<ImageLoader>& eventSender)
</ins><span class="cx"> {
</span><del>- ASSERT(eventSender == &beforeLoadEventSender() || eventSender == &loadEventSender() || eventSender == &errorEventSender());
- const AtomicString& eventType = eventSender->eventType();
</del><ins>+ ASSERT(&eventSender == &beforeLoadEventSender() || &eventSender == &loadEventSender() || &eventSender == &errorEventSender());
+ const AtomicString& eventType = eventSender.eventType();
</ins><span class="cx"> if (eventType == eventNames().beforeloadEvent)
</span><span class="cx"> dispatchPendingBeforeLoadEvent();
</span><span class="cx"> if (eventType == eventNames().loadEvent)
</span><span class="lines">@@ -448,21 +445,6 @@
</span><span class="cx"> updatedHasPendingEvent();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ImageLoader::dispatchPendingBeforeLoadEvents()
-{
- beforeLoadEventSender().dispatchPendingEvents();
-}
-
-void ImageLoader::dispatchPendingLoadEvents()
-{
- loadEventSender().dispatchPendingEvents();
-}
-
-void ImageLoader::dispatchPendingErrorEvents()
-{
- errorEventSender().dispatchPendingEvents();
-}
-
</del><span class="cx"> void ImageLoader::elementDidMoveToNewDocument()
</span><span class="cx"> {
</span><span class="cx"> clearFailedLoadURL();
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderImageLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ImageLoader.h (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -35,7 +35,6 @@
</span><span class="cx"> class RenderImageResource;
</span><span class="cx">
</span><span class="cx"> template<typename T> class EventSender;
</span><del>-typedef EventSender<ImageLoader> ImageEventSender;
</del><span class="cx">
</span><span class="cx"> class ImageLoader : public CachedImageClient {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="lines">@@ -65,11 +64,11 @@
</span><span class="cx"> bool hasPendingBeforeLoadEvent() const { return m_hasPendingBeforeLoadEvent; }
</span><span class="cx"> bool hasPendingActivity() const { return m_hasPendingLoadEvent || m_hasPendingErrorEvent; }
</span><span class="cx">
</span><del>- void dispatchPendingEvent(ImageEventSender*);
</del><ins>+ void dispatchPendingEvent(EventSender<ImageLoader>&);
</ins><span class="cx">
</span><del>- static void dispatchPendingBeforeLoadEvents();
- static void dispatchPendingLoadEvents();
- static void dispatchPendingErrorEvents();
</del><ins>+ EventSender<ImageLoader>& beforeLoadEventSender() const;
+ EventSender<ImageLoader>& loadEventSender() const;
+ EventSender<ImageLoader>& errorEventSender() const;
</ins><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> explicit ImageLoader(Element&);
</span></span></pre></div>
<a id="trunkSourceWebCorexmlparserXMLDocumentParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (174269 => 174270)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -120,9 +120,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> doWrite(source.toString());
</span><del>-
- // After parsing, go ahead and dispatch image beforeload events.
- ImageLoader::dispatchPendingBeforeLoadEvents();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* m, TextPosition position)
</span></span></pre>
</div>
</div>
</body>
</html>