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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h

Issue 949533004: Rename DataReductionProxyStatisticsPrefs to DataReductionProxyCompressionStats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SERVIC E_H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SERVIC E_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SERVIC E_H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SERVIC E_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 14 matching lines...) Expand all
25 class URLRequestContextGetter; 25 class URLRequestContextGetter;
26 class URLRequestStatus; 26 class URLRequestStatus;
27 } 27 }
28 28
29 namespace data_reduction_proxy { 29 namespace data_reduction_proxy {
30 30
31 typedef base::Callback<void(const std::string&, const net::URLRequestStatus&)> 31 typedef base::Callback<void(const std::string&, const net::URLRequestStatus&)>
32 FetcherResponseCallback; 32 FetcherResponseCallback;
33 33
34 class DataReductionProxySettings; 34 class DataReductionProxySettings;
35 class DataReductionProxyStatisticsPrefs; 35 class DataReductionProxyCompressionStats;
36 36
37 37
38 // Contains and initializes all Data Reduction Proxy objects that have a 38 // Contains and initializes all Data Reduction Proxy objects that have a
39 // lifetime based on the UI thread. 39 // lifetime based on the UI thread.
40 class DataReductionProxyService : public base::NonThreadSafe, 40 class DataReductionProxyService : public base::NonThreadSafe,
41 public net::URLFetcherDelegate { 41 public net::URLFetcherDelegate {
42 public: 42 public:
43 // The caller must ensure that |settings| and |request_context| remain alive 43 // The caller must ensure that |settings| and |request_context| remain alive
44 // for the lifetime of the |DataReductionProxyService| instance. This instance 44 // for the lifetime of the |DataReductionProxyService| instance. This instance
45 // will take ownership of |statistics_prefs|. 45 // will take ownership of |statistics_prefs|.
46 // TODO(jeremyim): DataReductionProxyService should own 46 // TODO(jeremyim): DataReductionProxyService should own
47 // DataReductionProxySettings and not vice versa. 47 // DataReductionProxySettings and not vice versa.
48 DataReductionProxyService( 48 DataReductionProxyService(
49 scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs, 49 scoped_ptr<DataReductionProxyCompressionStats> statistics_prefs,
bengr 2015/02/27 22:43:32 You'll want to change every variable name accordin
zhuoyu.qian 2015/02/28 06:16:03 Done.
50 DataReductionProxySettings* settings, 50 DataReductionProxySettings* settings,
51 net::URLRequestContextGetter* request_context_getter); 51 net::URLRequestContextGetter* request_context_getter);
52 52
53 ~DataReductionProxyService() override; 53 ~DataReductionProxyService() override;
54 54
55 void Shutdown(); 55 void Shutdown();
56 56
57 // Requests the given |probe_url|. Upon completion, returns the results to the 57 // Requests the given |probe_url|. Upon completion, returns the results to the
58 // caller via the |fetcher_callback|. Virtualized for unit testing. 58 // caller via the |fetcher_callback|. Virtualized for unit testing.
59 virtual void CheckProbeURL(const GURL& probe_url, 59 virtual void CheckProbeURL(const GURL& probe_url,
60 FetcherResponseCallback fetcher_callback); 60 FetcherResponseCallback fetcher_callback);
61 61
62 // Constructs statistics prefs. This should not be called if a valid 62 // Constructs statistics prefs. This should not be called if a valid
bengr 2015/02/27 22:43:32 "compression stats", here and below.
zhuoyu.qian 2015/02/28 06:16:03 Done.
63 // statistics prefs is passed into the constructor. 63 // statistics prefs is passed into the constructor.
64 void EnableCompressionStatisticsLogging( 64 void EnableCompressionStatisticsLogging(
65 PrefService* prefs, 65 PrefService* prefs,
66 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, 66 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
67 const base::TimeDelta& commit_delay); 67 const base::TimeDelta& commit_delay);
68 68
69 DataReductionProxyStatisticsPrefs* statistics_prefs() const { 69 DataReductionProxyCompressionStats* statistics_prefs() const {
bengr 2015/02/27 22:43:33 This function should be called compression_stats()
zhuoyu.qian 2015/02/28 06:16:03 Done.
70 return statistics_prefs_.get(); 70 return statistics_prefs_.get();
bengr 2015/02/27 22:43:33 compression_stats_
zhuoyu.qian 2015/02/28 06:16:03 Done.
71 } 71 }
72 72
73 DataReductionProxySettings* settings() const { 73 DataReductionProxySettings* settings() const {
74 return settings_; 74 return settings_;
75 } 75 }
76 76
77 base::WeakPtr<DataReductionProxyService> GetWeakPtr(); 77 base::WeakPtr<DataReductionProxyService> GetWeakPtr();
78 78
79 protected: 79 protected:
80 // Virtualized for testing. Returns a fetcher for the probe to check if OK for 80 // Virtualized for testing. Returns a fetcher for the probe to check if OK for
81 // the proxy to use TLS. 81 // the proxy to use TLS.
82 virtual net::URLFetcher* GetURLFetcherForProbe(const GURL& probe_url); 82 virtual net::URLFetcher* GetURLFetcherForProbe(const GURL& probe_url);
83 83
84 private: 84 private:
85 // net::URLFetcherDelegate: 85 // net::URLFetcherDelegate:
86 void OnURLFetchComplete(const net::URLFetcher* source) override; 86 void OnURLFetchComplete(const net::URLFetcher* source) override;
87 87
88 net::URLRequestContextGetter* url_request_context_getter_; 88 net::URLRequestContextGetter* url_request_context_getter_;
89 89
90 // The URLFetcher being used for the canary check. 90 // The URLFetcher being used for the canary check.
91 scoped_ptr<net::URLFetcher> fetcher_; 91 scoped_ptr<net::URLFetcher> fetcher_;
92 FetcherResponseCallback fetcher_callback_; 92 FetcherResponseCallback fetcher_callback_;
93 93
94 // Tracks compression statistics to be displayed to the user. 94 // Tracks compression statistics to be displayed to the user.
95 scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs_; 95 scoped_ptr<DataReductionProxyCompressionStats> statistics_prefs_;
96 96
97 DataReductionProxySettings* settings_; 97 DataReductionProxySettings* settings_;
98 98
99 base::WeakPtrFactory<DataReductionProxyService> weak_factory_; 99 base::WeakPtrFactory<DataReductionProxyService> weak_factory_;
100 100
101 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyService); 101 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyService);
102 }; 102 };
103 103
104 } // namespace data_reduction_proxy 104 } // namespace data_reduction_proxy
105 105
106 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SER VICE_H_ 106 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SER VICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698