Chromium Code Reviews| 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 NavigationURLLoaderCore; | |
| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 // sending it to the renderer. Returns true if there are enough file | 251 // sending it to the renderer. Returns true if there are enough file |
| 250 // descriptors available for the shared memory buffer. If false is returned, | 252 // descriptors available for the shared memory buffer. If false is returned, |
| 251 // the request should cancel. | 253 // the request should cancel. |
| 252 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); | 254 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); |
| 253 | 255 |
| 254 // Called by a ResourceHandler after it has finished its request and is done | 256 // Called by a ResourceHandler after it has finished its request and is done |
| 255 // using its shared memory buffer. Frees up that file descriptor to be used | 257 // using its shared memory buffer. Frees up that file descriptor to be used |
| 256 // elsewhere. | 258 // elsewhere. |
| 257 void FinishedWithResourcesForRequest(const net::URLRequest* request_); | 259 void FinishedWithResourcesForRequest(const net::URLRequest* request_); |
| 258 | 260 |
| 259 // PlzNavigate | 261 // PlzNavigate: Begins a request for NavigationURLLoader. |loader| is the |
| 260 // Called by NavigationRequest to start a navigation request in the node | 262 // loader to attach to the leaf resource handler. |
| 261 // identified by |frame_node_id|. | 263 void BeginNavigationRequest(ResourceContext* resource_context, |
| 262 void StartNavigationRequest(const CommonNavigationParams& common_params, | 264 int64 frame_tree_node_id, |
| 265 const CommonNavigationParams& common_params, | |
| 263 const NavigationRequestInfo& info, | 266 const NavigationRequestInfo& info, |
| 264 scoped_refptr<ResourceRequestBody> request_body, | 267 scoped_refptr<ResourceRequestBody> request_body, |
| 265 int64 navigation_request_id, | 268 NavigationURLLoaderCore* loader); |
| 266 int64 frame_node_id); | |
| 267 | |
| 268 // PlzNavigate | |
| 269 // Called by NavigationRequest to cancel a navigation request with the | |
| 270 // provided |navigation_request_id| in the node identified by | |
| 271 // |frame_node_id|. | |
| 272 void CancelNavigationRequest(int64 navigation_request_id, | |
| 273 int64 frame_node_id); | |
| 274 | 269 |
| 275 private: | 270 private: |
| 276 friend class ResourceDispatcherHostTest; | 271 friend class ResourceDispatcherHostTest; |
| 277 | 272 |
| 278 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 273 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 279 TestBlockedRequestsProcessDies); | 274 TestBlockedRequestsProcessDies); |
| 280 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 275 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 281 CalculateApproximateMemoryCost); | 276 CalculateApproximateMemoryCost); |
| 282 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 277 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 283 DetachableResourceTimesOut); | 278 DetachableResourceTimesOut); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 // loading. | 399 // loading. |
| 405 scoped_ptr<ResourceHandler> CreateResourceHandler( | 400 scoped_ptr<ResourceHandler> CreateResourceHandler( |
| 406 net::URLRequest* request, | 401 net::URLRequest* request, |
| 407 const ResourceHostMsg_Request& request_data, | 402 const ResourceHostMsg_Request& request_data, |
| 408 IPC::Message* sync_result, | 403 IPC::Message* sync_result, |
| 409 int route_id, | 404 int route_id, |
| 410 int process_type, | 405 int process_type, |
| 411 int child_id, | 406 int child_id, |
| 412 ResourceContext* resource_context); | 407 ResourceContext* resource_context); |
| 413 | 408 |
| 409 // Wraps |handler| in the standard resource handlers for normal resource | |
| 410 // loading and navigation requests. | |
|
clamy
2014/10/16 13:43:51
nit: Maybe precise which kind of ResourceHandlers
davidben
2014/10/22 01:32:37
Done.
| |
| 411 scoped_ptr<ResourceHandler> AddStandardHandlers( | |
| 412 net::URLRequest* request, | |
| 413 ResourceType resource_type, | |
| 414 ResourceContext* resource_context, | |
| 415 AppCacheService* appcache_service, | |
| 416 int child_id, | |
| 417 int route_id, | |
| 418 scoped_ptr<ResourceHandler> handler); | |
| 419 | |
| 414 void OnDataDownloadedACK(int request_id); | 420 void OnDataDownloadedACK(int request_id); |
| 415 void OnUploadProgressACK(int request_id); | 421 void OnUploadProgressACK(int request_id); |
| 416 void OnCancelRequest(int request_id); | 422 void OnCancelRequest(int request_id); |
| 417 void OnReleaseDownloadedFile(int request_id); | 423 void OnReleaseDownloadedFile(int request_id); |
| 418 | 424 |
| 419 // Creates ResourceRequestInfoImpl for a download or page save. | 425 // Creates ResourceRequestInfoImpl for a download or page save. |
| 420 // |download| should be true if the request is a file download. | 426 // |download| should be true if the request is a file download. |
| 421 ResourceRequestInfoImpl* CreateRequestInfo( | 427 ResourceRequestInfoImpl* CreateRequestInfo( |
| 422 int child_id, | 428 int child_id, |
| 423 int route_id, | 429 int route_id, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 DelegateMap delegate_map_; | 550 DelegateMap delegate_map_; |
| 545 | 551 |
| 546 scoped_ptr<ResourceScheduler> scheduler_; | 552 scoped_ptr<ResourceScheduler> scheduler_; |
| 547 | 553 |
| 548 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 554 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 549 }; | 555 }; |
| 550 | 556 |
| 551 } // namespace content | 557 } // namespace content |
| 552 | 558 |
| 553 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 559 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |