RESOLVED FIXED 163332
Make NetworkCache aware of fetch cache mode
https://bugs.webkit.org/show_bug.cgi?id=163332
Summary Make NetworkCache aware of fetch cache mode
youenn fablet
Reported 2016-10-12 08:05:38 PDT
Fetch cache mode handling of MemoryCache is mostly implemented but the same should be done for the NetworkCache.
Attachments
Patch (35.47 KB, patch)
2016-10-12 08:18 PDT, youenn fablet
no flags
Patch (123.26 KB, patch)
2016-10-13 02:56 PDT, youenn fablet
no flags
Patch (122.99 KB, patch)
2016-10-13 04:24 PDT, youenn fablet
no flags
Archive of layout-test-results from ews114 for mac-yosemite (911.98 KB, application/zip)
2016-10-13 05:31 PDT, Build Bot
no flags
Fixing assert and builds (122.33 KB, patch)
2016-10-13 06:00 PDT, youenn fablet
no flags
Patch for landing (122.96 KB, patch)
2016-10-14 00:34 PDT, youenn fablet
no flags
Patch for landing (123.32 KB, patch)
2016-10-14 00:44 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2016-10-12 08:18:01 PDT
WebKit Commit Bot
Comment 2 2016-10-12 08:20:30 PDT
Attachment 291357 [details] did not pass style-queue: ERROR: Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp:312: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/NetworkProcess/cache/NetworkCache.h:109: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 2 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 3 2016-10-12 08:25:36 PDT
(In reply to comment #1) > Created attachment 291357 [details] > Patch I am not exactly sure what is the best option to pass the additional cache mode information from WebCore to NetworkProcess. There seems to be two choices: 1 Pass FetchOptions::Cache information to NetworkProcess 2 Update ResourceRequestCachePolicy to add more modes: NoCache, NoStore and Reload I chose option 1 since it is the simplest. I would prefer option 2: - No need to add code to pass the new parameter - No need to check two different parameters in NetworkCache with slightly different meanings - WK1 could eventually catch up if CF network cache supports these new options. I chose option 1 since I was not sure whether there is a strong requirement to keep the resource request cache policy aligned with CFNetwork cache policy. This patch is pending bug 161310. If that is not possible to go forward with bug 161310, it might be possible to split the test file in several so that the console log issue will not hit all tests.
Antti Koivisto
Comment 4 2016-10-12 11:50:54 PDT
> I chose option 1 since I was not sure whether there is a strong requirement > to keep the resource request cache policy aligned with CFNetwork cache > policy. I think we should consider ResourceRequest/Response as pure WebCore types as opposed to wrappers for CFNetwork types. We shouldn't worry about keeping them aligned.
youenn fablet
Comment 5 2016-10-13 02:56:31 PDT
youenn fablet
Comment 6 2016-10-13 04:24:31 PDT
Build Bot
Comment 7 2016-10-13 05:31:41 PDT
Comment on attachment 291472 [details] Patch Attachment 291472 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2276449 Number of test failures exceeded the failure limit.
Build Bot
Comment 8 2016-10-13 05:31:44 PDT
Created attachment 291473 [details] Archive of layout-test-results from ews114 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-yosemite Platform: Mac OS X 10.10.5
youenn fablet
Comment 9 2016-10-13 06:00:15 PDT
Created attachment 291475 [details] Fixing assert and builds
Antti Koivisto
Comment 10 2016-10-13 08:54:53 PDT
Comment on attachment 291475 [details] Fixing assert and builds View in context: https://bugs.webkit.org/attachment.cgi?id=291475&action=review > Source/WebCore/platform/network/ResourceRequestBase.h:44 > + UseProtocolCachePolicy, // normal load, equivalent to fetch "default" cache mode. > + ReloadIgnoringCacheData, // reload, equivalent to fetch "reload"cache mode. > + ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data, equivalent to fetch "force-cache" cache mode. > + ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache, equivalent to fetch "only-if-cached" cache mode. > + DoNotUseAnyCache, // Bypass the cache entirely, equivalent to fetch "no-store" cache mode. > + RefreshAnyCacheData, // Serve cache data only if revalidated, equivalent to fetch "no-cache" mode. In future it would be good to also improve the existing names so they would require fewer comments to understand. The old names are straight from CFNetwork. > Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp:176 > +static inline CFURLRequestCachePolicy toPlatformRequestCachePolicy(ResourceRequestCachePolicy policy) > +{ > + return (CFURLRequestCachePolicy)((policy <= ReturnCacheDataDontLoad) ? policy : ReloadIgnoringCacheData); > +} At least it this should use static_cast but it would really be more understandable with a switch. > Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:69 > + m_cachePolicy = (ResourceRequestCachePolicy)[m_nsRequest.get() cachePolicy]; Please use static_cast or better yet, add a conversion function. > Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:120 > > +static inline NSURLRequestCachePolicy toPlatformRequestCachePolicy(ResourceRequestCachePolicy policy) > +{ > + return (NSURLRequestCachePolicy)((policy <= ReturnCacheDataDontLoad) ? policy : ReloadIgnoringCacheData); > +} Same comment as above.
youenn fablet
Comment 11 2016-10-14 00:34:10 PDT
Created attachment 291583 [details] Patch for landing
youenn fablet
Comment 12 2016-10-14 00:37:09 PDT
Thanks for the review. (In reply to comment #10) > Comment on attachment 291475 [details] > Fixing assert and builds > > View in context: > https://bugs.webkit.org/attachment.cgi?id=291475&action=review > > > Source/WebCore/platform/network/ResourceRequestBase.h:44 > > + UseProtocolCachePolicy, // normal load, equivalent to fetch "default" cache mode. > > + ReloadIgnoringCacheData, // reload, equivalent to fetch "reload"cache mode. > > + ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data, equivalent to fetch "force-cache" cache mode. > > + ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache, equivalent to fetch "only-if-cached" cache mode. > > + DoNotUseAnyCache, // Bypass the cache entirely, equivalent to fetch "no-store" cache mode. > > + RefreshAnyCacheData, // Serve cache data only if revalidated, equivalent to fetch "no-cache" mode. > > In future it would be good to also improve the existing names so they would > require fewer comments to understand. The old names are straight from > CFNetwork. Agreed. > > Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp:176 > > +static inline CFURLRequestCachePolicy toPlatformRequestCachePolicy(ResourceRequestCachePolicy policy) > > +{ > > + return (CFURLRequestCachePolicy)((policy <= ReturnCacheDataDontLoad) ? policy : ReloadIgnoringCacheData); > > +} > > At least it this should use static_cast but it would really be more > understandable with a switch. Updated to use a switch > > Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:69 > > + m_cachePolicy = (ResourceRequestCachePolicy)[m_nsRequest.get() cachePolicy]; > > Please use static_cast or better yet, add a conversion function. Forgot this one in the landing patch... Will add it. > > Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm:120 > > > > +static inline NSURLRequestCachePolicy toPlatformRequestCachePolicy(ResourceRequestCachePolicy policy) > > +{ > > + return (NSURLRequestCachePolicy)((policy <= ReturnCacheDataDontLoad) ? policy : ReloadIgnoringCacheData); > > +} > > Same comment as above. Updated to use a switch.
youenn fablet
Comment 13 2016-10-14 00:44:24 PDT
Created attachment 291586 [details] Patch for landing
WebKit Commit Bot
Comment 14 2016-10-14 01:49:55 PDT
Comment on attachment 291586 [details] Patch for landing Clearing flags on attachment: 291586 Committed r207330: <http://trac.webkit.org/changeset/207330>
WebKit Commit Bot
Comment 15 2016-10-14 01:50:00 PDT
All reviewed patches have been landed. Closing bug.
Csaba Osztrogonác
Comment 16 2016-10-14 03:29:03 PDT
(In reply to comment #14) > Comment on attachment 291586 [details] > Patch for landing > > Clearing flags on attachment: 291586 > > Committed r207330: <http://trac.webkit.org/changeset/207330> It broke the Apple Windows build, see build.webkit.org for details.
youenn fablet
Comment 17 2016-10-14 03:39:48 PDT
(In reply to comment #16) > (In reply to comment #14) > > Comment on attachment 291586 [details] > > Patch for landing > > > > Clearing flags on attachment: 291586 > > > > Committed r207330: <http://trac.webkit.org/changeset/207330> > > It broke the Apple Windows build, see build.webkit.org for details. Thanks, I will check this!
Alex Christensen
Comment 18 2017-07-06 11:51:01 PDT
Note You need to log in before you can comment on or make changes to this bug.