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

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 390533003: Bypassed Bytes UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Comments Created 6 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/net/chrome_network_delegate.h" 5 #include "chrome/browser/net/chrome_network_delegate.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/prerender/prerender_tracker.h" 29 #include "chrome/browser/prerender/prerender_tracker.h"
30 #include "chrome/browser/profiles/profile_manager.h" 30 #include "chrome/browser/profiles/profile_manager.h"
31 #include "chrome/browser/task_manager/task_manager.h" 31 #include "chrome/browser/task_manager/task_manager.h"
32 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h" 34 #include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_requ est_handler.h"
35 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h " 35 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h "
36 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 36 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" 37 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
38 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h" 38 #include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_sta ts.h"
39 #include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names .h"
39 #include "components/domain_reliability/monitor.h" 40 #include "components/domain_reliability/monitor.h"
40 #include "components/google/core/browser/google_util.h" 41 #include "components/google/core/browser/google_util.h"
41 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
42 #include "content/public/browser/render_frame_host.h" 43 #include "content/public/browser/render_frame_host.h"
43 #include "content/public/browser/render_view_host.h" 44 #include "content/public/browser/render_view_host.h"
44 #include "content/public/browser/resource_request_info.h" 45 #include "content/public/browser/resource_request_info.h"
45 #include "net/base/host_port_pair.h" 46 #include "net/base/host_port_pair.h"
46 #include "net/base/net_errors.h" 47 #include "net/base/net_errors.h"
47 #include "net/base/net_log.h" 48 #include "net/base/net_log.h"
48 #include "net/cookies/canonical_cookie.h" 49 #include "net/cookies/canonical_cookie.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 292
292 } // namespace 293 } // namespace
293 294
294 ChromeNetworkDelegate::ChromeNetworkDelegate( 295 ChromeNetworkDelegate::ChromeNetworkDelegate(
295 extensions::EventRouterForwarder* event_router, 296 extensions::EventRouterForwarder* event_router,
296 BooleanPrefMember* enable_referrers) 297 BooleanPrefMember* enable_referrers)
297 : profile_(NULL), 298 : profile_(NULL),
298 enable_referrers_(enable_referrers), 299 enable_referrers_(enable_referrers),
299 enable_do_not_track_(NULL), 300 enable_do_not_track_(NULL),
300 force_google_safe_search_(NULL), 301 force_google_safe_search_(NULL),
302 data_reduction_proxy_enabled_(NULL),
301 #if defined(ENABLE_CONFIGURATION_POLICY) 303 #if defined(ENABLE_CONFIGURATION_POLICY)
302 url_blacklist_manager_(NULL), 304 url_blacklist_manager_(NULL),
303 #endif 305 #endif
304 domain_reliability_monitor_(NULL), 306 domain_reliability_monitor_(NULL),
305 received_content_length_(0), 307 received_content_length_(0),
306 original_content_length_(0), 308 original_content_length_(0),
307 first_request_(true), 309 first_request_(true),
308 prerender_tracker_(NULL), 310 prerender_tracker_(NULL),
309 data_reduction_proxy_params_(NULL), 311 data_reduction_proxy_params_(NULL),
310 data_reduction_proxy_usage_stats_(NULL), 312 data_reduction_proxy_usage_stats_(NULL),
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 const net::HttpRequestHeaders& headers) { 515 const net::HttpRequestHeaders& headers) {
514 extensions_delegate_->OnSendHeaders(request, headers); 516 extensions_delegate_->OnSendHeaders(request, headers);
515 } 517 }
516 518
517 int ChromeNetworkDelegate::OnHeadersReceived( 519 int ChromeNetworkDelegate::OnHeadersReceived(
518 net::URLRequest* request, 520 net::URLRequest* request,
519 const net::CompletionCallback& callback, 521 const net::CompletionCallback& callback,
520 const net::HttpResponseHeaders* original_response_headers, 522 const net::HttpResponseHeaders* original_response_headers,
521 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 523 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
522 GURL* allowed_unsafe_redirect_url) { 524 GURL* allowed_unsafe_redirect_url) {
525 net::ProxyService::DataReductionProxyBypassType bypass_type;
523 if (data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( 526 if (data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry(
524 data_reduction_proxy_params_, 527 data_reduction_proxy_params_,
525 request, 528 request,
526 original_response_headers, 529 original_response_headers,
527 override_response_headers)) { 530 override_response_headers,
531 &bypass_type)) {
532 if (data_reduction_proxy_usage_stats_)
533 data_reduction_proxy_usage_stats_->SetBypassType(bypass_type);
528 return net::OK; 534 return net::OK;
529 } 535 }
530 536
531 return extensions_delegate_->OnHeadersReceived( 537 return extensions_delegate_->OnHeadersReceived(
532 request, 538 request,
533 callback, 539 callback,
534 original_response_headers, 540 original_response_headers,
535 override_response_headers, 541 override_response_headers,
536 allowed_unsafe_redirect_url); 542 allowed_unsafe_redirect_url);
537 } 543 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 int64 adjusted_original_content_length = 613 int64 adjusted_original_content_length =
608 data_reduction_proxy::GetAdjustedOriginalContentLength( 614 data_reduction_proxy::GetAdjustedOriginalContentLength(
609 request_type, original_content_length, 615 request_type, original_content_length,
610 received_content_length); 616 received_content_length);
611 AccumulateContentLength(received_content_length, 617 AccumulateContentLength(received_content_length,
612 adjusted_original_content_length, 618 adjusted_original_content_length,
613 request_type); 619 request_type);
614 RecordContentLengthHistograms(received_content_length, 620 RecordContentLengthHistograms(received_content_length,
615 original_content_length, 621 original_content_length,
616 freshness_lifetime); 622 freshness_lifetime);
623 if (data_reduction_proxy_enabled_ && data_reduction_proxy_usage_stats_) {
624 data_reduction_proxy_usage_stats_->RecordBypassedBytesHistograms(
625 *request, *data_reduction_proxy_enabled_);
626 }
617 DVLOG(2) << __FUNCTION__ 627 DVLOG(2) << __FUNCTION__
618 << " received content length: " << received_content_length 628 << " received content length: " << received_content_length
619 << " original content length: " << original_content_length 629 << " original content length: " << original_content_length
620 << " url: " << request->url(); 630 << " url: " << request->url();
621 } 631 }
622 632
623 extensions_delegate_->OnCompleted(request, started); 633 extensions_delegate_->OnCompleted(request, started);
624 } else if (request->status().status() == net::URLRequestStatus::FAILED || 634 } else if (request->status().status() == net::URLRequestStatus::FAILED ||
625 request->status().status() == net::URLRequestStatus::CANCELED) { 635 request->status().status() == net::URLRequestStatus::CANCELED) {
626 extensions_delegate_->OnCompleted(request, started); 636 extensions_delegate_->OnCompleted(request, started);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 data_reduction_proxy::DataReductionProxyRequestType request_type) { 854 data_reduction_proxy::DataReductionProxyRequestType request_type) {
845 DCHECK_GE(received_content_length, 0); 855 DCHECK_GE(received_content_length, 0);
846 DCHECK_GE(original_content_length, 0); 856 DCHECK_GE(original_content_length, 0);
847 StoreAccumulatedContentLength(received_content_length, 857 StoreAccumulatedContentLength(received_content_length,
848 original_content_length, 858 original_content_length,
849 request_type, 859 request_type,
850 reinterpret_cast<Profile*>(profile_)); 860 reinterpret_cast<Profile*>(profile_));
851 received_content_length_ += received_content_length; 861 received_content_length_ += received_content_length;
852 original_content_length_ += original_content_length; 862 original_content_length_ += original_content_length;
853 } 863 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698