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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host.cc

Issue 6990058: Switch to the new CustomHistogram::ArrayToCustomRanges() utility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again. Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « base/metrics/histogram.cc ('k') | net/base/host_resolver_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/renderer_host/resource_dispatcher_host.h" 7 #include "content/browser/renderer_host/resource_dispatcher_host.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 // Maximum number of pending data messages sent to the renderer at any 115 // Maximum number of pending data messages sent to the renderer at any
116 // given time for a given request. 116 // given time for a given request.
117 const int kMaxPendingDataMessages = 20; 117 const int kMaxPendingDataMessages = 20;
118 118
119 // Maximum byte "cost" of all the outstanding requests for a renderer. 119 // Maximum byte "cost" of all the outstanding requests for a renderer.
120 // See delcaration of |max_outstanding_requests_cost_per_process_| for details. 120 // See delcaration of |max_outstanding_requests_cost_per_process_| for details.
121 // This bound is 25MB, which allows for around 6000 outstanding requests. 121 // This bound is 25MB, which allows for around 6000 outstanding requests.
122 const int kMaxOutstandingRequestsCostPerProcess = 26214400; 122 const int kMaxOutstandingRequestsCostPerProcess = 26214400;
123 123
124 // All possible error codes from the network module. Note that the error codes
125 // are all positive (since histograms expect positive sample values).
126 const int kAllNetErrorCodes[] = {
127 #define NET_ERROR(label, value) -(value),
128 #include "net/base/net_error_list.h"
129 #undef NET_ERROR
130 };
131
124 // Aborts a request before an URLRequest has actually been created. 132 // Aborts a request before an URLRequest has actually been created.
125 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, 133 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter,
126 IPC::Message* sync_result, 134 IPC::Message* sync_result,
127 int route_id, 135 int route_id,
128 int request_id) { 136 int request_id) {
129 net::URLRequestStatus status(net::URLRequestStatus::FAILED, 137 net::URLRequestStatus status(net::URLRequestStatus::FAILED,
130 net::ERR_ABORTED); 138 net::ERR_ABORTED);
131 if (sync_result) { 139 if (sync_result) {
132 SyncLoadResult result; 140 SyncLoadResult result;
133 result.status = status; 141 result.status = status;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 response->response_head.was_npn_negotiated = request->was_npn_negotiated(); 210 response->response_head.was_npn_negotiated = request->was_npn_negotiated();
203 response->response_head.was_fetched_via_proxy = 211 response->response_head.was_fetched_via_proxy =
204 request->was_fetched_via_proxy(); 212 request->was_fetched_via_proxy();
205 response->response_head.socket_address = request->GetSocketAddress(); 213 response->response_head.socket_address = request->GetSocketAddress();
206 appcache::AppCacheInterceptor::GetExtraResponseInfo( 214 appcache::AppCacheInterceptor::GetExtraResponseInfo(
207 request, 215 request,
208 &response->response_head.appcache_id, 216 &response->response_head.appcache_id,
209 &response->response_head.appcache_manifest_url); 217 &response->response_head.appcache_manifest_url);
210 } 218 }
211 219
212 // Returns a list of all the possible error codes from the network module.
213 // Note that the error codes are all positive (since histograms expect positive
214 // sample values).
215 std::vector<int> GetAllNetErrorCodes() {
216 std::vector<int> all_error_codes;
217 #define NET_ERROR(label, value) all_error_codes.push_back(-(value));
218 #include "net/base/net_error_list.h"
219 #undef NET_ERROR
220 return all_error_codes;
221 }
222
223 void RemoveDownloadFileFromChildSecurityPolicy(int child_id, 220 void RemoveDownloadFileFromChildSecurityPolicy(int child_id,
224 const FilePath& path) { 221 const FilePath& path) {
225 ChildProcessSecurityPolicy::GetInstance()->RevokeAllPermissionsForFile( 222 ChildProcessSecurityPolicy::GetInstance()->RevokeAllPermissionsForFile(
226 child_id, path); 223 child_id, path);
227 } 224 }
228 225
229 #if defined(OS_WIN) 226 #if defined(OS_WIN)
230 #pragma warning(disable: 4748) 227 #pragma warning(disable: 4748)
231 #pragma optimize("", off) 228 #pragma optimize("", off)
232 #endif 229 #endif
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 1572
1576 void ResourceDispatcherHost::OnResponseCompleted(net::URLRequest* request) { 1573 void ResourceDispatcherHost::OnResponseCompleted(net::URLRequest* request) {
1577 VLOG(1) << "OnResponseCompleted: " << request->url().spec(); 1574 VLOG(1) << "OnResponseCompleted: " << request->url().spec();
1578 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); 1575 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
1579 1576
1580 // If the load for a main frame has failed, track it in a histogram, 1577 // If the load for a main frame has failed, track it in a histogram,
1581 // since it will probably cause the user to see an error page. 1578 // since it will probably cause the user to see an error page.
1582 if (!request->status().is_success() && 1579 if (!request->status().is_success() &&
1583 info->resource_type() == ResourceType::MAIN_FRAME && 1580 info->resource_type() == ResourceType::MAIN_FRAME &&
1584 request->status().os_error() != net::ERR_ABORTED) { 1581 request->status().os_error() != net::ERR_ABORTED) {
1585 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.ErrorCodesForMainFrame", 1582 // This enumeration has "2" appended to its name to distinguish it from
1586 -request->status().os_error(), 1583 // its original version. We changed the buckets at one point (added
1587 GetAllNetErrorCodes()); 1584 // guard buckets by using CustomHistogram::ArrayToCustomRanges).
1585 UMA_HISTOGRAM_CUSTOM_ENUMERATION(
1586 "Net.ErrorCodesForMainFrame2",
1587 -request->status().os_error(),
1588 base::CustomHistogram::ArrayToCustomRanges(
1589 kAllNetErrorCodes, arraysize(kAllNetErrorCodes)));
1588 } 1590 }
1589 1591
1590 std::string security_info; 1592 std::string security_info;
1591 const net::SSLInfo& ssl_info = request->ssl_info(); 1593 const net::SSLInfo& ssl_info = request->ssl_info();
1592 if (ssl_info.cert != NULL) { 1594 if (ssl_info.cert != NULL) {
1593 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert, 1595 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert,
1594 info->child_id()); 1596 info->child_id());
1595 security_info = SSLManager::SerializeSecurityInfo( 1597 security_info = SSLManager::SerializeSecurityInfo(
1596 cert_id, ssl_info.cert_status, ssl_info.security_bits, 1598 cert_id, ssl_info.cert_status, ssl_info.security_bits,
1597 ssl_info.connection_status); 1599 ssl_info.connection_status);
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2015 return is_prefetch_enabled_; 2017 return is_prefetch_enabled_;
2016 } 2018 }
2017 2019
2018 // static 2020 // static
2019 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { 2021 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) {
2020 is_prefetch_enabled_ = value; 2022 is_prefetch_enabled_ = value;
2021 } 2023 }
2022 2024
2023 // static 2025 // static
2024 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; 2026 bool ResourceDispatcherHost::is_prefetch_enabled_ = false;
OLDNEW
« no previous file with comments | « base/metrics/histogram.cc ('k') | net/base/host_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698