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 // This is the browser side of the resource dispatcher, it receives requests | 5 // This is the browser side of the resource dispatcher, it receives requests |
6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and | 6 // from the child process (i.e. [Renderer, Plugin, Worker]ProcessHost), and |
7 // dispatches them to URLRequests. It then forwards the messages from the | 7 // dispatches them to URLRequests. It then forwards the messages from the |
8 // URLRequests back to the correct process for handling. | 8 // URLRequests back to the correct process for handling. |
9 // | 9 // |
10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return download_file_manager_; | 148 return download_file_manager_; |
149 } | 149 } |
150 | 150 |
151 SaveFileManager* save_file_manager() const { | 151 SaveFileManager* save_file_manager() const { |
152 return save_file_manager_; | 152 return save_file_manager_; |
153 } | 153 } |
154 | 154 |
155 // Called when the unload handler for a cross-site request has finished. | 155 // Called when the unload handler for a cross-site request has finished. |
156 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); | 156 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); |
157 | 157 |
| 158 // Called when we want to simulate the renderer process sending |
| 159 // ViewHostMsg_SwapOut_ACK in cases where the renderer has died or is |
| 160 // unresponsive. |
| 161 void OnSimulateSwapOutACK(const ViewMsg_SwapOut_Params& params); |
| 162 |
158 // Called when the renderer loads a resource from its internal cache. | 163 // Called when the renderer loads a resource from its internal cache. |
159 void OnDidLoadResourceFromMemoryCache(const GURL& url, | 164 void OnDidLoadResourceFromMemoryCache(const GURL& url, |
160 const std::string& security_info, | 165 const std::string& security_info, |
161 const std::string& http_method, | 166 const std::string& http_method, |
162 const std::string& mime_type, | 167 const std::string& mime_type, |
163 ResourceType::Type resource_type); | 168 ResourceType::Type resource_type); |
164 | 169 |
165 // Force cancels any pending requests for the given process. | 170 // Force cancels any pending requests for the given process. |
166 void CancelRequestsForProcess(int child_id); | 171 void CancelRequestsForProcess(int child_id); |
167 | 172 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // and places them in the given out params (both required). If there are no | 248 // and places them in the given out params (both required). If there are no |
244 // such IDs associated with the request (such as non-page-related requests), | 249 // such IDs associated with the request (such as non-page-related requests), |
245 // this function will return false and both out params will be -1. | 250 // this function will return false and both out params will be -1. |
246 static bool RenderViewForRequest(const net::URLRequest* request, | 251 static bool RenderViewForRequest(const net::URLRequest* request, |
247 int* render_process_host_id, | 252 int* render_process_host_id, |
248 int* render_view_host_id); | 253 int* render_view_host_id); |
249 | 254 |
250 // A shutdown helper that runs on the IO thread. | 255 // A shutdown helper that runs on the IO thread. |
251 void OnShutdown(); | 256 void OnShutdown(); |
252 | 257 |
| 258 // The real implementation of the OnSwapOutACK logic. Public methods call |
| 259 // this method with the proper value for the timed_out parameter. |
| 260 void HandleSwapOutACK(const ViewMsg_SwapOut_Params& params, bool timed_out); |
| 261 |
253 // Helper function for regular and download requests. | 262 // Helper function for regular and download requests. |
254 void BeginRequestInternal(scoped_ptr<net::URLRequest> request, | 263 void BeginRequestInternal(scoped_ptr<net::URLRequest> request, |
255 scoped_ptr<ResourceHandler> handler); | 264 scoped_ptr<ResourceHandler> handler); |
256 | 265 |
257 void StartLoading(ResourceRequestInfoImpl* info, | 266 void StartLoading(ResourceRequestInfoImpl* info, |
258 const linked_ptr<ResourceLoader>& loader); | 267 const linked_ptr<ResourceLoader>& loader); |
259 | 268 |
260 // Updates the "cost" of outstanding requests for |child_id|. | 269 // Updates the "cost" of outstanding requests for |child_id|. |
261 // The "cost" approximates how many bytes are consumed by all the in-memory | 270 // The "cost" approximates how many bytes are consumed by all the in-memory |
262 // data structures supporting this request (net::URLRequest object, | 271 // data structures supporting this request (net::URLRequest object, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // http://crbug.com/90971 - Assists in tracking down use-after-frees on | 418 // http://crbug.com/90971 - Assists in tracking down use-after-frees on |
410 // shutdown. | 419 // shutdown. |
411 std::set<const ResourceContext*> active_resource_contexts_; | 420 std::set<const ResourceContext*> active_resource_contexts_; |
412 | 421 |
413 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 422 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
414 }; | 423 }; |
415 | 424 |
416 } // namespace content | 425 } // namespace content |
417 | 426 |
418 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 427 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |