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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2004453002: Add a Dns preresolve interface in //content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@predictor_dns_browsertest
Patch Set: Changed interface to accept ResourceContexts Created 4 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
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "content/browser/loader/async_resource_handler.h" 48 #include "content/browser/loader/async_resource_handler.h"
49 #include "content/browser/loader/async_revalidation_manager.h" 49 #include "content/browser/loader/async_revalidation_manager.h"
50 #include "content/browser/loader/cross_site_resource_handler.h" 50 #include "content/browser/loader/cross_site_resource_handler.h"
51 #include "content/browser/loader/detachable_resource_handler.h" 51 #include "content/browser/loader/detachable_resource_handler.h"
52 #include "content/browser/loader/mime_type_resource_handler.h" 52 #include "content/browser/loader/mime_type_resource_handler.h"
53 #include "content/browser/loader/navigation_resource_handler.h" 53 #include "content/browser/loader/navigation_resource_handler.h"
54 #include "content/browser/loader/navigation_resource_throttle.h" 54 #include "content/browser/loader/navigation_resource_throttle.h"
55 #include "content/browser/loader/navigation_url_loader_impl_core.h" 55 #include "content/browser/loader/navigation_url_loader_impl_core.h"
56 #include "content/browser/loader/power_save_block_resource_throttle.h" 56 #include "content/browser/loader/power_save_block_resource_throttle.h"
57 #include "content/browser/loader/redirect_to_file_resource_handler.h" 57 #include "content/browser/loader/redirect_to_file_resource_handler.h"
58 #include "content/browser/loader/resource_hints_controller.h"
58 #include "content/browser/loader/resource_message_filter.h" 59 #include "content/browser/loader/resource_message_filter.h"
59 #include "content/browser/loader/resource_request_info_impl.h" 60 #include "content/browser/loader/resource_request_info_impl.h"
60 #include "content/browser/loader/stream_resource_handler.h" 61 #include "content/browser/loader/stream_resource_handler.h"
61 #include "content/browser/loader/sync_resource_handler.h" 62 #include "content/browser/loader/sync_resource_handler.h"
62 #include "content/browser/loader/throttling_resource_handler.h" 63 #include "content/browser/loader/throttling_resource_handler.h"
63 #include "content/browser/loader/upload_data_stream_builder.h" 64 #include "content/browser/loader/upload_data_stream_builder.h"
64 #include "content/browser/renderer_host/render_view_host_delegate.h" 65 #include "content/browser/renderer_host/render_view_host_delegate.h"
65 #include "content/browser/renderer_host/render_view_host_impl.h" 66 #include "content/browser/renderer_host/render_view_host_impl.h"
66 #include "content/browser/resource_context_impl.h" 67 #include "content/browser/resource_context_impl.h"
67 #include "content/browser/service_worker/foreign_fetch_request_handler.h" 68 #include "content/browser/service_worker/foreign_fetch_request_handler.h"
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 1138
1138 if (delegate_) 1139 if (delegate_)
1139 delegate_->RequestComplete(loader->request()); 1140 delegate_->RequestComplete(loader->request());
1140 1141
1141 // Destroy the ResourceLoader. 1142 // Destroy the ResourceLoader.
1142 RemovePendingRequest(info->GetChildID(), info->GetRequestID()); 1143 RemovePendingRequest(info->GetChildID(), info->GetRequestID());
1143 } 1144 }
1144 1145
1145 void ResourceDispatcherHostImpl::OnInit() { 1146 void ResourceDispatcherHostImpl::OnInit() {
1146 scheduler_.reset(new ResourceScheduler); 1147 scheduler_.reset(new ResourceScheduler);
1148 resource_hints_controller_.reset(new ResourceHintsController);
1147 } 1149 }
1148 1150
1149 void ResourceDispatcherHostImpl::OnShutdown() { 1151 void ResourceDispatcherHostImpl::OnShutdown() {
1150 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1152 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1151 1153
1152 is_shutdown_ = true; 1154 is_shutdown_ = true;
1153 pending_loaders_.clear(); 1155 pending_loaders_.clear();
1154 1156
1155 // Make sure we shutdown the timer now, otherwise by the time our destructor 1157 // Make sure we shutdown the timer now, otherwise by the time our destructor
1156 // runs if the timer is still running the Task is deleted twice (once by 1158 // runs if the timer is still running the Task is deleted twice (once by
1157 // the MessageLoop and the second time by RepeatingTimer). 1159 // the MessageLoop and the second time by RepeatingTimer).
1158 update_load_states_timer_.reset(); 1160 update_load_states_timer_.reset();
1159 1161
1160 // Clear blocked requests if any left. 1162 // Clear blocked requests if any left.
1161 // Note that we have to do this in 2 passes as we cannot call 1163 // Note that we have to do this in 2 passes as we cannot call
1162 // CancelBlockedRequestsForRoute while iterating over 1164 // CancelBlockedRequestsForRoute while iterating over
1163 // blocked_loaders_map_, as it modifies it. 1165 // blocked_loaders_map_, as it modifies it.
1164 std::set<GlobalFrameRoutingId> ids; 1166 std::set<GlobalFrameRoutingId> ids;
1165 for (const auto& blocked_loaders : blocked_loaders_map_) { 1167 for (const auto& blocked_loaders : blocked_loaders_map_) {
1166 std::pair<std::set<GlobalFrameRoutingId>::iterator, bool> result = 1168 std::pair<std::set<GlobalFrameRoutingId>::iterator, bool> result =
1167 ids.insert(blocked_loaders.first); 1169 ids.insert(blocked_loaders.first);
1168 // We should not have duplicates. 1170 // We should not have duplicates.
1169 DCHECK(result.second); 1171 DCHECK(result.second);
1170 } 1172 }
1171 for (const auto& routing_id : ids) { 1173 for (const auto& routing_id : ids) {
1172 CancelBlockedRequestsForRoute(routing_id); 1174 CancelBlockedRequestsForRoute(routing_id);
1173 } 1175 }
1174 1176
1175 scheduler_.reset(); 1177 scheduler_.reset();
1178 resource_hints_controller_.reset();
1176 } 1179 }
1177 1180
1178 bool ResourceDispatcherHostImpl::OnMessageReceived( 1181 bool ResourceDispatcherHostImpl::OnMessageReceived(
1179 const IPC::Message& message, 1182 const IPC::Message& message,
1180 ResourceMessageFilter* filter) { 1183 ResourceMessageFilter* filter) {
1181 filter_ = filter; 1184 filter_ = filter;
1182 bool handled = true; 1185 bool handled = true;
1183 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcherHostImpl, message) 1186 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcherHostImpl, message)
1184 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) 1187 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource)
1185 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) 1188 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad)
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); 2693 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id);
2691 response->head.security_info = SerializeSecurityInfo(ssl); 2694 response->head.security_info = SerializeSecurityInfo(ssl);
2692 } 2695 }
2693 2696
2694 CertStore* ResourceDispatcherHostImpl::GetCertStore() { 2697 CertStore* ResourceDispatcherHostImpl::GetCertStore() {
2695 return cert_store_for_testing_ ? cert_store_for_testing_ 2698 return cert_store_for_testing_ ? cert_store_for_testing_
2696 : CertStore::GetInstance(); 2699 : CertStore::GetInstance();
2697 } 2700 }
2698 2701
2699 } // namespace content 2702 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698