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

Side by Side 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: Removed DCHECK message Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_response_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_HTTP_HTTP_RESPONSE_INFO_H_ 5 #ifndef NET_HTTP_HTTP_RESPONSE_INFO_H_
6 #define NET_HTTP_HTTP_RESPONSE_INFO_H_ 6 #define NET_HTTP_HTTP_RESPONSE_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 28 matching lines...) Expand all
39 CONNECTION_INFO_SPDY3 = 3, 39 CONNECTION_INFO_SPDY3 = 3,
40 CONNECTION_INFO_HTTP2 = 4, // HTTP/2. 40 CONNECTION_INFO_HTTP2 = 4, // HTTP/2.
41 CONNECTION_INFO_QUIC1_SPDY3 = 5, 41 CONNECTION_INFO_QUIC1_SPDY3 = 5,
42 CONNECTION_INFO_HTTP2_14 = 6, // HTTP/2 draft-14. 42 CONNECTION_INFO_HTTP2_14 = 6, // HTTP/2 draft-14.
43 CONNECTION_INFO_HTTP2_15 = 7, // HTTP/2 draft-15. 43 CONNECTION_INFO_HTTP2_15 = 7, // HTTP/2 draft-15.
44 CONNECTION_INFO_HTTP0_9 = 8, 44 CONNECTION_INFO_HTTP0_9 = 8,
45 CONNECTION_INFO_HTTP1_0 = 9, 45 CONNECTION_INFO_HTTP1_0 = 9,
46 NUM_OF_CONNECTION_INFOS, 46 NUM_OF_CONNECTION_INFOS,
47 }; 47 };
48 48
49 // Used for categorizing transactions for reporting in histograms.
50 // CacheEntryStatus covers relatively common use cases being measured and
51 // considered for optimization. Many use cases that are more complex or
52 // uncommon are binned as OTHER, and details are not reported.
53 // NOTE: This enumeration is used in histograms, so please do not add entries
54 // in the middle.
55 enum CacheEntryStatus {
56 ENTRY_UNDEFINED,
57 // Complex or uncommon case. E.g., auth (401), partial responses (206), ...
58 ENTRY_OTHER,
59 // The response was not in the cache. Implies !was_cached &&
60 // network_accessed.
61 ENTRY_NOT_IN_CACHE,
62 // The response was served from the cache and no validation was needed.
63 // Implies was_cached && !network_accessed.
64 ENTRY_USED,
65 // The response was validated and served from the cache. Implies was_cached
66 // && network_accessed.
67 ENTRY_VALIDATED,
68 // There was a stale entry in the cache that was updated. Implies
69 // !was_cached && network_accessed.
70 ENTRY_UPDATED,
71 // The HTTP request didn't allow a conditional request. Implies !was_cached
72 // && network_accessed.
73 ENTRY_CANT_CONDITIONALIZE,
74 ENTRY_MAX,
75 };
76
49 HttpResponseInfo(); 77 HttpResponseInfo();
50 HttpResponseInfo(const HttpResponseInfo& rhs); 78 HttpResponseInfo(const HttpResponseInfo& rhs);
51 ~HttpResponseInfo(); 79 ~HttpResponseInfo();
52 HttpResponseInfo& operator=(const HttpResponseInfo& rhs); 80 HttpResponseInfo& operator=(const HttpResponseInfo& rhs);
53 // Even though we could get away with the copy ctor and default operator=, 81 // Even though we could get away with the copy ctor and default operator=,
54 // that would prevent us from doing a bunch of forward declaration. 82 // that would prevent us from doing a bunch of forward declaration.
55 83
56 // Initializes from the representation stored in the given pickle. 84 // Initializes from the representation stored in the given pickle.
57 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); 85 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated);
58 86
(...skipping 11 matching lines...) Expand all
70 // If this resource was found in the cache, then this bool is set, and 98 // If this resource was found in the cache, then this bool is set, and
71 // request_time may corresponds to a time "far" in the past. Note that 99 // request_time may corresponds to a time "far" in the past. Note that
72 // stale content (perhaps un-cacheable) may be fetched from cache subject to 100 // stale content (perhaps un-cacheable) may be fetched from cache subject to
73 // the load flags specified on the request info. For example, this is done 101 // the load flags specified on the request info. For example, this is done
74 // when a user presses the back button to re-render pages, or at startup, 102 // when a user presses the back button to re-render pages, or at startup,
75 // when reloading previously visited pages (without going over the network). 103 // when reloading previously visited pages (without going over the network).
76 // Note also that under normal circumstances, was_cached is set to the correct 104 // Note also that under normal circumstances, was_cached is set to the correct
77 // value even if the request fails. 105 // value even if the request fails.
78 bool was_cached; 106 bool was_cached;
79 107
108 // How this response was handled by the HTTP cache.
109 CacheEntryStatus cache_entry_status;
110
80 // True if the request was fetched from cache rather than the network 111 // True if the request was fetched from cache rather than the network
81 // because of a LOAD_FROM_CACHE_IF_OFFLINE flag when the system 112 // because of a LOAD_FROM_CACHE_IF_OFFLINE flag when the system
82 // was unable to contact the server. 113 // was unable to contact the server.
83 bool server_data_unavailable; 114 bool server_data_unavailable;
84 115
85 // True if the request accessed the network in the process of retrieving 116 // True if the request accessed the network in the process of retrieving
86 // data. 117 // data.
87 bool network_accessed; 118 bool network_accessed;
88 119
89 // True if the request was fetched over a SPDY channel. 120 // True if the request was fetched over a SPDY channel.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 scoped_refptr<IOBufferWithSize> metadata; 190 scoped_refptr<IOBufferWithSize> metadata;
160 191
161 static ConnectionInfo ConnectionInfoFromNextProto(NextProto next_proto); 192 static ConnectionInfo ConnectionInfoFromNextProto(NextProto next_proto);
162 193
163 static std::string ConnectionInfoToString(ConnectionInfo connection_info); 194 static std::string ConnectionInfoToString(ConnectionInfo connection_info);
164 }; 195 };
165 196
166 } // namespace net 197 } // namespace net
167 198
168 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ 199 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_
OLDNEW
« no previous file with comments | « net/http/http_cache_unittest.cc ('k') | net/http/http_response_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698