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

Unified Diff: net/http/http_response_info.h

Issue 2113603003: Exposing CacheEntryStatus (former TransactionPattern) via UrlRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A bit of cleanup and more doc Created 4 years, 5 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
Index: net/http/http_response_info.h
diff --git a/net/http/http_response_info.h b/net/http/http_response_info.h
index 2dce1a1de07c9577c835cfcb8b2f2ca7bbf3e5c9..eb90012fe5053b8642b88487334e924ac18df8e5 100644
--- a/net/http/http_response_info.h
+++ b/net/http/http_response_info.h
@@ -44,6 +44,34 @@ class NET_EXPORT HttpResponseInfo {
NUM_OF_CONNECTION_INFOS,
};
+ // Used for categorizing transactions for reporting in histograms.
+ // CacheEntryStatus covers relatively common use cases being measured and
+ // considered for optimization. Many use cases that are more complex or
+ // uncommon are binned as OTHER, and details are not reported.
+ // NOTE: This enumeration is used in histograms, so please do not add entries
+ // in the middle.
+ enum CacheEntryStatus {
+ UNDEFINED,
jkarlin 2016/07/06 17:09:41 Please prefix the names with ENTRY_ e.g., ENTRY_U
jamartin 2016/07/07 21:36:38 Done. Why? if I may ask. I considered the ENTRY_
+ // Complex or uncommon case (e.g., partial responses - 206).
+ OTHER,
+ // The response was not in the cache. Implies !was_cached &&
+ // network_accessed.
+ NOT_IN_CACHE,
+ // The response was served from the cache and no validation was needed.
+ // Implies was_cached && !network_accessed.
+ USED,
+ // The response was validated and served from the cache. Implies was_cached
+ // && network_accessed.
+ VALIDATED,
+ // There was a stale entry in the cache that was updated. Implies
+ // !was_cached && network_accessed.
+ UPDATED,
+ // The HTTP request didn't allow a conditional request. Implies !was_cached
+ // && network_accessed.
+ CANT_CONDITIONALIZE,
+ MAX,
+ };
+
HttpResponseInfo();
HttpResponseInfo(const HttpResponseInfo& rhs);
~HttpResponseInfo();
@@ -75,6 +103,9 @@ class NET_EXPORT HttpResponseInfo {
// value even if the request fails.
bool was_cached;
+ // How this response was handled by the HTTP cache.
+ CacheEntryStatus cache_entry_status;
+
// True if the request was fetched from cache rather than the network
// because of a LOAD_FROM_CACHE_IF_OFFLINE flag when the system
// was unable to contact the server.

Powered by Google App Engine
This is Rietveld 408576698