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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc

Issue 286013002: Added alternative configuration for the data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK fix Created 6 years, 6 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 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/browser/data_reduction_proxy_metrics.h " 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h "
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 private: 294 private:
295 DailyContentLengthUpdate original_; 295 DailyContentLengthUpdate original_;
296 DailyContentLengthUpdate received_; 296 DailyContentLengthUpdate received_;
297 }; 297 };
298 298
299 // Returns true if the request is bypassed by all configured data reduction 299 // Returns true if the request is bypassed by all configured data reduction
300 // proxies. It returns the bypass delay in delay_seconds (if not NULL). If 300 // proxies. It returns the bypass delay in delay_seconds (if not NULL). If
301 // the request is bypassed by more than one proxy, delay_seconds returns 301 // the request is bypassed by more than one proxy, delay_seconds returns
302 // shortest delay. 302 // shortest delay.
303 bool IsBypassRequest(const net::URLRequest* request, int64* delay_seconds) { 303 bool IsBypassRequest(const net::URLRequest* request, int64* delay_seconds) {
304 DataReductionProxySettings::DataReductionProxyList proxies = 304 // TODO(bengr): Add support for other data reduction proxy configurations.
305 DataReductionProxySettings::GetDataReductionProxies(); 305 #if defined(SPDY_PROXY_AUTH_ORIGIN)
306 DataReductionProxyParams params(
307 DataReductionProxyParams::kAllowed |
308 DataReductionProxyParams::kFallbackAllowed |
309 DataReductionProxyParams::kPromoAllowed);
310 DataReductionProxyParams::DataReductionProxyList proxies =
311 params.GetAllowedProxies();
306 if (proxies.size() == 0) 312 if (proxies.size() == 0)
307 return false; 313 return false;
308 314
309 if (request == NULL || request->context() == NULL || 315 if (request == NULL || request->context() == NULL ||
310 request->context()->proxy_service() == NULL) { 316 request->context()->proxy_service() == NULL) {
311 return false; 317 return false;
312 } 318 }
313 319
314 const net::ProxyRetryInfoMap& retry_map = 320 const net::ProxyRetryInfoMap& retry_map =
315 request->context()->proxy_service()->proxy_retry_info(); 321 request->context()->proxy_service()->proxy_retry_info();
(...skipping 12 matching lines...) Expand all
328 if (found == retry_map.end()) 334 if (found == retry_map.end())
329 return false; 335 return false;
330 if (shortest_delay == 0 || 336 if (shortest_delay == 0 ||
331 shortest_delay > found->second.current_delay.InSeconds()) { 337 shortest_delay > found->second.current_delay.InSeconds()) {
332 shortest_delay = found->second.current_delay.InSeconds(); 338 shortest_delay = found->second.current_delay.InSeconds();
333 } 339 }
334 } 340 }
335 if (delay_seconds != NULL) 341 if (delay_seconds != NULL)
336 *delay_seconds = shortest_delay; 342 *delay_seconds = shortest_delay;
337 return true; 343 return true;
344 #else
345 return false;
346 #endif
338 } 347 }
339 348
340 } // namespace 349 } // namespace
341 350
342 DataReductionProxyRequestType GetDataReductionProxyRequestType( 351 DataReductionProxyRequestType GetDataReductionProxyRequestType(
343 const net::URLRequest* request) { 352 const net::URLRequest* request) {
344 if (request->url().SchemeIs("https")) 353 if (request->url().SchemeIs("https"))
345 return HTTPS; 354 return HTTPS;
346 if (!request->url().SchemeIs("http")) { 355 if (!request->url().SchemeIs("http")) {
347 NOTREACHED(); 356 NOTREACHED();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 UpdateContentLengthPrefsForDataReductionProxy( 540 UpdateContentLengthPrefsForDataReductionProxy(
532 received_content_length, 541 received_content_length,
533 original_content_length, 542 original_content_length,
534 with_data_reduction_proxy_enabled, 543 with_data_reduction_proxy_enabled,
535 request_type, 544 request_type,
536 base::Time::Now(), 545 base::Time::Now(),
537 prefs); 546 prefs);
538 } 547 }
539 548
540 } // namespace data_reduction_proxy 549 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698