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 a1e80b24014c6728a9172c3dede398ae95a14e22..2ba678c10f54a9e001862e3ef41683cb74c79813 100644 |
--- a/third_party/WebKit/Source/platform/network/NetworkStateNotifier.h |
+++ b/third_party/WebKit/Source/platform/network/NetworkStateNotifier.h |
@@ -51,13 +51,19 @@ class PLATFORM_EXPORT NetworkStateNotifier { |
bool connection_initialized = false; |
WebConnectionType type = kWebConnectionTypeOther; |
double max_bandwidth_mbps = kInvalidMaxBandwidth; |
+ int http_rtt_msec = -1; |
+ int transport_rtt_msec = -1; |
+ double downlink_throughput_mbps = -1; |
}; |
class NetworkStateObserver { |
public: |
// Will be called on the task runner that is passed in add*Observer. |
virtual void ConnectionChange(WebConnectionType, |
- double max_bandwidth_mbps) {} |
+ double max_bandwidth_mbps, |
+ int http_rtt_msec, |
+ int transport_rtt_msec, |
+ double downlink_throughput_mbps) {} |
virtual void OnLineStateChange(bool on_line) {} |
}; |
@@ -71,6 +77,27 @@ class PLATFORM_EXPORT NetworkStateNotifier { |
return state.on_line; |
} |
+ int HttpRttMsec() const { |
+ MutexLocker locker(mutex_); |
+ const NetworkState& state = has_override_ ? override_ : state_; |
+ DCHECK(state.on_line_initialized); |
+ return state.http_rtt_msec; |
+ } |
+ |
+ int TransportRttMsec() const { |
+ MutexLocker locker(mutex_); |
+ const NetworkState& state = has_override_ ? override_ : state_; |
+ DCHECK(state.on_line_initialized); |
+ return state.transport_rtt_msec; |
+ } |
+ |
+ double DownlinkThroughputMbps() const { |
+ MutexLocker locker(mutex_); |
+ const NetworkState& state = has_override_ ? override_ : state_; |
+ DCHECK(state.on_line_initialized); |
+ return state.downlink_throughput_mbps; |
+ } |
+ |
void SetOnLine(bool); |
// Can be called on any thread. |
@@ -110,6 +137,9 @@ class PLATFORM_EXPORT NetworkStateNotifier { |
} |
void SetWebConnection(WebConnectionType, double max_bandwidth_mbps); |
+ void SetWebNetworkQuality(int http_rtt_msec, |
+ int transport_rtt_msec, |
+ int downlink_throughput_kbps); |
// When called, successive setWebConnectionType/setOnLine calls are stored, |
// and supplied overridden values are used instead until clearOverride() is |