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 19 matching lines...) Expand all Loading... |
30 // | 30 // |
31 // NOTE: Please keep in sync with Net.HttpResponseInfo.ConnectionInfo | 31 // NOTE: Please keep in sync with Net.HttpResponseInfo.ConnectionInfo |
32 // histogram. Because of that, and also because these values are persisted to | 32 // histogram. Because of that, and also because these values are persisted to |
33 // the cache, please make sure not to delete or reorder values. | 33 // the cache, please make sure not to delete or reorder values. |
34 enum ConnectionInfo { | 34 enum ConnectionInfo { |
35 CONNECTION_INFO_UNKNOWN = 0, | 35 CONNECTION_INFO_UNKNOWN = 0, |
36 CONNECTION_INFO_HTTP1_1 = 1, | 36 CONNECTION_INFO_HTTP1_1 = 1, |
37 CONNECTION_INFO_DEPRECATED_SPDY2 = 2, | 37 CONNECTION_INFO_DEPRECATED_SPDY2 = 2, |
38 CONNECTION_INFO_DEPRECATED_SPDY3 = 3, | 38 CONNECTION_INFO_DEPRECATED_SPDY3 = 3, |
39 CONNECTION_INFO_HTTP2 = 4, // HTTP/2. | 39 CONNECTION_INFO_HTTP2 = 4, // HTTP/2. |
40 CONNECTION_INFO_QUIC = 5, | 40 CONNECTION_INFO_QUIC_UNKNOWN_VERSION = 5, |
41 CONNECTION_INFO_DEPRECATED_HTTP2_14 = 6, // HTTP/2 draft-14. | 41 CONNECTION_INFO_DEPRECATED_HTTP2_14 = 6, // HTTP/2 draft-14. |
42 CONNECTION_INFO_DEPRECATED_HTTP2_15 = 7, // HTTP/2 draft-15. | 42 CONNECTION_INFO_DEPRECATED_HTTP2_15 = 7, // HTTP/2 draft-15. |
43 CONNECTION_INFO_HTTP0_9 = 8, | 43 CONNECTION_INFO_HTTP0_9 = 8, |
44 CONNECTION_INFO_HTTP1_0 = 9, | 44 CONNECTION_INFO_HTTP1_0 = 9, |
| 45 CONNECTION_INFO_QUIC_32 = 10, |
| 46 CONNECTION_INFO_QUIC_33 = 11, |
| 47 CONNECTION_INFO_QUIC_34 = 12, |
| 48 CONNECTION_INFO_QUIC_35 = 13, |
| 49 CONNECTION_INFO_QUIC_36 = 14, |
45 NUM_OF_CONNECTION_INFOS, | 50 NUM_OF_CONNECTION_INFOS, |
46 }; | 51 }; |
47 | 52 |
48 // Used for categorizing transactions for reporting in histograms. | 53 // Used for categorizing transactions for reporting in histograms. |
49 // CacheEntryStatus covers relatively common use cases being measured and | 54 // CacheEntryStatus covers relatively common use cases being measured and |
50 // considered for optimization. Many use cases that are more complex or | 55 // considered for optimization. Many use cases that are more complex or |
51 // uncommon are binned as OTHER, and details are not reported. | 56 // uncommon are binned as OTHER, and details are not reported. |
52 // NOTE: This enumeration is used in histograms, so please do not add entries | 57 // NOTE: This enumeration is used in histograms, so please do not add entries |
53 // in the middle. | 58 // in the middle. |
54 enum CacheEntryStatus { | 59 enum CacheEntryStatus { |
(...skipping 27 matching lines...) Expand all Loading... |
82 | 87 |
83 // Initializes from the representation stored in the given pickle. | 88 // Initializes from the representation stored in the given pickle. |
84 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); | 89 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); |
85 | 90 |
86 // Call this method to persist the response info. | 91 // Call this method to persist the response info. |
87 void Persist(base::Pickle* pickle, | 92 void Persist(base::Pickle* pickle, |
88 bool skip_transient_headers, | 93 bool skip_transient_headers, |
89 bool response_truncated) const; | 94 bool response_truncated) const; |
90 | 95 |
91 // Whether QUIC is used or not. | 96 // Whether QUIC is used or not. |
92 bool DidUseQuic() const { return connection_info == CONNECTION_INFO_QUIC; } | 97 bool DidUseQuic() const; |
93 | 98 |
94 // The following is only defined if the request_time member is set. | 99 // The following is only defined if the request_time member is set. |
95 // If this resource was found in the cache, then this bool is set, and | 100 // If this resource was found in the cache, then this bool is set, and |
96 // request_time may corresponds to a time "far" in the past. Note that | 101 // request_time may corresponds to a time "far" in the past. Note that |
97 // stale content (perhaps un-cacheable) may be fetched from cache subject to | 102 // stale content (perhaps un-cacheable) may be fetched from cache subject to |
98 // the load flags specified on the request info. For example, this is done | 103 // the load flags specified on the request info. For example, this is done |
99 // when a user presses the back button to re-render pages, or at startup, | 104 // when a user presses the back button to re-render pages, or at startup, |
100 // when reloading previously visited pages (without going over the network). | 105 // when reloading previously visited pages (without going over the network). |
101 // Note also that under normal circumstances, was_cached is set to the correct | 106 // Note also that under normal circumstances, was_cached is set to the correct |
102 // value even if the request fails. | 107 // value even if the request fails. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 191 |
187 // Any metadata asociated with this resource's cached data. | 192 // Any metadata asociated with this resource's cached data. |
188 scoped_refptr<IOBufferWithSize> metadata; | 193 scoped_refptr<IOBufferWithSize> metadata; |
189 | 194 |
190 static std::string ConnectionInfoToString(ConnectionInfo connection_info); | 195 static std::string ConnectionInfoToString(ConnectionInfo connection_info); |
191 }; | 196 }; |
192 | 197 |
193 } // namespace net | 198 } // namespace net |
194 | 199 |
195 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ | 200 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ |
OLD | NEW |