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

Side by Side Diff: chrome/browser/net/nqe/io_network_quality_observer.h

Issue 2103323007: Exposing NQE on the Browser UI thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698