Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: net/quic/quic_bandwidth.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/crypto/strike_register.cc ('k') | net/quic/quic_client_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 QuicBandwidth QuicBandwidth::Add(const QuicBandwidth& delta) const { 90 QuicBandwidth QuicBandwidth::Add(const QuicBandwidth& delta) const {
91 return QuicBandwidth(bits_per_second_ + delta.bits_per_second_); 91 return QuicBandwidth(bits_per_second_ + delta.bits_per_second_);
92 } 92 }
93 93
94 QuicBandwidth QuicBandwidth::Subtract(const QuicBandwidth& delta) const { 94 QuicBandwidth QuicBandwidth::Subtract(const QuicBandwidth& delta) const {
95 return QuicBandwidth(bits_per_second_ - delta.bits_per_second_); 95 return QuicBandwidth(bits_per_second_ - delta.bits_per_second_);
96 } 96 }
97 97
98 QuicBandwidth QuicBandwidth::Scale(float scale_factor) const { 98 QuicBandwidth QuicBandwidth::Scale(float scale_factor) const {
99 return QuicBandwidth(bits_per_second_ * scale_factor); 99 return QuicBandwidth(static_cast<int64>(bits_per_second_ * scale_factor));
100 } 100 }
101 101
102 QuicTime::Delta QuicBandwidth::TransferTime(QuicByteCount bytes) const { 102 QuicTime::Delta QuicBandwidth::TransferTime(QuicByteCount bytes) const {
103 if (bits_per_second_ == 0) { 103 if (bits_per_second_ == 0) {
104 return QuicTime::Delta::Zero(); 104 return QuicTime::Delta::Zero();
105 } 105 }
106 return QuicTime::Delta::FromMicroseconds( 106 return QuicTime::Delta::FromMicroseconds(
107 bytes * 8 * base::Time::kMicrosecondsPerSecond / bits_per_second_); 107 bytes * 8 * base::Time::kMicrosecondsPerSecond / bits_per_second_);
108 } 108 }
109 109
110 } // namespace net 110 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/strike_register.cc ('k') | net/quic/quic_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698