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

Unified Diff: net/quic/quic_bandwidth.h

Issue 2193073003: Move shared files in net/quic/ into net/quic/core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: io_thread_unittest.cc Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_arena_scoped_ptr_test.cc ('k') | net/quic/quic_bandwidth.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_bandwidth.h
diff --git a/net/quic/quic_bandwidth.h b/net/quic/quic_bandwidth.h
deleted file mode 100644
index 1aa2c9a2abd150a0fb8c1b4e355525395569e31e..0000000000000000000000000000000000000000
--- a/net/quic/quic_bandwidth.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// QuicBandwidth represents a bandwidth, stored in bits per second resolution.
-
-#ifndef NET_QUIC_QUIC_BANDWIDTH_H_
-#define NET_QUIC_QUIC_BANDWIDTH_H_
-
-#include <stdint.h>
-
-#include "base/compiler_specific.h"
-#include "net/quic/quic_time.h"
-
-namespace net {
-
-typedef uint64_t QuicByteCount;
-typedef uint64_t QuicPacketCount;
-
-class NET_EXPORT_PRIVATE QuicBandwidth {
- public:
- // Creates a new QuicBandwidth with an internal value of 0.
- static QuicBandwidth Zero();
-
- // Create a new QuicBandwidth holding the bits per second.
- static QuicBandwidth FromBitsPerSecond(int64_t bits_per_second);
-
- // Create a new QuicBandwidth holding the kilo bits per second.
- static QuicBandwidth FromKBitsPerSecond(int64_t k_bits_per_second);
-
- // Create a new QuicBandwidth holding the bytes per second.
- static QuicBandwidth FromBytesPerSecond(int64_t bytes_per_second);
-
- // Create a new QuicBandwidth holding the kilo bytes per second.
- static QuicBandwidth FromKBytesPerSecond(int64_t k_bytes_per_second);
-
- // Create a new QuicBandwidth based on the bytes per the elapsed delta.
- static QuicBandwidth FromBytesAndTimeDelta(QuicByteCount bytes,
- QuicTime::Delta delta);
-
- int64_t ToBitsPerSecond() const;
-
- int64_t ToKBitsPerSecond() const;
-
- int64_t ToBytesPerSecond() const;
-
- int64_t ToKBytesPerSecond() const;
-
- QuicByteCount ToBytesPerPeriod(QuicTime::Delta time_period) const;
-
- int64_t ToKBytesPerPeriod(QuicTime::Delta time_period) const;
-
- bool IsZero() const;
-
- QuicTime::Delta TransferTime(QuicByteCount bytes) const;
-
- private:
- explicit QuicBandwidth(int64_t bits_per_second);
- int64_t bits_per_second_;
-
- friend QuicBandwidth operator+(QuicBandwidth lhs, QuicBandwidth rhs);
- friend QuicBandwidth operator-(QuicBandwidth lhs, QuicBandwidth rhs);
- friend QuicBandwidth operator*(QuicBandwidth lhs, float factor);
-};
-
-// Non-member relational operators for QuicBandwidth.
-inline bool operator==(QuicBandwidth lhs, QuicBandwidth rhs) {
- return lhs.ToBitsPerSecond() == rhs.ToBitsPerSecond();
-}
-inline bool operator!=(QuicBandwidth lhs, QuicBandwidth rhs) {
- return !(lhs == rhs);
-}
-inline bool operator<(QuicBandwidth lhs, QuicBandwidth rhs) {
- return lhs.ToBitsPerSecond() < rhs.ToBitsPerSecond();
-}
-inline bool operator>(QuicBandwidth lhs, QuicBandwidth rhs) {
- return rhs < lhs;
-}
-inline bool operator<=(QuicBandwidth lhs, QuicBandwidth rhs) {
- return !(rhs < lhs);
-}
-inline bool operator>=(QuicBandwidth lhs, QuicBandwidth rhs) {
- return !(lhs < rhs);
-}
-
-// Non-member arithmetic operators for QuicBandwidth.
-inline QuicBandwidth operator+(QuicBandwidth lhs, QuicBandwidth rhs) {
- return QuicBandwidth(lhs.bits_per_second_ + rhs.bits_per_second_);
-}
-inline QuicBandwidth operator-(QuicBandwidth lhs, QuicBandwidth rhs) {
- return QuicBandwidth(lhs.bits_per_second_ - rhs.bits_per_second_);
-}
-inline QuicBandwidth operator*(QuicBandwidth lhs, float rhs) {
- return QuicBandwidth(static_cast<int64_t>(lhs.bits_per_second_ * rhs));
-}
-inline QuicBandwidth operator*(float lhs, QuicBandwidth rhs) {
- return rhs * lhs;
-}
-
-} // namespace net
-#endif // NET_QUIC_QUIC_BANDWIDTH_H_
« no previous file with comments | « net/quic/quic_arena_scoped_ptr_test.cc ('k') | net/quic/quic_bandwidth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698