| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_QUIC_CRYPTO_CACHED_NETWORK_PARAMETERS_H_ | 5 #ifndef NET_QUIC_CRYPTO_CACHED_NETWORK_PARAMETERS_H_ |
| 6 #define NET_QUIC_CRYPTO_CACHED_NETWORK_PARAMETERS_H_ | 6 #define NET_QUIC_CRYPTO_CACHED_NETWORK_PARAMETERS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 void set_max_bandwidth_timestamp_seconds( | 61 void set_max_bandwidth_timestamp_seconds( |
| 62 int64 max_bandwidth_timestamp_seconds) { | 62 int64 max_bandwidth_timestamp_seconds) { |
| 63 max_bandwidth_timestamp_seconds_ = max_bandwidth_timestamp_seconds; | 63 max_bandwidth_timestamp_seconds_ = max_bandwidth_timestamp_seconds; |
| 64 } | 64 } |
| 65 | 65 |
| 66 int32 min_rtt_ms() const { | 66 int32 min_rtt_ms() const { |
| 67 return min_rtt_ms_; | 67 return min_rtt_ms_; |
| 68 } | 68 } |
| 69 void set_min_rtt_ms(int32 min_rtt_ms) { | 69 void set_min_rtt_ms(int32 min_rtt_ms) { |
| 70 min_rtt_ms_ = min_rtt_ms; | 70 min_rtt_ms_ = min_rtt_ms; |
| 71 has_min_rtt_ms_ = true; |
| 71 } | 72 } |
| 73 bool has_min_rtt_ms() const { return has_min_rtt_ms_; } |
| 72 | 74 |
| 73 int32 previous_connection_state() const { | 75 int32 previous_connection_state() const { |
| 74 return previous_connection_state_; | 76 return previous_connection_state_; |
| 75 } | 77 } |
| 76 void set_previous_connection_state(int32 previous_connection_state) { | 78 void set_previous_connection_state(int32 previous_connection_state) { |
| 77 previous_connection_state_ = previous_connection_state; | 79 previous_connection_state_ = previous_connection_state; |
| 78 } | 80 } |
| 79 | 81 |
| 80 int64 timestamp() const { return timestamp_; } | 82 int64 timestamp() const { return timestamp_; } |
| 81 void set_timestamp(int64 timestamp) { timestamp_ = timestamp; } | 83 void set_timestamp(int64 timestamp) { timestamp_ = timestamp; } |
| 82 | 84 |
| 83 private: | 85 private: |
| 84 // serving_region_ is used to decide whether or not the bandwidth estimate and | 86 // serving_region_ is used to decide whether or not the bandwidth estimate and |
| 85 // min RTT are reasonable and if they should be used. | 87 // min RTT are reasonable and if they should be used. |
| 86 // For example a group of geographically close servers may share the same | 88 // For example a group of geographically close servers may share the same |
| 87 // serving_region_ string if they are expected to have similar network | 89 // serving_region_ string if they are expected to have similar network |
| 88 // performance. | 90 // performance. |
| 89 std::string serving_region_; | 91 std::string serving_region_; |
| 90 // The server can supply a bandwidth estimate (in bytes/s) which it may re-use | 92 // The server can supply a bandwidth estimate (in bytes/s) which it may re-use |
| 91 // on receipt of a source-address token with this field set. | 93 // on receipt of a source-address token with this field set. |
| 92 int32 bandwidth_estimate_bytes_per_second_; | 94 int32 bandwidth_estimate_bytes_per_second_; |
| 93 // The maximum bandwidth seen by the client, not necessarily the latest. | 95 // The maximum bandwidth seen by the client, not necessarily the latest. |
| 94 int32 max_bandwidth_estimate_bytes_per_second_; | 96 int32 max_bandwidth_estimate_bytes_per_second_; |
| 95 // Timestamp (seconds since UNIX epoch) that indicates when the max bandwidth | 97 // Timestamp (seconds since UNIX epoch) that indicates when the max bandwidth |
| 96 // was seen by the server. | 98 // was seen by the server. |
| 97 int64 max_bandwidth_timestamp_seconds_; | 99 int64 max_bandwidth_timestamp_seconds_; |
| 98 // The min RTT seen on a previous connection can be used by the server to | 100 // The min RTT seen on a previous connection can be used by the server to |
| 99 // inform initial connection parameters for new connections. | 101 // inform initial connection parameters for new connections. |
| 100 int32 min_rtt_ms_; | 102 int32 min_rtt_ms_; |
| 103 // Whenever min_rtt_ms_ is updated, it is set to true. |
| 104 bool has_min_rtt_ms_; |
| 101 // Encodes the PreviousConnectionState enum. | 105 // Encodes the PreviousConnectionState enum. |
| 102 int32 previous_connection_state_; | 106 int32 previous_connection_state_; |
| 103 // UNIX timestamp when this bandwidth estimate was created. | 107 // UNIX timestamp when this bandwidth estimate was created. |
| 104 int64 timestamp_; | 108 int64 timestamp_; |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 } // namespace net | 111 } // namespace net |
| 108 | 112 |
| 109 #endif // NET_QUIC_CRYPTO_CACHED_NETWORK_PARAMETERS_H_ | 113 #endif // NET_QUIC_CRYPTO_CACHED_NETWORK_PARAMETERS_H_ |
| OLD | NEW |