| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS
_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS
_H_ |
| 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS
_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS
_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/prefs/pref_member.h" | 10 #include "base/prefs/pref_member.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // |bypass_all| is true and as a "BypassType" otherwise. Records the event as | 28 // |bypass_all| is true and as a "BypassType" otherwise. Records the event as |
| 29 // "Primary" if |is_primary| is true and "Fallback" otherwise. | 29 // "Primary" if |is_primary| is true and "Fallback" otherwise. |
| 30 static void RecordDataReductionProxyBypassInfo( | 30 static void RecordDataReductionProxyBypassInfo( |
| 31 bool is_primary, | 31 bool is_primary, |
| 32 bool bypass_all, | 32 bool bypass_all, |
| 33 const net::ProxyServer& proxy_server, | 33 const net::ProxyServer& proxy_server, |
| 34 DataReductionProxyBypassType bypass_type); | 34 DataReductionProxyBypassType bypass_type); |
| 35 | 35 |
| 36 // MessageLoopProxy instance is owned by io_thread. |params| outlives | 36 // MessageLoopProxy instance is owned by io_thread. |params| outlives |
| 37 // this class instance. | 37 // this class instance. |
| 38 DataReductionProxyUsageStats(DataReductionProxyParams* params, | 38 DataReductionProxyUsageStats( |
| 39 base::MessageLoopProxy* ui_thread_proxy); | 39 DataReductionProxyParams* params, |
| 40 const scoped_refptr<base::MessageLoopProxy>& ui_thread_proxy); |
| 40 virtual ~DataReductionProxyUsageStats(); | 41 virtual ~DataReductionProxyUsageStats(); |
| 41 | 42 |
| 42 // Sets the callback to be called on the UI thread when the unavailability | 43 // Sets the callback to be called on the UI thread when the unavailability |
| 43 // status has changed. | 44 // status has changed. |
| 44 void set_unavailable_callback( | 45 void set_unavailable_callback( |
| 45 const base::Callback<void(bool)>& unavailable_callback) { | 46 const base::Callback<void(bool)>& unavailable_callback) { |
| 46 unavailable_callback_ = unavailable_callback; | 47 unavailable_callback_ = unavailable_callback; |
| 47 } | 48 } |
| 48 | 49 |
| 49 // Callback intended to be called from |ChromeNetworkDelegate| when a | 50 // Callback intended to be called from |ChromeNetworkDelegate| when a |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // routes. | 96 // routes. |
| 96 void MaybeNotifyUnavailability(); | 97 void MaybeNotifyUnavailability(); |
| 97 void NotifyUnavailabilityOnUIThread(bool unavailable); | 98 void NotifyUnavailabilityOnUIThread(bool unavailable); |
| 98 | 99 |
| 99 DataReductionProxyParams* data_reduction_proxy_params_; | 100 DataReductionProxyParams* data_reduction_proxy_params_; |
| 100 // The last reason for bypass as determined by | 101 // The last reason for bypass as determined by |
| 101 // MaybeBypassProxyAndPrepareToRetry | 102 // MaybeBypassProxyAndPrepareToRetry |
| 102 DataReductionProxyBypassType last_bypass_type_; | 103 DataReductionProxyBypassType last_bypass_type_; |
| 103 // True if the last request triggered the current bypass. | 104 // True if the last request triggered the current bypass. |
| 104 bool triggering_request_; | 105 bool triggering_request_; |
| 105 base::MessageLoopProxy* ui_thread_proxy_; | 106 const scoped_refptr<base::MessageLoopProxy> ui_thread_proxy_; |
| 106 | 107 |
| 107 // The following 2 fields are used to determine if data reduction proxy is | 108 // The following 2 fields are used to determine if data reduction proxy is |
| 108 // unreachable. We keep a count of requests which should go through | 109 // unreachable. We keep a count of requests which should go through |
| 109 // data request proxy, as well as those which actually do. The proxy is | 110 // data request proxy, as well as those which actually do. The proxy is |
| 110 // unreachable if no successful requests are made through it despite a | 111 // unreachable if no successful requests are made through it despite a |
| 111 // non-zero number of requests being eligible. | 112 // non-zero number of requests being eligible. |
| 112 | 113 |
| 113 // Count of requests which will be tried to be sent through data reduction | 114 // Count of requests which will be tried to be sent through data reduction |
| 114 // proxy. The count is only based on the config and not the bad proxy list. | 115 // proxy. The count is only based on the config and not the bad proxy list. |
| 115 // Explicit bypasses are not part of this count. This is the desired behavior | 116 // Explicit bypasses are not part of this count. This is the desired behavior |
| (...skipping 15 matching lines...) Expand all Loading... |
| 131 | 132 |
| 132 // Called when the unavailability status has changed. Runs on the UI thread. | 133 // Called when the unavailability status has changed. Runs on the UI thread. |
| 133 base::Callback<void(bool)> unavailable_callback_; | 134 base::Callback<void(bool)> unavailable_callback_; |
| 134 | 135 |
| 135 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats); | 136 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats); |
| 136 }; | 137 }; |
| 137 | 138 |
| 138 } // namespace data_reduction_proxy | 139 } // namespace data_reduction_proxy |
| 139 | 140 |
| 140 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_ST
ATS_H_ | 141 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_ST
ATS_H_ |
| OLD | NEW |