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

Unified Diff: Source/core/html/parser/HTMLPreloadScanner.cpp

Issue 514893002: Lower priority of async scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleaned up a few stray member variables Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | Source/core/html/parser/HTMLResourcePreloader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLPreloadScanner.cpp
diff --git a/Source/core/html/parser/HTMLPreloadScanner.cpp b/Source/core/html/parser/HTMLPreloadScanner.cpp
index 1b21bc89b4408a9bbe189b2d614297b7651b7a3c..351484f93700fd21f533d62844d974acb262a155 100644
--- a/Source/core/html/parser/HTMLPreloadScanner.cpp
+++ b/Source/core/html/parser/HTMLPreloadScanner.cpp
@@ -111,6 +111,7 @@ public:
, m_sourceSize(0)
, m_sourceSizeSet(false)
, m_isCORSEnabled(false)
+ , m_defer(FetchRequest::NoDefer)
, m_allowCredentials(DoNotAllowStoredCredentials)
, m_mediaValues(mediaValues)
{
@@ -170,6 +171,7 @@ public:
if (isCORSEnabled())
request->setCrossOriginEnabled(allowStoredCredentials());
request->setCharset(charset());
+ request->setDefer(m_defer);
return request.release();
}
@@ -182,6 +184,10 @@ private:
setUrlToLoad(attributeValue, DisallowURLReplacement);
else if (match(attributeName, crossoriginAttr))
setCrossOriginAllowed(attributeValue);
+ else if (match(attributeName, asyncAttr))
+ setDefer(FetchRequest::LazyLoad);
+ else if (match(attributeName, deferAttr))
+ setDefer(FetchRequest::LazyLoad);
}
template<typename NameType>
@@ -337,6 +343,16 @@ private:
m_allowCredentials = DoNotAllowStoredCredentials;
}
+ void setDefer(FetchRequest::DeferOption defer)
+ {
+ m_defer = defer;
+ }
+
+ bool defer() const
+ {
+ return m_defer;
+ }
+
const StringImpl* m_tagImpl;
String m_urlToLoad;
ImageCandidate m_srcsetImageCandidate;
@@ -349,6 +365,7 @@ private:
unsigned m_sourceSize;
bool m_sourceSizeSet;
bool m_isCORSEnabled;
+ FetchRequest::DeferOption m_defer;
StoredCredentials m_allowCredentials;
RefPtr<MediaValues> m_mediaValues;
};
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | Source/core/html/parser/HTMLResourcePreloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698