Chromium Code Reviews| Index: chrome/browser/net/nqe/io_network_quality_observer.h |
| diff --git a/chrome/browser/net/nqe/io_network_quality_observer.h b/chrome/browser/net/nqe/io_network_quality_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..20f516882178a96efb85afbbcf8cd642881c0616 |
| --- /dev/null |
| +++ b/chrome/browser/net/nqe/io_network_quality_observer.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_NET_NQE_IO_NETWORK_QUALITY_OBSERVER_H_ |
| +#define CHROME_BROWSER_NET_NQE_IO_NETWORK_QUALITY_OBSERVER_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/single_thread_task_runner.h" |
| +#include "net/nqe/network_quality_estimator.h" |
| + |
| +class IOThread; |
| +class UINetworkQualityEstimatorService; |
| + |
| +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.
|
| + : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver { |
| + public: |
| + IONetworkQualityObserver( |
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| + base::WeakPtr<UINetworkQualityEstimatorService> service); |
| + |
| + ~IONetworkQualityObserver() override; |
| + |
| + void InitializeOnIOThread(IOThread* io_thread); |
|
tbansal1
2016/07/01 22:22:02
const IOThread*
RyanSturm
2016/07/11 22:00:19
Done.
|
| + |
| + void ShutdownOnIOThread(); |
| + |
| + protected: |
| + void OnEffectiveConnectionTypeChanged( |
| + net::NetworkQualityEstimator::EffectiveConnectionType type) override; |
| + |
| + private: |
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| + 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
|
| + base::WeakPtr<net::NetworkQualityEstimator> network_quality_estimator_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(IONetworkQualityObserver); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_NET_NQE_IO_NETWORK_QUALITY_OBSERVER_H_ |