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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( | 209 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( |
210 net::URLRequest* request, | 210 net::URLRequest* request, |
211 bool is_content_initiated, | 211 bool is_content_initiated, |
212 bool must_download, | 212 bool must_download, |
213 uint32 id, | 213 uint32 id, |
214 scoped_ptr<DownloadSaveInfo> save_info, | 214 scoped_ptr<DownloadSaveInfo> save_info, |
215 const DownloadUrlParameters::OnStartedCallback& started_cb); | 215 const DownloadUrlParameters::OnStartedCallback& started_cb); |
216 | 216 |
217 // Must be called after the ResourceRequestInfo has been created | 217 // Must be called after the ResourceRequestInfo has been created |
218 // and associated with the request. If |payload| is set to a non-empty value, | 218 // and associated with the request. If |payload| is set to a non-empty value, |
219 // the value will be sent to the old resource handler instead of cancelling | 219 // the value will be sent to the old resource handler instead of canceling |
220 // it, except on HTTP errors. | 220 // it, except on HTTP errors. |
221 scoped_ptr<ResourceHandler> MaybeInterceptAsStream( | 221 scoped_ptr<ResourceHandler> MaybeInterceptAsStream( |
222 net::URLRequest* request, | 222 net::URLRequest* request, |
223 ResourceResponse* response, | 223 ResourceResponse* response, |
224 std::string* payload); | 224 std::string* payload); |
225 | 225 |
226 void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); | 226 void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); |
227 | 227 |
228 ResourceScheduler* scheduler() { return scheduler_.get(); } | 228 ResourceScheduler* scheduler() { return scheduler_.get(); } |
229 | 229 |
230 // Called by a ResourceHandler when it's ready to start reading data and | 230 // Called by a ResourceHandler when it's ready to start reading data and |
231 // 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 |
232 // descriptors available for the shared memory buffer. If false is returned, | 232 // descriptors available for the shared memory buffer. If false is returned, |
233 // the request should cancel. | 233 // the request should cancel. |
234 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); | 234 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); |
235 | 235 |
236 // 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 |
237 // 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 |
238 // elsewhere. | 238 // elsewhere. |
239 void FinishedWithResourcesForRequest(const net::URLRequest* request_); | 239 void FinishedWithResourcesForRequest(const net::URLRequest* request_); |
240 | 240 |
| 241 // PlzNavigate |
241 // Called by NavigationRequest to start a navigation request in the node | 242 // Called by NavigationRequest to start a navigation request in the node |
242 // identified by |frame_node_id|. | 243 // identified by |frame_node_id|. |
243 void NavigationRequest(const NavigationRequestInfo& info, | 244 void StartNavigationRequest(const NavigationRequestInfo& info, |
244 scoped_refptr<ResourceRequestBody> request_body, | 245 scoped_refptr<ResourceRequestBody> request_body, |
245 int64 frame_node_id); | 246 int64 navigation_request_id, |
| 247 int64 frame_node_id); |
| 248 |
| 249 // PlzNavigate |
| 250 // Called by NavigationRequest to cancel a navigation request with the |
| 251 // provided |navigation_request_id| in the node identified by |
| 252 // |frame_node_id|. |
| 253 void CancelNavigationRequest(int64 navigation_request_id, |
| 254 int64 frame_node_id); |
246 | 255 |
247 private: | 256 private: |
248 friend class ResourceDispatcherHostTest; | 257 friend class ResourceDispatcherHostTest; |
249 | 258 |
250 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 259 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
251 TestBlockedRequestsProcessDies); | 260 TestBlockedRequestsProcessDies); |
252 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 261 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
253 CalculateApproximateMemoryCost); | 262 CalculateApproximateMemoryCost); |
254 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 263 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
255 DetachableResourceTimesOut); | 264 DetachableResourceTimesOut); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 DelegateMap delegate_map_; | 525 DelegateMap delegate_map_; |
517 | 526 |
518 scoped_ptr<ResourceScheduler> scheduler_; | 527 scoped_ptr<ResourceScheduler> scheduler_; |
519 | 528 |
520 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 529 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
521 }; | 530 }; |
522 | 531 |
523 } // namespace content | 532 } // namespace content |
524 | 533 |
525 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 534 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |