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 #include "net/quic/quic_bandwidth.h" | 5 #include "net/quic/quic_bandwidth.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "net/quic/quic_time.h" | 10 #include "net/quic/quic_time.h" |
9 #include "net/quic/quic_types.h" | 11 #include "net/quic/quic_types.h" |
10 | 12 |
11 namespace net { | 13 namespace net { |
12 | 14 |
13 // Highest number that QuicBandwidth can hold. | 15 // Highest number that QuicBandwidth can hold. |
14 const int64 kQuicInfiniteBandwidth = GG_INT64_C(0x7fffffffffffffff); | 16 const int64 kQuicInfiniteBandwidth = INT64_C(0x7fffffffffffffff); |
15 | 17 |
16 // static | 18 // static |
17 QuicBandwidth QuicBandwidth::Zero() { | 19 QuicBandwidth QuicBandwidth::Zero() { |
18 return QuicBandwidth(0); | 20 return QuicBandwidth(0); |
19 } | 21 } |
20 | 22 |
21 // static | 23 // static |
22 QuicBandwidth QuicBandwidth::FromBitsPerSecond(int64 bits_per_second) { | 24 QuicBandwidth QuicBandwidth::FromBitsPerSecond(int64 bits_per_second) { |
23 return QuicBandwidth(bits_per_second); | 25 return QuicBandwidth(bits_per_second); |
24 } | 26 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 103 |
102 QuicTime::Delta QuicBandwidth::TransferTime(QuicByteCount bytes) const { | 104 QuicTime::Delta QuicBandwidth::TransferTime(QuicByteCount bytes) const { |
103 if (bits_per_second_ == 0) { | 105 if (bits_per_second_ == 0) { |
104 return QuicTime::Delta::Zero(); | 106 return QuicTime::Delta::Zero(); |
105 } | 107 } |
106 return QuicTime::Delta::FromMicroseconds(bytes * 8 * kNumMicrosPerSecond / | 108 return QuicTime::Delta::FromMicroseconds(bytes * 8 * kNumMicrosPerSecond / |
107 bits_per_second_); | 109 bits_per_second_); |
108 } | 110 } |
109 | 111 |
110 } // namespace net | 112 } // namespace net |
OLD | NEW |