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

Unified Diff: third_party/WebKit/Source/platform/network/NetworkStateNotifier.h

Issue 2883763002: Expose ECT to render frames, Blink and NetInfo (Closed)
Patch Set: rebased Created 3 years, 7 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
Index: third_party/WebKit/Source/platform/network/NetworkStateNotifier.h
diff --git a/third_party/WebKit/Source/platform/network/NetworkStateNotifier.h b/third_party/WebKit/Source/platform/network/NetworkStateNotifier.h
index 16d7393e49ff40b508a61a4a670031f2c99ed78c..18e56e22f64c284876e6a500f07b5fbd107bc631 100644
--- a/third_party/WebKit/Source/platform/network/NetworkStateNotifier.h
+++ b/third_party/WebKit/Source/platform/network/NetworkStateNotifier.h
@@ -38,6 +38,7 @@
#include "platform/wtf/Time.h"
#include "platform/wtf/Vector.h"
#include "public/platform/WebConnectionType.h"
+#include "public/platform/WebEffectiveConnectionType.h"
namespace blink {
@@ -53,6 +54,8 @@ class PLATFORM_EXPORT NetworkStateNotifier {
bool connection_initialized = false;
WebConnectionType type = kWebConnectionTypeOther;
double max_bandwidth_mbps = kInvalidMaxBandwidth;
+ WebEffectiveConnectionType effective_type =
+ WebEffectiveConnectionType::kTypeUnknown;
Optional<TimeDelta> http_rtt;
Optional<TimeDelta> transport_rtt;
Optional<double> downlink_throughput_mbps;
@@ -64,6 +67,7 @@ class PLATFORM_EXPORT NetworkStateNotifier {
virtual void ConnectionChange(
WebConnectionType,
double max_bandwidth_mbps,
+ WebEffectiveConnectionType,
const Optional<TimeDelta>& http_rtt,
const Optional<TimeDelta>& transport_rtt,
const Optional<double>& downlink_throughput_mbps) {}
@@ -80,6 +84,16 @@ class PLATFORM_EXPORT NetworkStateNotifier {
return state.on_line;
}
+ // Returns the current effective connection type, which is the connection type
+ // whose typical performance is most similar to the measured performance of
+ // the network in use.
+ WebEffectiveConnectionType EffectiveType() const {
+ MutexLocker locker(mutex_);
+ const NetworkState& state = has_override_ ? override_ : state_;
+ DCHECK(state.on_line_initialized);
+ return state.effective_type;
+ }
+
// Returns the current HTTP RTT estimate. If the estimate is unavailable, the
// returned optional value is null.
Optional<TimeDelta> HttpRtt() const {
@@ -146,7 +160,8 @@ class PLATFORM_EXPORT NetworkStateNotifier {
}
void SetWebConnection(WebConnectionType, double max_bandwidth_mbps);
- void SetNetworkQuality(TimeDelta http_rtt,
+ void SetNetworkQuality(WebEffectiveConnectionType,
+ TimeDelta http_rtt,
TimeDelta transport_rtt,
int downlink_throughput_kbps);

Powered by Google App Engine
This is Rietveld 408576698