| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 if (pending_frame_host) | 486 if (pending_frame_host) |
| 487 routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId()); | 487 routing_ids->insert(pending_frame_host->GetGlobalFrameRoutingId()); |
| 488 } | 488 } |
| 489 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 489 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 490 base::Bind(&NotifyForRouteSetOnIO, frame_callback, | 490 base::Bind(&NotifyForRouteSetOnIO, frame_callback, |
| 491 base::Passed(std::move(routing_ids)))); | 491 base::Passed(std::move(routing_ids)))); |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace | 494 } // namespace |
| 495 | 495 |
| 496 LoaderIOThreadNotifier::LoaderIOThreadNotifier(WebContents* web_contents) | |
| 497 : WebContentsObserver(web_contents) {} | |
| 498 | |
| 499 LoaderIOThreadNotifier::~LoaderIOThreadNotifier() {} | |
| 500 | |
| 501 void LoaderIOThreadNotifier::RenderFrameDeleted( | |
| 502 RenderFrameHost* render_frame_host) { | |
| 503 NotifyForRouteFromUI( | |
| 504 static_cast<RenderFrameHostImpl*>(render_frame_host) | |
| 505 ->GetGlobalFrameRoutingId(), | |
| 506 base::Bind(&ResourceDispatcherHostImpl::OnRenderFrameDeleted)); | |
| 507 } | |
| 508 | |
| 509 // static | 496 // static |
| 510 ResourceDispatcherHost* ResourceDispatcherHost::Get() { | 497 ResourceDispatcherHost* ResourceDispatcherHost::Get() { |
| 511 return g_resource_dispatcher_host; | 498 return g_resource_dispatcher_host; |
| 512 } | 499 } |
| 513 | 500 |
| 514 ResourceDispatcherHostImpl::ResourceDispatcherHostImpl() | 501 ResourceDispatcherHostImpl::ResourceDispatcherHostImpl() |
| 515 : save_file_manager_(new SaveFileManager()), | 502 : save_file_manager_(new SaveFileManager()), |
| 516 request_id_(-1), | 503 request_id_(-1), |
| 517 is_shutdown_(false), | 504 is_shutdown_(false), |
| 518 num_in_flight_requests_(0), | 505 num_in_flight_requests_(0), |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1819 context, | 1806 context, |
| 1820 base::WeakPtr<ResourceMessageFilter>(), // filter | 1807 base::WeakPtr<ResourceMessageFilter>(), // filter |
| 1821 false, // report_raw_headers | 1808 false, // report_raw_headers |
| 1822 true, // is_async | 1809 true, // is_async |
| 1823 false, // is_using_lofi | 1810 false, // is_using_lofi |
| 1824 std::string(), // original_headers | 1811 std::string(), // original_headers |
| 1825 nullptr, // body | 1812 nullptr, // body |
| 1826 false); // initiated_in_secure_context | 1813 false); // initiated_in_secure_context |
| 1827 } | 1814 } |
| 1828 | 1815 |
| 1829 void ResourceDispatcherHostImpl::OnRenderFrameDeleted( | |
| 1830 const GlobalFrameRoutingId& global_routing_id) { | |
| 1831 CancelRequestsForRoute(global_routing_id); | |
| 1832 } | |
| 1833 | |
| 1834 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, | 1816 void ResourceDispatcherHostImpl::OnRenderViewHostCreated(int child_id, |
| 1835 int route_id) { | 1817 int route_id) { |
| 1836 scheduler_->OnClientCreated(child_id, route_id); | 1818 scheduler_->OnClientCreated(child_id, route_id); |
| 1837 } | 1819 } |
| 1838 | 1820 |
| 1839 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(int child_id, | 1821 void ResourceDispatcherHostImpl::OnRenderViewHostDeleted(int child_id, |
| 1840 int route_id) { | 1822 int route_id) { |
| 1841 scheduler_->OnClientDeleted(child_id, route_id); | 1823 scheduler_->OnClientDeleted(child_id, route_id); |
| 1842 } | 1824 } |
| 1843 | 1825 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2287 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { | 2269 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { |
| 2288 if (!async_revalidation_manager_) | 2270 if (!async_revalidation_manager_) |
| 2289 async_revalidation_manager_.reset(new AsyncRevalidationManager); | 2271 async_revalidation_manager_.reset(new AsyncRevalidationManager); |
| 2290 } | 2272 } |
| 2291 | 2273 |
| 2292 void ResourceDispatcherHostImpl::SetLoaderDelegate( | 2274 void ResourceDispatcherHostImpl::SetLoaderDelegate( |
| 2293 LoaderDelegate* loader_delegate) { | 2275 LoaderDelegate* loader_delegate) { |
| 2294 loader_delegate_ = loader_delegate; | 2276 loader_delegate_ = loader_delegate; |
| 2295 } | 2277 } |
| 2296 | 2278 |
| 2279 void ResourceDispatcherHostImpl::OnRenderFrameDeleted( |
| 2280 const GlobalFrameRoutingId& global_routing_id) { |
| 2281 CancelRequestsForRoute(global_routing_id); |
| 2282 } |
| 2283 |
| 2297 // static | 2284 // static |
| 2298 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( | 2285 int ResourceDispatcherHostImpl::CalculateApproximateMemoryCost( |
| 2299 net::URLRequest* request) { | 2286 net::URLRequest* request) { |
| 2300 // The following fields should be a minor size contribution (experimentally | 2287 // The following fields should be a minor size contribution (experimentally |
| 2301 // on the order of 100). However since they are variable length, it could | 2288 // on the order of 100). However since they are variable length, it could |
| 2302 // in theory be a sizeable contribution. | 2289 // in theory be a sizeable contribution. |
| 2303 int strings_cost = request->extra_request_headers().ToString().size() + | 2290 int strings_cost = request->extra_request_headers().ToString().size() + |
| 2304 request->original_url().spec().size() + | 2291 request->original_url().spec().size() + |
| 2305 request->referrer().size() + | 2292 request->referrer().size() + |
| 2306 request->method().size(); | 2293 request->method().size(); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2614 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); | 2601 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); |
| 2615 response->head.security_info = SerializeSecurityInfo(ssl); | 2602 response->head.security_info = SerializeSecurityInfo(ssl); |
| 2616 } | 2603 } |
| 2617 | 2604 |
| 2618 CertStore* ResourceDispatcherHostImpl::GetCertStore() { | 2605 CertStore* ResourceDispatcherHostImpl::GetCertStore() { |
| 2619 return cert_store_for_testing_ ? cert_store_for_testing_ | 2606 return cert_store_for_testing_ ? cert_store_for_testing_ |
| 2620 : CertStore::GetInstance(); | 2607 : CertStore::GetInstance(); |
| 2621 } | 2608 } |
| 2622 | 2609 |
| 2623 } // namespace content | 2610 } // namespace content |
| OLD | NEW |