Chromium Code Reviews| Index: content/browser/loader/resource_dispatcher_host_impl.cc |
| diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc |
| index 6b3e7706856ae695d8ca4f5b78da5bc023248c94..5a0904a124fe6994b485ab96fe1165090edae3f3 100644 |
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc |
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
| @@ -100,6 +100,7 @@ |
| #include "net/base/upload_data_stream.h" |
| #include "net/cert/cert_status_flags.h" |
| #include "net/cookies/cookie_monster.h" |
| +#include "net/http/http_request_headers.h" |
| #include "net/http/http_response_headers.h" |
| #include "net/http/http_response_info.h" |
| #include "net/ssl/client_cert_store.h" |
| @@ -113,6 +114,7 @@ |
| #include "storage/browser/blob/shareable_file_reference.h" |
| #include "storage/browser/fileapi/file_permission_policy.h" |
| #include "storage/browser/fileapi/file_system_context.h" |
| +#include "url/third_party/mozilla/url_parse.h" |
| #include "url/url_constants.h" |
| using base::Time; |
| @@ -2330,10 +2332,15 @@ int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
| // The following fields should be a minor size contribution (experimentally |
| // on the order of 100). However since they are variable length, it could |
| // in theory be a sizeable contribution. |
| - int strings_cost = request->extra_request_headers().ToString().size() + |
| - request->original_url().spec().size() + |
| - request->referrer().size() + |
| - request->method().size(); |
| + int header_length = 0; |
|
Randy Smith (Not in Mondays)
2016/11/16 13:07:04
Suggestion: Make this declaration string_cost and
Charlie Harrison
2016/11/16 13:55:44
Done.
|
| + for (net::HttpRequestHeaders::Iterator it(request->extra_request_headers()); |
| + it.GetNext();) { |
| + header_length += it.name().length() + it.value().length(); |
| + } |
| + int strings_cost = |
| + header_length + |
| + request->original_url().parsed_for_possibly_invalid_spec().Length() + |
| + request->referrer().size() + request->method().size(); |
| // Note that this expression will typically be dominated by: |
| // |kAvgBytesPerOutstandingRequest|. |