Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NET_NQE_IO_NETWORK_QUALITY_OBSERVER_H_ | |
| 6 #define CHROME_BROWSER_NET_NQE_IO_NETWORK_QUALITY_OBSERVER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "base/single_thread_task_runner.h" | |
| 13 #include "net/nqe/network_quality_estimator.h" | |
| 14 | |
| 15 class IOThread; | |
| 16 class UINetworkQualityEstimatorService; | |
| 17 | |
| 18 class IONetworkQualityObserver | |
|
tbansal1
2016/07/01 22:22:02
Would it be preferable to make this an inner class
RyanSturm
2016/07/11 22:00:19
Done.
| |
| 19 : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver { | |
| 20 public: | |
| 21 IONetworkQualityObserver( | |
| 22 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | |
| 23 base::WeakPtr<UINetworkQualityEstimatorService> service); | |
| 24 | |
| 25 ~IONetworkQualityObserver() override; | |
| 26 | |
| 27 void InitializeOnIOThread(IOThread* io_thread); | |
|
tbansal1
2016/07/01 22:22:02
const IOThread*
RyanSturm
2016/07/11 22:00:19
Done.
| |
| 28 | |
| 29 void ShutdownOnIOThread(); | |
| 30 | |
| 31 protected: | |
| 32 void OnEffectiveConnectionTypeChanged( | |
| 33 net::NetworkQualityEstimator::EffectiveConnectionType type) override; | |
| 34 | |
| 35 private: | |
| 36 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | |
| 37 base::WeakPtr<UINetworkQualityEstimatorService> service_; | |
|
tbansal1
2016/07/01 22:22:02
You do not really need a weak ptr to service_ beca
RyanSturm
2016/07/11 22:00:19
not strict ownership. The timing of posting from h
| |
| 38 base::WeakPtr<net::NetworkQualityEstimator> network_quality_estimator_; | |
| 39 | |
| 40 DISALLOW_COPY_AND_ASSIGN(IONetworkQualityObserver); | |
| 41 }; | |
| 42 | |
| 43 #endif // CHROME_BROWSER_NET_NQE_IO_NETWORK_QUALITY_OBSERVER_H_ | |
| OLD | NEW |