| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 namespace net { | 48 namespace net { |
| 49 class URLRequestJobFactory; | 49 class URLRequestJobFactory; |
| 50 } | 50 } |
| 51 | 51 |
| 52 namespace storage { | 52 namespace storage { |
| 53 class ShareableFileReference; | 53 class ShareableFileReference; |
| 54 } | 54 } |
| 55 | 55 |
| 56 namespace content { | 56 namespace content { |
| 57 class AppCacheService; |
| 58 class NavigationURLLoaderImplCore; |
| 57 class ResourceContext; | 59 class ResourceContext; |
| 58 class ResourceDispatcherHostDelegate; | 60 class ResourceDispatcherHostDelegate; |
| 59 class ResourceMessageDelegate; | 61 class ResourceMessageDelegate; |
| 60 class ResourceMessageFilter; | 62 class ResourceMessageFilter; |
| 61 class ResourceRequestInfoImpl; | 63 class ResourceRequestInfoImpl; |
| 62 class SaveFileManager; | 64 class SaveFileManager; |
| 63 class WebContentsImpl; | 65 class WebContentsImpl; |
| 64 struct CommonNavigationParams; | 66 struct CommonNavigationParams; |
| 65 struct DownloadSaveInfo; | 67 struct DownloadSaveInfo; |
| 66 struct NavigationRequestInfo; | 68 struct NavigationRequestInfo; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // sending it to the renderer. Returns true if there are enough file | 250 // sending it to the renderer. Returns true if there are enough file |
| 249 // descriptors available for the shared memory buffer. If false is returned, | 251 // descriptors available for the shared memory buffer. If false is returned, |
| 250 // the request should cancel. | 252 // the request should cancel. |
| 251 bool HasSufficientResourcesForRequest(net::URLRequest* request); | 253 bool HasSufficientResourcesForRequest(net::URLRequest* request); |
| 252 | 254 |
| 253 // Called by a ResourceHandler after it has finished its request and is done | 255 // Called by a ResourceHandler after it has finished its request and is done |
| 254 // using its shared memory buffer. Frees up that file descriptor to be used | 256 // using its shared memory buffer. Frees up that file descriptor to be used |
| 255 // elsewhere. | 257 // elsewhere. |
| 256 void FinishedWithResourcesForRequest(net::URLRequest* request); | 258 void FinishedWithResourcesForRequest(net::URLRequest* request); |
| 257 | 259 |
| 258 // PlzNavigate | 260 // PlzNavigate: Begins a request for NavigationURLLoader. |loader| is the |
| 259 // Called by NavigationRequest to start a navigation request in the node | 261 // loader to attach to the leaf resource handler. |
| 260 // identified by |frame_node_id|. | 262 void BeginNavigationRequest(ResourceContext* resource_context, |
| 261 void StartNavigationRequest(const CommonNavigationParams& common_params, | 263 int64 frame_tree_node_id, |
| 264 const CommonNavigationParams& common_params, |
| 262 const NavigationRequestInfo& info, | 265 const NavigationRequestInfo& info, |
| 263 scoped_refptr<ResourceRequestBody> request_body, | 266 scoped_refptr<ResourceRequestBody> request_body, |
| 264 int64 navigation_request_id, | 267 NavigationURLLoaderImplCore* loader); |
| 265 int64 frame_node_id); | |
| 266 | |
| 267 // PlzNavigate | |
| 268 // Called by NavigationRequest to cancel a navigation request with the | |
| 269 // provided |navigation_request_id| in the node identified by | |
| 270 // |frame_node_id|. | |
| 271 void CancelNavigationRequest(int64 navigation_request_id, | |
| 272 int64 frame_node_id); | |
| 273 | 268 |
| 274 private: | 269 private: |
| 275 friend class ResourceDispatcherHostTest; | 270 friend class ResourceDispatcherHostTest; |
| 276 | 271 |
| 277 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 272 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 278 TestBlockedRequestsProcessDies); | 273 TestBlockedRequestsProcessDies); |
| 279 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 274 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 280 CalculateApproximateMemoryCost); | 275 CalculateApproximateMemoryCost); |
| 281 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 276 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 282 DetachableResourceTimesOut); | 277 DetachableResourceTimesOut); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // loading. | 396 // loading. |
| 402 scoped_ptr<ResourceHandler> CreateResourceHandler( | 397 scoped_ptr<ResourceHandler> CreateResourceHandler( |
| 403 net::URLRequest* request, | 398 net::URLRequest* request, |
| 404 const ResourceHostMsg_Request& request_data, | 399 const ResourceHostMsg_Request& request_data, |
| 405 IPC::Message* sync_result, | 400 IPC::Message* sync_result, |
| 406 int route_id, | 401 int route_id, |
| 407 int process_type, | 402 int process_type, |
| 408 int child_id, | 403 int child_id, |
| 409 ResourceContext* resource_context); | 404 ResourceContext* resource_context); |
| 410 | 405 |
| 406 // Wraps |handler| in the standard resource handlers for normal resource |
| 407 // loading and navigation requests. This adds BufferedResourceHandler and |
| 408 // ResourceThrottles. |
| 409 scoped_ptr<ResourceHandler> AddStandardHandlers( |
| 410 net::URLRequest* request, |
| 411 ResourceType resource_type, |
| 412 ResourceContext* resource_context, |
| 413 AppCacheService* appcache_service, |
| 414 int child_id, |
| 415 int route_id, |
| 416 scoped_ptr<ResourceHandler> handler); |
| 417 |
| 411 void OnDataDownloadedACK(int request_id); | 418 void OnDataDownloadedACK(int request_id); |
| 412 void OnUploadProgressACK(int request_id); | 419 void OnUploadProgressACK(int request_id); |
| 413 void OnCancelRequest(int request_id); | 420 void OnCancelRequest(int request_id); |
| 414 void OnReleaseDownloadedFile(int request_id); | 421 void OnReleaseDownloadedFile(int request_id); |
| 415 | 422 |
| 416 // Creates ResourceRequestInfoImpl for a download or page save. | 423 // Creates ResourceRequestInfoImpl for a download or page save. |
| 417 // |download| should be true if the request is a file download. | 424 // |download| should be true if the request is a file download. |
| 418 ResourceRequestInfoImpl* CreateRequestInfo( | 425 ResourceRequestInfoImpl* CreateRequestInfo( |
| 419 int child_id, | 426 int child_id, |
| 420 int route_id, | 427 int route_id, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 DelegateMap delegate_map_; | 548 DelegateMap delegate_map_; |
| 542 | 549 |
| 543 scoped_ptr<ResourceScheduler> scheduler_; | 550 scoped_ptr<ResourceScheduler> scheduler_; |
| 544 | 551 |
| 545 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 552 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 546 }; | 553 }; |
| 547 | 554 |
| 548 } // namespace content | 555 } // namespace content |
| 549 | 556 |
| 550 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 557 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |