| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // QuicBandwidth represents a bandwidth, stored in bits per second resolution. | 5 // QuicBandwidth represents a bandwidth, stored in bits per second resolution. |
| 6 | 6 |
| 7 #ifndef NET_QUIC_QUIC_BANDWIDTH_H_ | 7 #ifndef NET_QUIC_QUIC_BANDWIDTH_H_ |
| 8 #define NET_QUIC_QUIC_BANDWIDTH_H_ | 8 #define NET_QUIC_QUIC_BANDWIDTH_H_ |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 int64_t ToBytesPerSecond() const; | 45 int64_t ToBytesPerSecond() const; |
| 46 | 46 |
| 47 int64_t ToKBytesPerSecond() const; | 47 int64_t ToKBytesPerSecond() const; |
| 48 | 48 |
| 49 QuicByteCount ToBytesPerPeriod(QuicTime::Delta time_period) const; | 49 QuicByteCount ToBytesPerPeriod(QuicTime::Delta time_period) const; |
| 50 | 50 |
| 51 int64_t ToKBytesPerPeriod(QuicTime::Delta time_period) const; | 51 int64_t ToKBytesPerPeriod(QuicTime::Delta time_period) const; |
| 52 | 52 |
| 53 bool IsZero() const; | 53 bool IsZero() const; |
| 54 | 54 |
| 55 QuicBandwidth Add(const QuicBandwidth& delta) const WARN_UNUSED_RESULT; | 55 QuicBandwidth Add(QuicBandwidth delta) const WARN_UNUSED_RESULT; |
| 56 | 56 |
| 57 QuicBandwidth Subtract(const QuicBandwidth& delta) const WARN_UNUSED_RESULT; | 57 QuicBandwidth Subtract(QuicBandwidth delta) const WARN_UNUSED_RESULT; |
| 58 | 58 |
| 59 QuicBandwidth Scale(float scale_factor) const WARN_UNUSED_RESULT; | 59 QuicBandwidth Scale(float scale_factor) const WARN_UNUSED_RESULT; |
| 60 | 60 |
| 61 QuicTime::Delta TransferTime(QuicByteCount bytes) const; | 61 QuicTime::Delta TransferTime(QuicByteCount bytes) const; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 explicit QuicBandwidth(int64_t bits_per_second); | 64 explicit QuicBandwidth(int64_t bits_per_second); |
| 65 int64_t bits_per_second_; | 65 int64_t bits_per_second_; |
| 66 }; | 66 }; |
| 67 | 67 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 80 } | 80 } |
| 81 inline bool operator<=(QuicBandwidth lhs, QuicBandwidth rhs) { | 81 inline bool operator<=(QuicBandwidth lhs, QuicBandwidth rhs) { |
| 82 return !(rhs < lhs); | 82 return !(rhs < lhs); |
| 83 } | 83 } |
| 84 inline bool operator>=(QuicBandwidth lhs, QuicBandwidth rhs) { | 84 inline bool operator>=(QuicBandwidth lhs, QuicBandwidth rhs) { |
| 85 return !(lhs < rhs); | 85 return !(lhs < rhs); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace net | 88 } // namespace net |
| 89 #endif // NET_QUIC_QUIC_BANDWIDTH_H_ | 89 #endif // NET_QUIC_QUIC_BANDWIDTH_H_ |
| OLD | NEW |