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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return download_file_manager_; | 157 return download_file_manager_; |
158 } | 158 } |
159 | 159 |
160 SaveFileManager* save_file_manager() const { | 160 SaveFileManager* save_file_manager() const { |
161 return save_file_manager_; | 161 return save_file_manager_; |
162 } | 162 } |
163 | 163 |
164 // Called when the unload handler for a cross-site request has finished. | 164 // Called when the unload handler for a cross-site request has finished. |
165 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); | 165 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); |
166 | 166 |
| 167 // Called when we want to simulate the renderer process sending |
| 168 // ViewHostMsg_SwapOut_ACK in cases where the renderer has died or is |
| 169 // unresponsive. |
| 170 void OnSimulateSwapOutACK(const ViewMsg_SwapOut_Params& params); |
| 171 |
167 // Called when the renderer loads a resource from its internal cache. | 172 // Called when the renderer loads a resource from its internal cache. |
168 void OnDidLoadResourceFromMemoryCache(const GURL& url, | 173 void OnDidLoadResourceFromMemoryCache(const GURL& url, |
169 const std::string& security_info, | 174 const std::string& security_info, |
170 const std::string& http_method, | 175 const std::string& http_method, |
171 ResourceType::Type resource_type); | 176 ResourceType::Type resource_type); |
172 | 177 |
173 // Force cancels any pending requests for the given process. | 178 // Force cancels any pending requests for the given process. |
174 void CancelRequestsForProcess(int child_id); | 179 void CancelRequestsForProcess(int child_id); |
175 | 180 |
176 // Force cancels any pending requests for the given route id. This method | 181 // Force cancels any pending requests for the given route id. This method |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // and places them in the given out params (both required). If there are no | 274 // and places them in the given out params (both required). If there are no |
270 // such IDs associated with the request (such as non-page-related requests), | 275 // such IDs associated with the request (such as non-page-related requests), |
271 // this function will return false and both out params will be -1. | 276 // this function will return false and both out params will be -1. |
272 static bool RenderViewForRequest(const net::URLRequest* request, | 277 static bool RenderViewForRequest(const net::URLRequest* request, |
273 int* render_process_host_id, | 278 int* render_process_host_id, |
274 int* render_view_host_id); | 279 int* render_view_host_id); |
275 | 280 |
276 // A shutdown helper that runs on the IO thread. | 281 // A shutdown helper that runs on the IO thread. |
277 void OnShutdown(); | 282 void OnShutdown(); |
278 | 283 |
| 284 // The real implementation of the OnSwapOutACK logic. Public methods call |
| 285 // this method with the proper value for the timed_out parameter. |
| 286 void HandleSwapOutACK(const ViewMsg_SwapOut_Params& params, bool timed_out); |
| 287 |
279 void StartRequest(net::URLRequest* request); | 288 void StartRequest(net::URLRequest* request); |
280 | 289 |
281 // Returns true if the request is paused. | 290 // Returns true if the request is paused. |
282 bool PauseRequestIfNeeded(ResourceRequestInfoImpl* info); | 291 bool PauseRequestIfNeeded(ResourceRequestInfoImpl* info); |
283 | 292 |
284 // Resumes the given request by calling OnResponseStarted or OnReadCompleted. | 293 // Resumes the given request by calling OnResponseStarted or OnReadCompleted. |
285 void ResumeRequest(const GlobalRequestID& request_id); | 294 void ResumeRequest(const GlobalRequestID& request_id); |
286 | 295 |
287 // Internal function to start reading for the first time. | 296 // Internal function to start reading for the first time. |
288 void StartReading(net::URLRequest* request); | 297 void StartReading(net::URLRequest* request); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 // to the respective request. | 510 // to the respective request. |
502 typedef std::map<GlobalRequestID, net::URLRequest*> TransferredNavigations; | 511 typedef std::map<GlobalRequestID, net::URLRequest*> TransferredNavigations; |
503 TransferredNavigations transferred_navigations_; | 512 TransferredNavigations transferred_navigations_; |
504 | 513 |
505 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 514 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
506 }; | 515 }; |
507 | 516 |
508 } // namespace content | 517 } // namespace content |
509 | 518 |
510 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 519 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |