#include "services/network/throttling/throttling_network_interceptor.h"
#include <stddef.h>
#include <algorithm>
#include <limits>
#include <utility>
#include "base/functional/bind.h"
#include "base/time/time.h"
#include "net/base/net_errors.h"
#include "services/network/throttling/network_conditions.h"
namespace network {
namespace {
constexpr int kPacketSize = …;
base::TimeDelta CalculateTickLength(double throughput) { … }
}
ThrottlingNetworkInterceptor::ThrottleRecord::ThrottleRecord() { … }
ThrottlingNetworkInterceptor::ThrottleRecord::ThrottleRecord(
const ThrottleRecord& other) = default;
ThrottlingNetworkInterceptor::ThrottleRecord::~ThrottleRecord() { … }
ThrottlingNetworkInterceptor::ThrottlingNetworkInterceptor()
: … { … }
ThrottlingNetworkInterceptor::~ThrottlingNetworkInterceptor() { … }
base::WeakPtr<ThrottlingNetworkInterceptor>
ThrottlingNetworkInterceptor::GetWeakPtr() { … }
void ThrottlingNetworkInterceptor::FinishRecords(ThrottleRecords* records,
bool offline) { … }
void ThrottlingNetworkInterceptor::UpdateConditions(
const NetworkConditions& conditions) { … }
uint64_t ThrottlingNetworkInterceptor::UpdateThrottledRecords(
base::TimeTicks now,
ThrottleRecords* records,
uint64_t last_tick,
base::TimeDelta tick_length) { … }
void ThrottlingNetworkInterceptor::UpdateThrottled(base::TimeTicks now) { … }
void ThrottlingNetworkInterceptor::UpdateSuspended(base::TimeTicks now) { … }
void ThrottlingNetworkInterceptor::CollectFinished(ThrottleRecords* records,
ThrottleRecords* finished) { … }
void ThrottlingNetworkInterceptor::OnTimer() { … }
base::TimeTicks ThrottlingNetworkInterceptor::CalculateDesiredTime(
const ThrottleRecords& records,
uint64_t last_tick,
base::TimeDelta tick_length) { … }
void ThrottlingNetworkInterceptor::ArmTimer(base::TimeTicks now) { … }
int ThrottlingNetworkInterceptor::StartThrottle(
int result,
int64_t bytes,
base::TimeTicks send_end,
bool start,
bool is_upload,
const ThrottleCallback& callback) { … }
void ThrottlingNetworkInterceptor::StopThrottle(
const ThrottleCallback& callback) { … }
void ThrottlingNetworkInterceptor::RemoveRecord(
ThrottleRecords* records,
const ThrottleCallback& callback) { … }
bool ThrottlingNetworkInterceptor::IsOffline() { … }
void ThrottlingNetworkInterceptor::SetSuspendWhenOffline(bool suspend) { … }
int ThrottlingNetworkInterceptor::GetReadBufLen(int buf_len) const { … }
}