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

Unified Diff: Source/core/loader/FrameFetchContext.cpp

Issue 1078633003: Added preloader support for sizes based RW values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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/html/parser/HTMLResourcePreloader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameFetchContext.cpp
diff --git a/Source/core/loader/FrameFetchContext.cpp b/Source/core/loader/FrameFetchContext.cpp
index 69775e99db5a706201e2c1385c9cafd9967bedcb..7f83f97bf57f12b5cfcc857c3d10fe667adf733e 100644
--- a/Source/core/loader/FrameFetchContext.cpp
+++ b/Source/core/loader/FrameFetchContext.cpp
@@ -666,9 +666,12 @@ void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest)
if (frame()->shouldSendDPRHint())
fetchRequest.mutableResourceRequest().addHTTPHeaderField("DPR", AtomicString(String::number(m_document->devicePixelRatio())));
- // FIXME: Send the RW hint based on the actual resource width, when we have it.
- if (frame()->shouldSendRWHint() && frame()->view())
- fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicString(String::number(frame()->view()->viewportWidth())));
+ if (frame()->shouldSendRWHint() && frame()->view()) {
+ int resourceWidth = fetchRequest.resourceWidth();
+ if (resourceWidth < 0)
Mike West 2015/04/09 11:42:48 Can resourceWidth reasonably be 0? It would be nic
+ resourceWidth = frame()->view()->viewportWidth();
+ fetchRequest.mutableResourceRequest().addHTTPHeaderField("RW", AtomicString(String::number(resourceWidth)));
+ }
}
void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchRequest& fetchRequest)
« no previous file with comments | « Source/core/html/parser/HTMLResourcePreloader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698