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

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: Fixed WereDataReductionProxiesBypassed 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 "extensions/common/constants.h" 46 #include "extensions/common/constants.h"
46 #include "net/base/host_port_pair.h" 47 #include "net/base/host_port_pair.h"
47 #include "net/base/net_errors.h" 48 #include "net/base/net_errors.h"
48 #include "net/base/net_log.h" 49 #include "net/base/net_log.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 287
287 } // namespace 288 } // namespace
288 289
289 ChromeNetworkDelegate::ChromeNetworkDelegate( 290 ChromeNetworkDelegate::ChromeNetworkDelegate(
290 extensions::EventRouterForwarder* event_router, 291 extensions::EventRouterForwarder* event_router,
291 BooleanPrefMember* enable_referrers) 292 BooleanPrefMember* enable_referrers)
292 : profile_(NULL), 293 : profile_(NULL),
293 enable_referrers_(enable_referrers), 294 enable_referrers_(enable_referrers),
294 enable_do_not_track_(NULL), 295 enable_do_not_track_(NULL),
295 force_google_safe_search_(NULL), 296 force_google_safe_search_(NULL),
297 data_reduction_proxy_enabled_(NULL),
296 #if defined(ENABLE_CONFIGURATION_POLICY) 298 #if defined(ENABLE_CONFIGURATION_POLICY)
297 url_blacklist_manager_(NULL), 299 url_blacklist_manager_(NULL),
298 #endif 300 #endif
299 domain_reliability_monitor_(NULL), 301 domain_reliability_monitor_(NULL),
300 received_content_length_(0), 302 received_content_length_(0),
301 original_content_length_(0), 303 original_content_length_(0),
302 first_request_(true), 304 first_request_(true),
303 prerender_tracker_(NULL), 305 prerender_tracker_(NULL),
304 data_reduction_proxy_params_(NULL), 306 data_reduction_proxy_params_(NULL),
305 data_reduction_proxy_usage_stats_(NULL), 307 data_reduction_proxy_usage_stats_(NULL),
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 const net::HttpRequestHeaders& headers) { 508 const net::HttpRequestHeaders& headers) {
507 extensions_delegate_->OnSendHeaders(request, headers); 509 extensions_delegate_->OnSendHeaders(request, headers);
508 } 510 }
509 511
510 int ChromeNetworkDelegate::OnHeadersReceived( 512 int ChromeNetworkDelegate::OnHeadersReceived(
511 net::URLRequest* request, 513 net::URLRequest* request,
512 const net::CompletionCallback& callback, 514 const net::CompletionCallback& callback,
513 const net::HttpResponseHeaders* original_response_headers, 515 const net::HttpResponseHeaders* original_response_headers,
514 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 516 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
515 GURL* allowed_unsafe_redirect_url) { 517 GURL* allowed_unsafe_redirect_url) {
518 net::ProxyService::DataReductionProxyBypassType bypass_type;
516 if (data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( 519 if (data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry(
517 data_reduction_proxy_params_, 520 data_reduction_proxy_params_,
518 request, 521 request,
519 original_response_headers, 522 original_response_headers,
520 override_response_headers)) { 523 override_response_headers,
524 &bypass_type)) {
525 data_reduction_proxy_usage_stats_->SetBypassType(bypass_type);
mef 2014/07/18 16:15:20 |data_reduction_proxy_usage_stats_| could be NULL.
megjablon 2014/07/18 22:38:46 Done.
521 return net::OK; 526 return net::OK;
522 } 527 }
523 528
524 return extensions_delegate_->OnHeadersReceived( 529 return extensions_delegate_->OnHeadersReceived(
525 request, 530 request,
526 callback, 531 callback,
527 original_response_headers, 532 original_response_headers,
528 override_response_headers, 533 override_response_headers,
529 allowed_unsafe_redirect_url); 534 allowed_unsafe_redirect_url);
530 } 535 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 int64 adjusted_original_content_length = 605 int64 adjusted_original_content_length =
601 data_reduction_proxy::GetAdjustedOriginalContentLength( 606 data_reduction_proxy::GetAdjustedOriginalContentLength(
602 request_type, original_content_length, 607 request_type, original_content_length,
603 received_content_length); 608 received_content_length);
604 AccumulateContentLength(received_content_length, 609 AccumulateContentLength(received_content_length,
605 adjusted_original_content_length, 610 adjusted_original_content_length,
606 request_type); 611 request_type);
607 RecordContentLengthHistograms(received_content_length, 612 RecordContentLengthHistograms(received_content_length,
608 original_content_length, 613 original_content_length,
609 freshness_lifetime); 614 freshness_lifetime);
615 if (data_reduction_proxy_enabled_) {
616 data_reduction_proxy_usage_stats_->RecordBypassedBytesHistograms(
mef 2014/07/18 16:15:20 |data_reduction_proxy_usage_stats_| could be NULL.
megjablon 2014/07/18 22:38:46 Done.
617 received_content_length, *request, *data_reduction_proxy_enabled_);
618 }
610 DVLOG(2) << __FUNCTION__ 619 DVLOG(2) << __FUNCTION__
611 << " received content length: " << received_content_length 620 << " received content length: " << received_content_length
612 << " original content length: " << original_content_length 621 << " original content length: " << original_content_length
613 << " url: " << request->url(); 622 << " url: " << request->url();
614 } 623 }
615 624
616 extensions_delegate_->OnCompleted(request, started); 625 extensions_delegate_->OnCompleted(request, started);
617 } else if (request->status().status() == net::URLRequestStatus::FAILED || 626 } else if (request->status().status() == net::URLRequestStatus::FAILED ||
618 request->status().status() == net::URLRequestStatus::CANCELED) { 627 request->status().status() == net::URLRequestStatus::CANCELED) {
619 extensions_delegate_->OnCompleted(request, started); 628 extensions_delegate_->OnCompleted(request, started);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 data_reduction_proxy::DataReductionProxyRequestType request_type) { 842 data_reduction_proxy::DataReductionProxyRequestType request_type) {
834 DCHECK_GE(received_content_length, 0); 843 DCHECK_GE(received_content_length, 0);
835 DCHECK_GE(original_content_length, 0); 844 DCHECK_GE(original_content_length, 0);
836 StoreAccumulatedContentLength(received_content_length, 845 StoreAccumulatedContentLength(received_content_length,
837 original_content_length, 846 original_content_length,
838 request_type, 847 request_type,
839 reinterpret_cast<Profile*>(profile_)); 848 reinterpret_cast<Profile*>(profile_));
840 received_content_length_ += received_content_length; 849 received_content_length_ += received_content_length;
841 original_content_length_ += original_content_length; 850 original_content_length_ += original_content_length;
842 } 851 }
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.h ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698