| 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 20 matching lines...) Expand all Loading... |
| 31 // | 31 // |
| 32 // NOTE: Please keep in sync with Net.HttpResponseInfo.ConnectionInfo | 32 // NOTE: Please keep in sync with Net.HttpResponseInfo.ConnectionInfo |
| 33 // histogram. Because of that, and also because these values are persisted to | 33 // histogram. Because of that, and also because these values are persisted to |
| 34 // the cache, please make sure not to delete or reorder values. | 34 // the cache, please make sure not to delete or reorder values. |
| 35 enum ConnectionInfo { | 35 enum ConnectionInfo { |
| 36 CONNECTION_INFO_UNKNOWN = 0, | 36 CONNECTION_INFO_UNKNOWN = 0, |
| 37 CONNECTION_INFO_HTTP1_1 = 1, | 37 CONNECTION_INFO_HTTP1_1 = 1, |
| 38 CONNECTION_INFO_DEPRECATED_SPDY2 = 2, | 38 CONNECTION_INFO_DEPRECATED_SPDY2 = 2, |
| 39 CONNECTION_INFO_DEPRECATED_SPDY3 = 3, | 39 CONNECTION_INFO_DEPRECATED_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_QUIC = 5, |
| 42 CONNECTION_INFO_DEPRECATED_HTTP2_14 = 6, // HTTP/2 draft-14. | 42 CONNECTION_INFO_DEPRECATED_HTTP2_14 = 6, // HTTP/2 draft-14. |
| 43 CONNECTION_INFO_DEPRECATED_HTTP2_15 = 7, // HTTP/2 draft-15. | 43 CONNECTION_INFO_DEPRECATED_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. | 49 // Used for categorizing transactions for reporting in histograms. |
| 50 // CacheEntryStatus covers relatively common use cases being measured and | 50 // CacheEntryStatus covers relatively common use cases being measured and |
| 51 // considered for optimization. Many use cases that are more complex or | 51 // considered for optimization. Many use cases that are more complex or |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // Initializes from the representation stored in the given pickle. | 84 // Initializes from the representation stored in the given pickle. |
| 85 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); | 85 bool InitFromPickle(const base::Pickle& pickle, bool* response_truncated); |
| 86 | 86 |
| 87 // Call this method to persist the response info. | 87 // Call this method to persist the response info. |
| 88 void Persist(base::Pickle* pickle, | 88 void Persist(base::Pickle* pickle, |
| 89 bool skip_transient_headers, | 89 bool skip_transient_headers, |
| 90 bool response_truncated) const; | 90 bool response_truncated) const; |
| 91 | 91 |
| 92 // Whether QUIC is used or not. | 92 // Whether QUIC is used or not. |
| 93 bool DidUseQuic() const { | 93 bool DidUseQuic() const { return connection_info == CONNECTION_INFO_QUIC; } |
| 94 return connection_info == CONNECTION_INFO_QUIC1_SPDY3; | |
| 95 } | |
| 96 | 94 |
| 97 // The following is only defined if the request_time member is set. | 95 // The following is only defined if the request_time member is set. |
| 98 // 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 |
| 99 // 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 |
| 100 // 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 |
| 101 // 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 |
| 102 // 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, |
| 103 // when reloading previously visited pages (without going over the network). | 101 // when reloading previously visited pages (without going over the network). |
| 104 // 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 |
| 105 // value even if the request fails. | 103 // value even if the request fails. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 scoped_refptr<IOBufferWithSize> metadata; | 189 scoped_refptr<IOBufferWithSize> metadata; |
| 192 | 190 |
| 193 static ConnectionInfo ConnectionInfoFromNextProto(NextProto next_proto); | 191 static ConnectionInfo ConnectionInfoFromNextProto(NextProto next_proto); |
| 194 | 192 |
| 195 static std::string ConnectionInfoToString(ConnectionInfo connection_info); | 193 static std::string ConnectionInfoToString(ConnectionInfo connection_info); |
| 196 }; | 194 }; |
| 197 | 195 |
| 198 } // namespace net | 196 } // namespace net |
| 199 | 197 |
| 200 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ | 198 #endif // NET_HTTP_HTTP_RESPONSE_INFO_H_ |
| OLD | NEW |