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

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

Issue 390533003: Bypassed Bytes UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moving #if defined(SPDY_PROXY_AUTH_ORIGIN) Created 6 years, 4 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_protocol. h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
10 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" 10 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h"
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 34
35 } // namespace 35 } // namespace
36 36
37 namespace data_reduction_proxy { 37 namespace data_reduction_proxy {
38 38
39 bool MaybeBypassProxyAndPrepareToRetry( 39 bool MaybeBypassProxyAndPrepareToRetry(
40 const DataReductionProxyParams* data_reduction_proxy_params, 40 const DataReductionProxyParams* data_reduction_proxy_params,
41 net::URLRequest* request, 41 net::URLRequest* request,
42 const net::HttpResponseHeaders* original_response_headers, 42 const net::HttpResponseHeaders* original_response_headers,
43 scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { 43 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
44 net::ProxyService::DataReductionProxyBypassType* proxy_bypass_type) {
44 if (!data_reduction_proxy_params) 45 if (!data_reduction_proxy_params)
45 return false; 46 return false;
46 std::pair<GURL, GURL> data_reduction_proxies; 47 std::pair<GURL, GURL> data_reduction_proxies;
47 if (!data_reduction_proxy_params->WasDataReductionProxyUsed( 48 if (!data_reduction_proxy_params->WasDataReductionProxyUsed(
48 request, &data_reduction_proxies)) { 49 request, &data_reduction_proxies)) {
49 return false; 50 return false;
50 } 51 }
51 52
52 // Empty implies either that the request was served from cache or that 53 // Empty implies either that the request was served from cache or that
53 // request was served directly from the origin. 54 // request was served directly from the origin.
54 if (request->proxy_server().IsEmpty()) 55 if (request->proxy_server().IsEmpty())
55 return false; 56 return false;
56 57
57 if (data_reduction_proxies.first.is_empty()) 58 if (data_reduction_proxies.first.is_empty())
58 return false; 59 return false;
59 60
60 DataReductionProxyInfo data_reduction_proxy_info; 61 DataReductionProxyInfo data_reduction_proxy_info;
61 net::ProxyService::DataReductionProxyBypassType bypass_type = 62 net::ProxyService::DataReductionProxyBypassType bypass_type =
62 GetDataReductionProxyBypassType( 63 GetDataReductionProxyBypassType(original_response_headers,
63 original_response_headers, &data_reduction_proxy_info); 64 &data_reduction_proxy_info);
64 if (bypass_type == net::ProxyService::BYPASS_EVENT_TYPE_MAX) { 65 if (proxy_bypass_type)
66 *proxy_bypass_type = bypass_type;
67 if (bypass_type == net::ProxyService::BYPASS_EVENT_TYPE_MAX)
65 return false; 68 return false;
66 }
67 69
68 DCHECK(request->context()); 70 DCHECK(request->context());
69 DCHECK(request->context()->proxy_service()); 71 DCHECK(request->context()->proxy_service());
70 net::ProxyServer proxy_server; 72 net::ProxyServer proxy_server;
71 SetProxyServerFromGURL(data_reduction_proxies.first, &proxy_server); 73 SetProxyServerFromGURL(data_reduction_proxies.first, &proxy_server);
72 request->context()->proxy_service()->RecordDataReductionProxyBypassInfo( 74 request->context()->proxy_service()->RecordDataReductionProxyBypassInfo(
73 !data_reduction_proxies.second.is_empty(), 75 !data_reduction_proxies.second.is_empty(),
74 data_reduction_proxy_info.bypass_all, 76 data_reduction_proxy_info.bypass_all,
75 proxy_server, 77 proxy_server,
76 bypass_type); 78 bypass_type);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 net::ProxyService* proxy_service = request->context()->proxy_service(); 166 net::ProxyService* proxy_service = request->context()->proxy_service();
165 DCHECK(proxy_service); 167 DCHECK(proxy_service);
166 168
167 proxy_service->MarkProxiesAsBadUntil(proxy_info, 169 proxy_service->MarkProxiesAsBadUntil(proxy_info,
168 bypass_duration, 170 bypass_duration,
169 fallback, 171 fallback,
170 request->net_log()); 172 request->net_log());
171 } 173 }
172 174
173 } // namespace data_reduction_proxy 175 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698