<!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>[207053] 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/207053">207053</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-10 23:42:53 -0700 (Mon, 10 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>CachedResourceRequest constructor should be made more efficient
https://bugs.webkit.org/show_bug.cgi?id=163210
Patch by Youenn Fablet <youenn@apple.com> on 2016-10-10
Reviewed by Alex Christensen.
No change of behavior.
Refactoring to use one CachedResourceRequest constructor that will move its request and charset to improve efficiency.
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::requestStyleSheet):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::checkStyleSheet):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):
* html/parser/HTMLResourcePreloader.cpp:
(WebCore::PreloadRequest::resourceRequest):
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::CachedResourceRequest):
* loader/cache/CachedResourceRequest.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleImportcpp">trunk/Source/WebCore/css/StyleRuleImport.cpp</a></li>
<li><a href="#trunkSourceWebCoredomProcessingInstructioncpp">trunk/Source/WebCore/dom/ProcessingInstruction.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementcpp">trunk/Source/WebCore/html/HTMLLinkElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLResourcePreloadercpp">trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceRequestcpp">trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceRequesth">trunk/Source/WebCore/loader/cache/CachedResourceRequest.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207052 => 207053)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-11 06:39:15 UTC (rev 207052)
+++ trunk/Source/WebCore/ChangeLog        2016-10-11 06:42:53 UTC (rev 207053)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-10-10 Youenn Fablet <youenn@apple.com>
+
+ CachedResourceRequest constructor should be made more efficient
+ https://bugs.webkit.org/show_bug.cgi?id=163210
+
+ Reviewed by Alex Christensen.
+
+ No change of behavior.
+
+ Refactoring to use one CachedResourceRequest constructor that will move its request and charset to improve efficiency.
+
+ * css/StyleRuleImport.cpp:
+ (WebCore::StyleRuleImport::requestStyleSheet):
+ * dom/ProcessingInstruction.cpp:
+ (WebCore::ProcessingInstruction::checkStyleSheet):
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::process):
+ * html/parser/HTMLResourcePreloader.cpp:
+ (WebCore::PreloadRequest::resourceRequest):
+ * loader/cache/CachedResourceRequest.cpp:
+ (WebCore::CachedResourceRequest::CachedResourceRequest):
+ * loader/cache/CachedResourceRequest.h:
+
</ins><span class="cx"> 2016-10-10 Adam Bergkvist <adam.bergkvist@ericsson.com> and Alejandro G. Castro <alex@igalia.com>
</span><span class="cx">
</span><span class="cx"> WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleImportcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRuleImport.cpp (207052 => 207053)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRuleImport.cpp        2016-10-11 06:39:15 UTC (rev 207052)
+++ trunk/Source/WebCore/css/StyleRuleImport.cpp        2016-10-11 06:42:53 UTC (rev 207053)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">
</span><span class="cx"> // FIXME: Skip Content Security Policy check when stylesheet is in a user agent shadow tree.
</span><span class="cx"> // See <https://bugs.webkit.org/show_bug.cgi?id=146663>.
</span><del>- CachedResourceRequest request(ResourceRequest(absURL), m_parentStyleSheet->charset());
</del><ins>+ CachedResourceRequest request(absURL, CachedResourceLoader::defaultCachedResourceOptions(), Nullopt, String(m_parentStyleSheet->charset()));
</ins><span class="cx"> request.setInitiator(cachedResourceRequestInitiators().css);
</span><span class="cx"> if (m_cachedSheet)
</span><span class="cx"> m_cachedSheet->removeClient(m_styleSheetClient);
</span></span></pre></div>
<a id="trunkSourceWebCoredomProcessingInstructioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ProcessingInstruction.cpp (207052 => 207053)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ProcessingInstruction.cpp        2016-10-11 06:39:15 UTC (rev 207052)
+++ trunk/Source/WebCore/dom/ProcessingInstruction.cpp        2016-10-11 06:42:53 UTC (rev 207053)
</span><span class="lines">@@ -145,11 +145,8 @@
</span><span class="cx"> } else
</span><span class="cx"> #endif
</span><span class="cx"> {
</span><del>- CachedResourceRequest request(ResourceRequest(document().completeURL(href)));
</del><span class="cx"> String charset = attrs.get("charset");
</span><del>- if (charset.isEmpty())
- charset = document().charset();
- request.setCharset(charset);
</del><ins>+ CachedResourceRequest request(document().completeURL(href), CachedResourceLoader::defaultCachedResourceOptions(), Nullopt, charset.isEmpty() ? document().charset() : WTFMove(charset));
</ins><span class="cx">
</span><span class="cx"> m_cachedSheet = document().cachedResourceLoader().requestCSSStyleSheet(WTFMove(request));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (207052 => 207053)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-10-11 06:39:15 UTC (rev 207052)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-10-11 06:42:53 UTC (rev 207053)
</span><span class="lines">@@ -228,7 +228,7 @@
</span><span class="cx"> || (document().settings() && document().settings()->treatsAnyTextCSSLinkAsStylesheet() && m_type.containsIgnoringASCIICase("text/css"));
</span><span class="cx">
</span><span class="cx"> if (m_disabledState != Disabled && treatAsStyleSheet && document().frame() && url.isValid()) {
</span><del>- AtomicString charset = attributeWithoutSynchronization(charsetAttr);
</del><ins>+ String charset = attributeWithoutSynchronization(charsetAttr);
</ins><span class="cx"> if (charset.isEmpty() && document().frame())
</span><span class="cx"> charset = document().charset();
</span><span class="cx">
</span><span class="lines">@@ -261,7 +261,7 @@
</span><span class="cx"> Optional<ResourceLoadPriority> priority;
</span><span class="cx"> if (!isActive)
</span><span class="cx"> priority = ResourceLoadPriority::VeryLow;
</span><del>- CachedResourceRequest request(url, charset, priority);
</del><ins>+ CachedResourceRequest request(url, CachedResourceLoader::defaultCachedResourceOptions(), priority, WTFMove(charset));
</ins><span class="cx"> request.setInitiator(this);
</span><span class="cx">
</span><span class="cx"> if (document().contentSecurityPolicy()->allowStyleWithNonce(attributeWithoutSynchronization(HTMLNames::nonceAttr))) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLResourcePreloadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp (207052 => 207053)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp        2016-10-11 06:39:15 UTC (rev 207052)
+++ trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp        2016-10-11 06:42:53 UTC (rev 207053)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> CachedResourceRequest PreloadRequest::resourceRequest(Document& document)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><del>- CachedResourceRequest request(ResourceRequest(completeURL(document)));
</del><ins>+ CachedResourceRequest request(completeURL(document), CachedResourceLoader::defaultCachedResourceOptions());
</ins><span class="cx"> request.setInitiator(m_initiator);
</span><span class="cx"> request.setAsPotentiallyCrossOrigin(m_crossOriginMode, document);
</span><span class="cx"> return request;
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (207052 => 207053)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp        2016-10-11 06:39:15 UTC (rev 207052)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp        2016-10-11 06:42:53 UTC (rev 207053)
</span><span class="lines">@@ -34,16 +34,9 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-CachedResourceRequest::CachedResourceRequest(const ResourceRequest& resourceRequest, const String& charset, Optional<ResourceLoadPriority> priority)
- : m_resourceRequest(resourceRequest)
- , m_charset(charset)
- , m_options(CachedResourceLoader::defaultCachedResourceOptions())
- , m_priority(priority)
-{
-}
-
-CachedResourceRequest::CachedResourceRequest(ResourceRequest&& resourceRequest, const ResourceLoaderOptions& options, Optional<ResourceLoadPriority> priority)
</del><ins>+CachedResourceRequest::CachedResourceRequest(ResourceRequest&& resourceRequest, const ResourceLoaderOptions& options, Optional<ResourceLoadPriority> priority, String&& charset)
</ins><span class="cx"> : m_resourceRequest(WTFMove(resourceRequest))
</span><ins>+ , m_charset(WTFMove(charset))
</ins><span class="cx"> , m_options(options)
</span><span class="cx"> , m_priority(priority)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.h (207052 => 207053)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.h        2016-10-11 06:39:15 UTC (rev 207052)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.h        2016-10-11 06:42:53 UTC (rev 207053)
</span><span class="lines">@@ -40,8 +40,7 @@
</span><span class="cx">
</span><span class="cx"> class CachedResourceRequest {
</span><span class="cx"> public:
</span><del>- explicit CachedResourceRequest(const ResourceRequest&, const String& charset = String(), Optional<ResourceLoadPriority> = Nullopt);
- CachedResourceRequest(ResourceRequest&&, const ResourceLoaderOptions&, Optional<ResourceLoadPriority> = Nullopt);
</del><ins>+ CachedResourceRequest(ResourceRequest&&, const ResourceLoaderOptions&, Optional<ResourceLoadPriority> = Nullopt, String&& charset = String());
</ins><span class="cx">
</span><span class="cx"> ResourceRequest& mutableResourceRequest() { return m_resourceRequest; }
</span><span class="cx"> const ResourceRequest& resourceRequest() const { return m_resourceRequest; }
</span></span></pre>
</div>
</div>
</body>
</html>