Bug 141803

Summary: [WK2] Add more detailed diagnostic logging for measuring network cache efficacy
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, commit-queue, koivisto
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Dumez 2015-02-19 12:12:16 PST
Add more detailed diagnostic logging for measuring network cache efficacy.

We want to know the reason the network cache is being by-passed, why the network cache decided not to cache a response and why it cannot reuse a cache entry.

Radar: <rdar://problem/19632080>
Comment 1 Chris Dumez 2015-02-19 12:30:11 PST
Created attachment 246907 [details]
Patch
Comment 2 Antti Koivisto 2015-02-20 11:05:40 PST
Comment on attachment 246907 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=246907&action=review

> Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp:202
> +static bool canRetrieve(const WebCore::ResourceRequest& request, CacheBypassReason& reason)

Having both the bool return and the reason seems redundant. Why not just make this return a singe RetrieveDecision enum (or similar) that covers both the success and the failure cases?

Same comment for canStore.
Comment 3 Antti Koivisto 2015-02-20 11:34:10 PST
Comment on attachment 246907 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=246907&action=review

> Source/WebKit2/NetworkProcess/cache/NetworkCacheStatistics.h:63
> +enum class CacheBypassReason {
> +    None,
> +    NotHTTPFamily,
> +    UnsupportedHTTPMethod,
> +    IsConditionalRequest,
> +    IsReloadIgnoringCacheData
> +};
> +
> +enum class CacheStorageFailure {
> +    None,
> +    NotHTTPFamily,
> +    UnsupportedHTTPMethod,
> +    IsAttachment,
> +    CacheControlNoStore,
> +    UncacheableHTTPStatusCode
> +};
> +
> +enum class CachedEntryReuseFailure {
> +    None,
> +    VaryingHeaderMismatch,
> +    MissingValidatorFields,
> +    Other,
> +};

I think these should then move to NetworkCache scope.
Comment 4 Chris Dumez 2015-02-20 13:24:40 PST
Created attachment 246993 [details]
Patch
Comment 5 Antti Koivisto 2015-02-20 13:40:36 PST
Comment on attachment 246993 [details]
Patch

r=me
Comment 6 WebKit Commit Bot 2015-02-20 14:26:04 PST
Comment on attachment 246993 [details]
Patch

Clearing flags on attachment: 246993

Committed r180456: <http://trac.webkit.org/changeset/180456>
Comment 7 WebKit Commit Bot 2015-02-20 14:26:09 PST
All reviewed patches have been landed.  Closing bug.