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