Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 26 matching lines...) Expand all Loading... | |
| 37 CONNECTION_INFO_HTTP1 = 1, | 37 CONNECTION_INFO_HTTP1 = 1, |
| 38 CONNECTION_INFO_DEPRECATED_SPDY2 = 2, | 38 CONNECTION_INFO_DEPRECATED_SPDY2 = 2, |
| 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 NUM_OF_CONNECTION_INFOS, | 44 NUM_OF_CONNECTION_INFOS, |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // Used for categorizing transactions for reporting in histograms. | |
| 48 // CacheEntryStatus covers relatively common use cases being measured and | |
| 49 // considered for optimization. Many use cases that are more complex or | |
| 50 // uncommon are binned as OTHER, and details are not reported. | |
| 51 // NOTE: This enumeration is used in histograms, so please do not add entries | |
| 52 // in the middle. | |
| 53 enum CacheEntryStatus { | |
| 54 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_
| |
| 55 // Complex or uncommon case (e.g., partial responses - 206). | |
| 56 OTHER, | |
| 57 // The response was not in the cache. Implies !was_cached && | |
| 58 // network_accessed. | |
| 59 NOT_IN_CACHE, | |
| 60 // The response was served from the cache and no validation was needed. | |
| 61 // Implies was_cached && !network_accessed. | |
| 62 USED, | |
| 63 // The response was validated and served from the cache. Implies was_cached | |
| 64 // && network_accessed. | |
| 65 VALIDATED, | |
| 66 // There was a stale entry in the cache that was updated. Implies | |
| 67 // !was_cached && network_accessed. | |
| 68 UPDATED, | |
| 69 // The HTTP request didn't allow a conditional request. Implies !was_cached | |
| 70 // && network_accessed. | |
| 71 CANT_CONDITIONALIZE, | |
| 72 MAX, | |
| 73 }; | |
| 74 | |
| 47 HttpResponseInfo(); | 75 HttpResponseInfo(); |
| 48 HttpResponseInfo(const HttpResponseInfo& rhs); | 76 HttpResponseInfo(const HttpResponseInfo& rhs); |
| 49 ~HttpResponseInfo(); | 77 ~HttpResponseInfo(); |
| 50 HttpResponseInfo& operator=(const HttpResponseInfo& rhs); | 78 HttpResponseInfo& operator=(const HttpResponseInfo& rhs); |
| 51 // Even though we could get away with the copy ctor and default operator=, | 79 // Even though we could get away with the copy ctor and default operator=, |
| 52 // that would prevent us from doing a bunch of forward declaration. | 80 // that would prevent us from doing a bunch of forward declaration. |
| 53 | 81 |
| 54 // Initializes from the representation stored in the given pickle. | 82 // Initializes from the representation stored in the given pickle. |
| 55 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); | 83 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); |
| 56 | 84 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 68 // If this resource was found in the cache, then this bool is set, and | 96 // If this resource was found in the cache, then this bool is set, and |
| 69 // request_time may corresponds to a time "far" in the past. Note that | 97 // request_time may corresponds to a time "far" in the past. Note that |
| 70 // stale content (perhaps un-cacheable) may be fetched from cache subject to | 98 // stale content (perhaps un-cacheable) may be fetched from cache subject to |
| 71 // the load flags specified on the request info. For example, this is done | 99 // the load flags specified on the request info. For example, this is done |
| 72 // when a user presses the back button to re-render pages, or at startup, | 100 // when a user presses the back button to re-render pages, or at startup, |
| 73 // when reloading previously visited pages (without going over the network). | 101 // when reloading previously visited pages (without going over the network). |
| 74 // Note also that under normal circumstances, was_cached is set to the correct | 102 // Note also that under normal circumstances, was_cached is set to the correct |
| 75 // value even if the request fails. | 103 // value even if the request fails. |
| 76 bool was_cached; | 104 bool was_cached; |
| 77 | 105 |
| 106 // How this response was handled by the HTTP cache. | |
| 107 CacheEntryStatus cache_entry_status; | |
| 108 | |
| 78 // True if the request was fetched from cache rather than the network | 109 // True if the request was fetched from cache rather than the network |
| 79 // because of a LOAD_FROM_CACHE_IF_OFFLINE flag when the system | 110 // because of a LOAD_FROM_CACHE_IF_OFFLINE flag when the system |
| 80 // was unable to contact the server. | 111 // was unable to contact the server. |
| 81 bool server_data_unavailable; | 112 bool server_data_unavailable; |
| 82 | 113 |
| 83 // True if the request accessed the network in the process of retrieving | 114 // True if the request accessed the network in the process of retrieving |
| 84 // data. | 115 // data. |
| 85 bool network_accessed; | 116 bool network_accessed; |
| 86 | 117 |
| 87 // True if the request was fetched over a SPDY channel. | 118 // True if the request was fetched over a SPDY channel. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 scoped_refptr<IOBufferWithSize> metadata; | 188 scoped_refptr<IOBufferWithSize> metadata; |
| 158 | 189 |
| 159 static ConnectionInfo ConnectionInfoFromNextProto(NextProto next_proto); | 190 static ConnectionInfo ConnectionInfoFromNextProto(NextProto next_proto); |
| 160 | 191 |
| 161 static std::string ConnectionInfoToString(ConnectionInfo connection_info); | 192 static std::string ConnectionInfoToString(ConnectionInfo connection_info); |
| 162 }; | 193 }; |
| 163 | 194 |
| 164 } // namespace net | 195 } // namespace net |
| 165 | 196 |
| 166 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ | 197 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ |
| OLD | NEW |