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 12 matching lines...) Expand all Loading... |
23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
24 #include "base/observer_list.h" | 24 #include "base/observer_list.h" |
25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
26 #include "base/timer/timer.h" | 26 #include "base/timer/timer.h" |
27 #include "content/browser/download/download_resource_handler.h" | 27 #include "content/browser/download/download_resource_handler.h" |
28 #include "content/browser/loader/global_routing_id.h" | 28 #include "content/browser/loader/global_routing_id.h" |
29 #include "content/browser/loader/resource_loader.h" | 29 #include "content/browser/loader/resource_loader.h" |
30 #include "content/browser/loader/resource_loader_delegate.h" | 30 #include "content/browser/loader/resource_loader_delegate.h" |
31 #include "content/browser/loader/resource_scheduler.h" | 31 #include "content/browser/loader/resource_scheduler.h" |
32 #include "content/common/content_export.h" | 32 #include "content/common/content_export.h" |
| 33 #include "content/common/resource_request_body.h" |
33 #include "content/public/browser/child_process_data.h" | 34 #include "content/public/browser/child_process_data.h" |
34 #include "content/public/browser/download_item.h" | 35 #include "content/public/browser/download_item.h" |
35 #include "content/public/browser/download_url_parameters.h" | 36 #include "content/public/browser/download_url_parameters.h" |
36 #include "content/public/browser/global_request_id.h" | 37 #include "content/public/browser/global_request_id.h" |
37 #include "content/public/browser/notification_types.h" | 38 #include "content/public/browser/notification_types.h" |
38 #include "content/public/browser/resource_dispatcher_host.h" | 39 #include "content/public/browser/resource_dispatcher_host.h" |
39 #include "ipc/ipc_message.h" | 40 #include "ipc/ipc_message.h" |
40 #include "net/cookies/canonical_cookie.h" | 41 #include "net/cookies/canonical_cookie.h" |
41 #include "net/url_request/url_request.h" | 42 #include "net/url_request/url_request.h" |
42 #include "webkit/common/resource_type.h" | 43 #include "webkit/common/resource_type.h" |
43 | 44 |
44 class ResourceHandler; | 45 class ResourceHandler; |
45 struct ResourceHostMsg_Request; | 46 struct ResourceHostMsg_Request; |
46 | 47 |
47 namespace net { | 48 namespace net { |
48 class URLRequestJobFactory; | 49 class URLRequestJobFactory; |
49 } | 50 } |
50 | 51 |
51 namespace webkit_blob { | 52 namespace webkit_blob { |
52 class ShareableFileReference; | 53 class ShareableFileReference; |
53 } | 54 } |
54 | 55 |
55 namespace content { | 56 namespace content { |
| 57 class NavigationRequestInfo; |
56 class ResourceContext; | 58 class ResourceContext; |
57 class ResourceDispatcherHostDelegate; | 59 class ResourceDispatcherHostDelegate; |
58 class ResourceMessageDelegate; | 60 class ResourceMessageDelegate; |
59 class ResourceMessageFilter; | 61 class ResourceMessageFilter; |
60 class ResourceRequestInfoImpl; | 62 class ResourceRequestInfoImpl; |
61 class SaveFileManager; | 63 class SaveFileManager; |
62 class WebContentsImpl; | 64 class WebContentsImpl; |
63 struct DownloadSaveInfo; | 65 struct DownloadSaveInfo; |
64 struct Referrer; | 66 struct Referrer; |
65 | 67 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // sending it to the renderer. Returns true if there are enough file | 231 // sending it to the renderer. Returns true if there are enough file |
230 // descriptors available for the shared memory buffer. If false is returned, | 232 // descriptors available for the shared memory buffer. If false is returned, |
231 // the request should cancel. | 233 // the request should cancel. |
232 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); | 234 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); |
233 | 235 |
234 // Called by a ResourceHandler after it has finished its request and is done | 236 // Called by a ResourceHandler after it has finished its request and is done |
235 // using its shared memory buffer. Frees up that file descriptor to be used | 237 // using its shared memory buffer. Frees up that file descriptor to be used |
236 // elsewhere. | 238 // elsewhere. |
237 void FinishedWithResourcesForRequest(const net::URLRequest* request_); | 239 void FinishedWithResourcesForRequest(const net::URLRequest* request_); |
238 | 240 |
| 241 // Called by NavigationRequest to start a navigation request in the node |
| 242 // identified by |frame_node_id|. |
| 243 void NavigationRequest(const NavigationRequestInfo& info, |
| 244 scoped_refptr<ResourceRequestBody> request_body, |
| 245 int64 frame_node_id); |
| 246 |
239 private: | 247 private: |
240 friend class ResourceDispatcherHostTest; | 248 friend class ResourceDispatcherHostTest; |
241 | 249 |
242 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 250 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
243 TestBlockedRequestsProcessDies); | 251 TestBlockedRequestsProcessDies); |
244 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 252 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
245 CalculateApproximateMemoryCost); | 253 CalculateApproximateMemoryCost); |
246 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 254 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
247 DetachableResourceTimesOut); | 255 DetachableResourceTimesOut); |
248 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 256 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 DelegateMap delegate_map_; | 516 DelegateMap delegate_map_; |
509 | 517 |
510 scoped_ptr<ResourceScheduler> scheduler_; | 518 scoped_ptr<ResourceScheduler> scheduler_; |
511 | 519 |
512 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 520 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
513 }; | 521 }; |
514 | 522 |
515 } // namespace content | 523 } // namespace content |
516 | 524 |
517 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 525 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |