// Copyright 2016 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_NQE_THROUGHPUT_ANALYZER_H_ #define NET_NQE_THROUGHPUT_ANALYZER_H_ #include <stdint.h> #include <unordered_map> #include <unordered_set> #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "base/sequence_checker.h" #include "base/time/time.h" #include "net/base/net_export.h" #include "net/log/net_log_with_source.h" namespace { ThroughputObservationCallback; } namespace base { class SingleThreadTaskRunner; class TickClock; } namespace net { class NetworkQualityEstimatorParams; class NetworkQualityEstimator; class URLRequest; namespace nqe::internal { // Makes throughput observations. Polls NetworkActivityMonitor // (TrafficStats on Android) to count number of bits received over throughput // observation windows in accordance with the following rules: // (1) A new window of observation begins any time a URL request header is // about to be sent, or a request completes or is destroyed. // (2) A request is "active" if its headers are sent, but it hasn't completed, // and "local" if destined to local host. If at any time during a // throughput observation window there is an active, local request, the // window is discarded. // (3) If less than 32KB is received over the network during a window of // observation, that window is discarded. class NET_EXPORT_PRIVATE ThroughputAnalyzer { … }; } // namespace nqe::internal } // namespace net #endif // NET_NQE_THROUGHPUT_ANALYZER_H_