| OLD | NEW |
| 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 // 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/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // net::LOAD_MAYBE_USER_GESTURE load flag. This is a fairly arbitrary | 121 // net::LOAD_MAYBE_USER_GESTURE load flag. This is a fairly arbitrary |
| 122 // guess at how long to expect direct impact from a user gesture, but | 122 // guess at how long to expect direct impact from a user gesture, but |
| 123 // this should be OK as the load flag is a best-effort thing only, | 123 // this should be OK as the load flag is a best-effort thing only, |
| 124 // rather than being intended as fully accurate. | 124 // rather than being intended as fully accurate. |
| 125 const int kUserGestureWindowMs = 3500; | 125 const int kUserGestureWindowMs = 3500; |
| 126 | 126 |
| 127 // Ratio of |max_num_in_flight_requests_| that any one renderer is allowed to | 127 // Ratio of |max_num_in_flight_requests_| that any one renderer is allowed to |
| 128 // use. Arbitrarily chosen. | 128 // use. Arbitrarily chosen. |
| 129 const double kMaxRequestsPerProcessRatio = 0.45; | 129 const double kMaxRequestsPerProcessRatio = 0.45; |
| 130 | 130 |
| 131 // All possible error codes from the network module. Note that the error codes | |
| 132 // are all positive (since histograms expect positive sample values). | |
| 133 const int kAllNetErrorCodes[] = { | |
| 134 #define NET_ERROR(label, value) -(value), | |
| 135 #include "net/base/net_error_list.h" | |
| 136 #undef NET_ERROR | |
| 137 }; | |
| 138 | |
| 139 // Aborts a request before an URLRequest has actually been created. | 131 // Aborts a request before an URLRequest has actually been created. |
| 140 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, | 132 void AbortRequestBeforeItStarts(ResourceMessageFilter* filter, |
| 141 IPC::Message* sync_result, | 133 IPC::Message* sync_result, |
| 142 int request_id) { | 134 int request_id) { |
| 143 if (sync_result) { | 135 if (sync_result) { |
| 144 SyncLoadResult result; | 136 SyncLoadResult result; |
| 145 result.error_code = net::ERR_ABORTED; | 137 result.error_code = net::ERR_ABORTED; |
| 146 ResourceHostMsg_SyncLoad::WriteReplyParams(sync_result, result); | 138 ResourceHostMsg_SyncLoad::WriteReplyParams(sync_result, result); |
| 147 filter->Send(sync_result); | 139 filter->Send(sync_result); |
| 148 } else { | 140 } else { |
| (...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1868 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) | 1860 if ((load_flags & net::LOAD_REPORT_RAW_HEADERS) |
| 1869 && !policy->CanReadRawCookies(child_id)) { | 1861 && !policy->CanReadRawCookies(child_id)) { |
| 1870 VLOG(1) << "Denied unauthorized request for raw headers"; | 1862 VLOG(1) << "Denied unauthorized request for raw headers"; |
| 1871 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; | 1863 load_flags &= ~net::LOAD_REPORT_RAW_HEADERS; |
| 1872 } | 1864 } |
| 1873 | 1865 |
| 1874 return load_flags; | 1866 return load_flags; |
| 1875 } | 1867 } |
| 1876 | 1868 |
| 1877 } // namespace content | 1869 } // namespace content |
| OLD | NEW |