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 <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2264 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, | 2264 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, |
2265 mojom::URLLoaderClientPtr url_loader_client, | 2265 mojom::URLLoaderClientPtr url_loader_client, |
2266 ResourceMessageFilter* filter) { | 2266 ResourceMessageFilter* filter) { |
2267 filter_ = filter; | 2267 filter_ = filter; |
2268 OnRequestResourceInternal(routing_id, request_id, request, | 2268 OnRequestResourceInternal(routing_id, request_id, request, |
2269 std::move(mojo_request), | 2269 std::move(mojo_request), |
2270 std::move(url_loader_client)); | 2270 std::move(url_loader_client)); |
2271 filter_ = nullptr; | 2271 filter_ = nullptr; |
2272 } | 2272 } |
2273 | 2273 |
| 2274 void ResourceDispatcherHostImpl::OnSyncLoadWithMojo( |
| 2275 int routing_id, |
| 2276 int request_id, |
| 2277 const ResourceRequest& request_data, |
| 2278 ResourceMessageFilter* filter, |
| 2279 const SyncLoadResultCallback& result_handler) { |
| 2280 filter_ = filter; |
| 2281 BeginRequest(request_id, request_data, result_handler, routing_id, |
| 2282 nullptr, nullptr); |
| 2283 filter_ = nullptr; |
| 2284 } |
| 2285 |
2274 // static | 2286 // static |
2275 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( | 2287 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
2276 net::URLRequest* request) { | 2288 net::URLRequest* request) { |
2277 // The following fields should be a minor size contribution (experimentally | 2289 // The following fields should be a minor size contribution (experimentally |
2278 // on the order of 100). However since they are variable length, it could | 2290 // on the order of 100). However since they are variable length, it could |
2279 // in theory be a sizeable contribution. | 2291 // in theory be a sizeable contribution. |
2280 int strings_cost = request->extra_request_headers().ToString().size() + | 2292 int strings_cost = request->extra_request_headers().ToString().size() + |
2281 request->original_url().spec().size() + | 2293 request->original_url().spec().size() + |
2282 request->referrer().size() + | 2294 request->referrer().size() + |
2283 request->method().size(); | 2295 request->method().size(); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 &throttles); | 2747 &throttles); |
2736 if (!throttles.empty()) { | 2748 if (!throttles.empty()) { |
2737 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2749 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2738 std::move(throttles))); | 2750 std::move(throttles))); |
2739 } | 2751 } |
2740 } | 2752 } |
2741 return handler; | 2753 return handler; |
2742 } | 2754 } |
2743 | 2755 |
2744 } // namespace content | 2756 } // namespace content |
OLD | NEW |