Changeset 211288 in webkit
- Timestamp:
- Jan 27, 2017 10:44:18 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r211284 r211288 1 2017-01-27 Antti Koivisto <antti@apple.com> 2 3 Implement Cache-control: immutable 4 https://bugs.webkit.org/show_bug.cgi?id=167497 5 6 Reviewed by Chris Dumez. 7 8 * http/tests/cache/cache-control-immutable-http-expected.txt: Added. 9 * http/tests/cache/cache-control-immutable-http.html: Added. 10 * http/tests/cache/cache-control-immutable-https-expected.txt: Added. 11 * http/tests/cache/cache-control-immutable-https.html: Added. 12 * http/tests/cache/resources/cache-control-immutable.js: Added. 13 * http/tests/cache/resources/iframe-with-script.cgi: Added. 14 1 15 2017-01-26 Ryan Haddad <ryanhaddad@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r211286 r211288 1 2017-01-27 Antti Koivisto <antti@apple.com> 2 3 Implement Cache-control: immutable 4 https://bugs.webkit.org/show_bug.cgi?id=167497 5 6 Reviewed by Chris Dumez. 7 8 Cache-control value 'immutable' indicates that a subresource does not change and so does not need to be 9 revalidated on a normal reload. This can significantly speed up reloads and reduce network traffic. 10 11 It is has been implemented in Firefox and is already used by Facebook. 12 13 https://tools.ietf.org/html/draft-mcmanus-immutable-00 14 https://hacks.mozilla.org/2017/01/using-immutable-caching-to-speed-up-the-web/ 15 16 This patch implements Cache-control: immutable for memory cache only. A disk cache implementation 17 doesn't seem necessary as the resource is basically always expected to be in memory cache on reload. 18 19 Immutable is only supported for https as suggested by the draft specification (and Gecko implementation). 20 21 Test: http/tests/cache/cache-control-immutable-http.html 22 http/tests/cache/cache-control-immutable-https.html 23 24 * loader/cache/CachedResource.cpp: 25 (WebCore::CachedResource::makeRevalidationDecision): 26 27 On normal reloads (CachePolicyRevalidate) of https resources check for 'Cache-control: immutable'. 28 If the resource is not expired don't revalidate it. 29 30 * platform/network/CacheValidation.cpp: 31 (WebCore::parseCacheControlDirectives): 32 * platform/network/CacheValidation.h: 33 * platform/network/ResourceResponseBase.cpp: 34 (WebCore::ResourceResponseBase::cacheControlContainsImmutable): 35 * platform/network/ResourceResponseBase.h: 36 1 37 2017-01-27 Youenn Fablet <youennf@gmail.com> 2 38 -
trunk/Source/WebCore/loader/cache/CachedResource.cpp
r211248 r211288 749 749 750 750 case CachePolicyReload: 751 return RevalidationDecision::YesDueToCachePolicy; 752 751 753 case CachePolicyRevalidate: 754 if (m_response.cacheControlContainsImmutable() && m_response.url().protocolIs("https")) { 755 if (isExpired()) 756 return RevalidationDecision::YesDueToExpired; 757 return RevalidationDecision::No; 758 } 752 759 return RevalidationDecision::YesDueToCachePolicy; 753 760 -
trunk/Source/WebCore/platform/network/CacheValidation.cpp
r209924 r211288 317 317 if (ok) 318 318 result.maxStale = duration_cast<microseconds>(duration<double>(maxStale)); 319 } 319 } else if (equalLettersIgnoringASCIICase(directives[i].first, "immutable")) 320 result.immutable = true; 320 321 } 321 322 } -
trunk/Source/WebCore/platform/network/CacheValidation.h
r208985 r211288 67 67 bool noStore { false }; 68 68 bool mustRevalidate { false }; 69 bool immutable { false }; 69 70 }; 70 71 WEBCORE_EXPORT CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap&); -
trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp
r209403 r211288 426 426 return m_cacheControlDirectives.mustRevalidate; 427 427 } 428 429 bool ResourceResponseBase::cacheControlContainsImmutable() const 430 { 431 if (!m_haveParsedCacheControlHeader) 432 parseCacheControlDirectives(); 433 return m_cacheControlDirectives.immutable; 434 } 428 435 429 436 bool ResourceResponseBase::hasCacheValidatorFields() const -
trunk/Source/WebCore/platform/network/ResourceResponseBase.h
r210835 r211288 120 120 121 121 // These functions return parsed values of the corresponding response headers. 122 // NaN means that the header was not present or had invalid value.123 122 WEBCORE_EXPORT bool cacheControlContainsNoCache() const; 124 123 WEBCORE_EXPORT bool cacheControlContainsNoStore() const; 125 124 WEBCORE_EXPORT bool cacheControlContainsMustRevalidate() const; 125 WEBCORE_EXPORT bool cacheControlContainsImmutable() const; 126 126 WEBCORE_EXPORT bool hasCacheValidatorFields() const; 127 127 WEBCORE_EXPORT std::optional<std::chrono::microseconds> cacheControlMaxAge() const;
Note: See TracChangeset
for help on using the changeset viewer.