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

Side by Side Diff: content/browser/net/network_quality_observer_impl.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_
6 #define CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_ 6 #define CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/network_quality_observer_factory.h" 15 #include "content/public/browser/network_quality_observer_factory.h"
16 #include "net/nqe/effective_connection_type.h"
16 #include "net/nqe/network_quality.h" 17 #include "net/nqe/network_quality.h"
17 #include "net/nqe/network_quality_estimator.h" 18 #include "net/nqe/network_quality_estimator.h"
18 19
19 namespace content { 20 namespace content {
20 21
21 // Listens for changes to the network quality and manages sending updates to 22 // Listens for changes to the network quality and manages sending updates to
22 // each RenderProcess via mojo. 23 // each RenderProcess via mojo.
23 class CONTENT_EXPORT NetworkQualityObserverImpl 24 class CONTENT_EXPORT NetworkQualityObserverImpl
24 : public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver { 25 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver,
26 public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver {
25 public: 27 public:
26 explicit NetworkQualityObserverImpl( 28 explicit NetworkQualityObserverImpl(
27 net::NetworkQualityEstimator* network_quality_estimator); 29 net::NetworkQualityEstimator* network_quality_estimator);
28 30
29 ~NetworkQualityObserverImpl() override; 31 ~NetworkQualityObserverImpl() override;
30 32
31 private: 33 private:
32 class UiThreadObserver; 34 class UiThreadObserver;
33 35
36 // net::NetworkQualityEstimator::EffectiveConnectionTypeObserver
37 // implementation:
38 void OnEffectiveConnectionTypeChanged(
39 net::EffectiveConnectionType type) override;
40
34 // net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver 41 // net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver
35 // implementation: 42 // implementation:
36 void OnRTTOrThroughputEstimatesComputed( 43 void OnRTTOrThroughputEstimatesComputed(
37 base::TimeDelta http_rtt, 44 base::TimeDelta http_rtt,
38 base::TimeDelta transport_rtt, 45 base::TimeDelta transport_rtt,
39 int32_t downstream_throughput_kbps) override; 46 int32_t downstream_throughput_kbps) override;
40 47
41 // |ui_thread_observer_| is owned by |this|, and interacts with 48 // |ui_thread_observer_| is owned by |this|, and interacts with
42 // the render processes. It is created on the IO thread but afterwards, should 49 // the render processes. It is created on the IO thread but afterwards, should
43 // only be accessed on the UI thread. |ui_thread_observer_| is guaranteed to 50 // only be accessed on the UI thread. |ui_thread_observer_| is guaranteed to
44 // be non-null during the lifetime of |this|. 51 // be non-null during the lifetime of |this|.
45 std::unique_ptr<UiThreadObserver> ui_thread_observer_; 52 std::unique_ptr<UiThreadObserver> ui_thread_observer_;
46 53
47 // |network_quality_estimator_| is guaranteed to be non-null during the 54 // |network_quality_estimator_| is guaranteed to be non-null during the
48 // lifetime of |this|. 55 // lifetime of |this|.
49 net::NetworkQualityEstimator* network_quality_estimator_; 56 net::NetworkQualityEstimator* network_quality_estimator_;
50 57
51 // The network quality when the |ui_thread_observer_| was last notified. 58 // The network quality when the |ui_thread_observer_| was last notified.
59 net::EffectiveConnectionType last_notified_type_;
52 net::nqe::internal::NetworkQuality last_notified_network_quality_; 60 net::nqe::internal::NetworkQuality last_notified_network_quality_;
53 61
54 base::ThreadChecker thread_checker_; 62 base::ThreadChecker thread_checker_;
55 63
56 DISALLOW_COPY_AND_ASSIGN(NetworkQualityObserverImpl); 64 DISALLOW_COPY_AND_ASSIGN(NetworkQualityObserverImpl);
57 }; 65 };
58 66
59 } // namespace content 67 } // namespace content
60 68
61 #endif // CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_ 69 #endif // CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698