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 // CacheInfo covers relatively common use cases being measured and considered | |
| 49 // for optimization. Many use cases that are more complex or uncommon are | |
| 50 // binned as NOT_COVERED, 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 CacheInfo { | |
|
jkarlin
2016/06/30 19:01:12
CacheInfo is vague. How about CacheEntryStatus?
jamartin
2016/07/04 17:12:26
Done.
| |
| 54 UNDEFINED, | |
| 55 // Complex or uncommon case. | |
| 56 NOT_COVERED, | |
| 57 // The response was not in the cache. | |
| 58 ENTRY_NOT_CACHED, | |
| 59 // The response was served from the cache. Implies was_cached. | |
| 60 ENTRY_USED, | |
| 61 // The response was validated and served from the cache. Implies was_cached | |
| 62 // and network_accessed. | |
| 63 ENTRY_VALIDATED, | |
| 64 // There was a stale entry in the cache that was updated. | |
| 65 ENTRY_UPDATED, | |
| 66 // The HTTP request didn't allow a conditional request. | |
| 67 ENTRY_CANT_CONDITIONALIZE, | |
| 68 MAX, | |
| 69 }; | |
| 70 | |
| 47 HttpResponseInfo(); | 71 HttpResponseInfo(); |
| 48 HttpResponseInfo(const HttpResponseInfo& rhs); | 72 HttpResponseInfo(const HttpResponseInfo& rhs); |
| 49 ~HttpResponseInfo(); | 73 ~HttpResponseInfo(); |
| 50 HttpResponseInfo& operator=(const HttpResponseInfo& rhs); | 74 HttpResponseInfo& operator=(const HttpResponseInfo& rhs); |
| 51 // Even though we could get away with the copy ctor and default operator=, | 75 // 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. | 76 // that would prevent us from doing a bunch of forward declaration. |
| 53 | 77 |
| 54 // Initializes from the representation stored in the given pickle. | 78 // Initializes from the representation stored in the given pickle. |
| 55 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); | 79 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); |
| 56 | 80 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 68 // If this resource was found in the cache, then this bool is set, and | 92 // 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 | 93 // 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 | 94 // 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 | 95 // 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, | 96 // 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). | 97 // when reloading previously visited pages (without going over the network). |
| 74 // Note also that under normal circumstances, was_cached is set to the correct | 98 // Note also that under normal circumstances, was_cached is set to the correct |
| 75 // value even if the request fails. | 99 // value even if the request fails. |
| 76 bool was_cached; | 100 bool was_cached; |
| 77 | 101 |
| 102 // How this response was handled by the http_cache. | |
|
jkarlin
2016/06/30 19:01:12
s/http_cache/HTTP cache/
jamartin
2016/07/04 17:12:26
Done.
| |
| 103 CacheInfo cache_info; | |
|
jkarlin
2016/06/30 19:01:12
similarly, prefer cache_entry_status
jamartin
2016/07/04 17:12:26
Done.
| |
| 104 | |
| 78 // True if the request was fetched from cache rather than the network | 105 // 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 | 106 // because of a LOAD_FROM_CACHE_IF_OFFLINE flag when the system |
| 80 // was unable to contact the server. | 107 // was unable to contact the server. |
| 81 bool server_data_unavailable; | 108 bool server_data_unavailable; |
| 82 | 109 |
| 83 // True if the request accessed the network in the process of retrieving | 110 // True if the request accessed the network in the process of retrieving |
| 84 // data. | 111 // data. |
| 85 bool network_accessed; | 112 bool network_accessed; |
| 86 | 113 |
| 87 // True if the request was fetched over a SPDY channel. | 114 // 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; | 184 scoped_refptr<IOBufferWithSize> metadata; |
| 158 | 185 |
| 159 static ConnectionInfo ConnectionInfoFromNextProto(NextProto next_proto); | 186 static ConnectionInfo ConnectionInfoFromNextProto(NextProto next_proto); |
| 160 | 187 |
| 161 static std::string ConnectionInfoToString(ConnectionInfo connection_info); | 188 static std::string ConnectionInfoToString(ConnectionInfo connection_info); |
| 162 }; | 189 }; |
| 163 | 190 |
| 164 } // namespace net | 191 } // namespace net |
| 165 | 192 |
| 166 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ | 193 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ |
| OLD | NEW |