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 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_stats.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_stats.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" | 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 unavailable_(false) { | 110 unavailable_(false) { |
111 DCHECK(config); | 111 DCHECK(config); |
112 NetworkChangeNotifier::AddNetworkChangeObserver(this); | 112 NetworkChangeNotifier::AddNetworkChangeObserver(this); |
113 } | 113 } |
114 | 114 |
115 DataReductionProxyBypassStats::~DataReductionProxyBypassStats() { | 115 DataReductionProxyBypassStats::~DataReductionProxyBypassStats() { |
116 NetworkChangeNotifier::RemoveNetworkChangeObserver(this); | 116 NetworkChangeNotifier::RemoveNetworkChangeObserver(this); |
117 } | 117 } |
118 | 118 |
119 void DataReductionProxyBypassStats::OnUrlRequestCompleted( | 119 void DataReductionProxyBypassStats::OnUrlRequestCompleted( |
120 const net::URLRequest* request, bool started) { | 120 const net::URLRequest* request, |
| 121 bool started, |
| 122 int net_error) { |
121 DataReductionProxyTypeInfo proxy_info; | 123 DataReductionProxyTypeInfo proxy_info; |
122 // Ignore requests that did not use the data reduction proxy. The check for | 124 // Ignore requests that did not use the data reduction proxy. The check for |
123 // LOAD_BYPASS_PROXY is necessary because the proxy_server() in the |request| | 125 // LOAD_BYPASS_PROXY is necessary because the proxy_server() in the |request| |
124 // might still be set to the data reduction proxy if |request| was retried | 126 // might still be set to the data reduction proxy if |request| was retried |
125 // over direct and a network error occurred while retrying it. | 127 // over direct and a network error occurred while retrying it. |
126 if (data_reduction_proxy_config_->WasDataReductionProxyUsed(request, | 128 if (data_reduction_proxy_config_->WasDataReductionProxyUsed(request, |
127 &proxy_info) && | 129 &proxy_info) && |
128 (request->load_flags() & net::LOAD_BYPASS_PROXY) == 0 && | 130 (request->load_flags() & net::LOAD_BYPASS_PROXY) == 0 && |
129 request->status().status() == net::URLRequestStatus::SUCCESS) { | 131 net_error == net::OK) { |
130 successful_requests_through_proxy_count_++; | 132 successful_requests_through_proxy_count_++; |
131 NotifyUnavailabilityIfChanged(); | 133 NotifyUnavailabilityIfChanged(); |
132 | 134 |
133 // Report the success counts. | 135 // Report the success counts. |
134 UMA_HISTOGRAM_COUNTS_100( | 136 UMA_HISTOGRAM_COUNTS_100( |
135 "DataReductionProxy.SuccessfulRequestCompletionCounts", | 137 "DataReductionProxy.SuccessfulRequestCompletionCounts", |
136 proxy_info.proxy_index); | 138 proxy_info.proxy_index); |
137 if (request->load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) { | 139 if (request->load_flags() & net::LOAD_MAIN_FRAME_DEPRECATED) { |
138 UMA_HISTOGRAM_COUNTS_100( | 140 UMA_HISTOGRAM_COUNTS_100( |
139 "DataReductionProxy.SuccessfulRequestCompletionCounts.MainFrame", | 141 "DataReductionProxy.SuccessfulRequestCompletionCounts.MainFrame", |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 content_length); | 488 content_length); |
487 break; | 489 break; |
488 default: | 490 default: |
489 break; | 491 break; |
490 } | 492 } |
491 break; | 493 break; |
492 } | 494 } |
493 } | 495 } |
494 | 496 |
495 } // namespace data_reduction_proxy | 497 } // namespace data_reduction_proxy |
OLD | NEW |