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

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: 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_impl.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 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 1137
1137 if (delegate_) 1138 if (delegate_)
1138 delegate_->RequestComplete(loader->request()); 1139 delegate_->RequestComplete(loader->request());
1139 1140
1140 // Destroy the ResourceLoader. 1141 // Destroy the ResourceLoader.
1141 RemovePendingRequest(info->GetChildID(), info->GetRequestID()); 1142 RemovePendingRequest(info->GetChildID(), info->GetRequestID());
1142 } 1143 }
1143 1144
1144 void ResourceDispatcherHostImpl::OnInit() { 1145 void ResourceDispatcherHostImpl::OnInit() {
1145 scheduler_.reset(new ResourceScheduler); 1146 scheduler_.reset(new ResourceScheduler);
1147 resource_hints_controller_.reset(new ResourceHintsController);
1146 } 1148 }
1147 1149
1148 void ResourceDispatcherHostImpl::OnShutdown() { 1150 void ResourceDispatcherHostImpl::OnShutdown() {
1149 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1151 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1150 1152
1151 is_shutdown_ = true; 1153 is_shutdown_ = true;
1152 pending_loaders_.clear(); 1154 pending_loaders_.clear();
1153 1155
1154 // Make sure we shutdown the timer now, otherwise by the time our destructor 1156 // Make sure we shutdown the timer now, otherwise by the time our destructor
1155 // runs if the timer is still running the Task is deleted twice (once by 1157 // runs if the timer is still running the Task is deleted twice (once by
1156 // the MessageLoop and the second time by RepeatingTimer). 1158 // the MessageLoop and the second time by RepeatingTimer).
1157 update_load_states_timer_.reset(); 1159 update_load_states_timer_.reset();
1158 1160
1159 // Clear blocked requests if any left. 1161 // Clear blocked requests if any left.
1160 // Note that we have to do this in 2 passes as we cannot call 1162 // Note that we have to do this in 2 passes as we cannot call
1161 // CancelBlockedRequestsForRoute while iterating over 1163 // CancelBlockedRequestsForRoute while iterating over
1162 // blocked_loaders_map_, as it modifies it. 1164 // blocked_loaders_map_, as it modifies it.
1163 std::set<GlobalFrameRoutingId> ids; 1165 std::set<GlobalFrameRoutingId> ids;
1164 for (const auto& blocked_loaders : blocked_loaders_map_) { 1166 for (const auto& blocked_loaders : blocked_loaders_map_) {
1165 std::pair<std::set<GlobalFrameRoutingId>::iterator, bool> result = 1167 std::pair<std::set<GlobalFrameRoutingId>::iterator, bool> result =
1166 ids.insert(blocked_loaders.first); 1168 ids.insert(blocked_loaders.first);
1167 // We should not have duplicates. 1169 // We should not have duplicates.
1168 DCHECK(result.second); 1170 DCHECK(result.second);
1169 } 1171 }
1170 for (const auto& routing_id : ids) { 1172 for (const auto& routing_id : ids) {
1171 CancelBlockedRequestsForRoute(routing_id); 1173 CancelBlockedRequestsForRoute(routing_id);
1172 } 1174 }
1173 1175
1174 scheduler_.reset(); 1176 scheduler_.reset();
1177 resource_hints_controller_.reset();
1175 } 1178 }
1176 1179
1177 bool ResourceDispatcherHostImpl::OnMessageReceived( 1180 bool ResourceDispatcherHostImpl::OnMessageReceived(
1178 const IPC::Message& message, 1181 const IPC::Message& message,
1179 ResourceMessageFilter* filter) { 1182 ResourceMessageFilter* filter) {
1180 filter_ = filter; 1183 filter_ = filter;
1181 bool handled = true; 1184 bool handled = true;
1182 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcherHostImpl, message) 1185 IPC_BEGIN_MESSAGE_MAP(ResourceDispatcherHostImpl, message)
1183 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource) 1186 IPC_MESSAGE_HANDLER(ResourceHostMsg_RequestResource, OnRequestResource)
1184 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad) 1187 IPC_MESSAGE_HANDLER_DELAY_REPLY(ResourceHostMsg_SyncLoad, OnSyncLoad)
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); 2692 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id);
2690 response->head.security_info = SerializeSecurityInfo(ssl); 2693 response->head.security_info = SerializeSecurityInfo(ssl);
2691 } 2694 }
2692 2695
2693 CertStore* ResourceDispatcherHostImpl::GetCertStore() { 2696 CertStore* ResourceDispatcherHostImpl::GetCertStore() {
2694 return cert_store_for_testing_ ? cert_store_for_testing_ 2697 return cert_store_for_testing_ ? cert_store_for_testing_
2695 : CertStore::GetInstance(); 2698 : CertStore::GetInstance();
2696 } 2699 }
2697 2700
2698 } // namespace content 2701 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698