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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( | 220 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( |
221 net::URLRequest* request, | 221 net::URLRequest* request, |
222 bool is_content_initiated, | 222 bool is_content_initiated, |
223 bool must_download, | 223 bool must_download, |
224 uint32 id, | 224 uint32 id, |
225 scoped_ptr<DownloadSaveInfo> save_info, | 225 scoped_ptr<DownloadSaveInfo> save_info, |
226 const DownloadUrlParameters::OnStartedCallback& started_cb); | 226 const DownloadUrlParameters::OnStartedCallback& started_cb); |
227 | 227 |
228 // Must be called after the ResourceRequestInfo has been created | 228 // Must be called after the ResourceRequestInfo has been created |
229 // and associated with the request. If |payload| is set to a non-empty value, | 229 // and associated with the request. If |payload| is set to a non-empty value, |
230 // the value will be sent to the old resource handler instead of cancelling | 230 // the value will be sent to the old resource handler instead of canceling |
231 // it, except on HTTP errors. | 231 // it, except on HTTP errors. |
232 scoped_ptr<ResourceHandler> MaybeInterceptAsStream( | 232 scoped_ptr<ResourceHandler> MaybeInterceptAsStream( |
233 net::URLRequest* request, | 233 net::URLRequest* request, |
234 ResourceResponse* response, | 234 ResourceResponse* response, |
235 std::string* payload); | 235 std::string* payload); |
236 | 236 |
237 void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); | 237 void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); |
238 | 238 |
239 ResourceScheduler* scheduler() { return scheduler_.get(); } | 239 ResourceScheduler* scheduler() { return scheduler_.get(); } |
240 | 240 |
241 // Called by a ResourceHandler when it's ready to start reading data and | 241 // Called by a ResourceHandler when it's ready to start reading data and |
242 // sending it to the renderer. Returns true if there are enough file | 242 // sending it to the renderer. Returns true if there are enough file |
243 // descriptors available for the shared memory buffer. If false is returned, | 243 // descriptors available for the shared memory buffer. If false is returned, |
244 // the request should cancel. | 244 // the request should cancel. |
245 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); | 245 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); |
246 | 246 |
247 // Called by a ResourceHandler after it has finished its request and is done | 247 // Called by a ResourceHandler after it has finished its request and is done |
248 // using its shared memory buffer. Frees up that file descriptor to be used | 248 // using its shared memory buffer. Frees up that file descriptor to be used |
249 // elsewhere. | 249 // elsewhere. |
250 void FinishedWithResourcesForRequest(const net::URLRequest* request_); | 250 void FinishedWithResourcesForRequest(const net::URLRequest* request_); |
251 | 251 |
| 252 // PlzNavigate |
252 // Called by NavigationRequest to start a navigation request in the node | 253 // Called by NavigationRequest to start a navigation request in the node |
253 // identified by |frame_node_id|. | 254 // identified by |frame_node_id|. |
254 void NavigationRequest(const NavigationRequestInfo& info, | 255 void StartNavigationRequest(const NavigationRequestInfo& info, |
255 scoped_refptr<ResourceRequestBody> request_body, | 256 scoped_refptr<ResourceRequestBody> request_body, |
256 int64 frame_node_id); | 257 int64 navigation_request_id, |
| 258 int64 frame_node_id); |
| 259 |
| 260 // PlzNavigate |
| 261 // Called by NavigationRequest to cancel a navigation request with the |
| 262 // provided |navigation_request_id| in the node identified by |
| 263 // |frame_node_id|. |
| 264 void CancelNavigationRequest(int64 navigation_request_id, |
| 265 int64 frame_node_id); |
257 | 266 |
258 private: | 267 private: |
259 friend class ResourceDispatcherHostTest; | 268 friend class ResourceDispatcherHostTest; |
260 | 269 |
261 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 270 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
262 TestBlockedRequestsProcessDies); | 271 TestBlockedRequestsProcessDies); |
263 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 272 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
264 CalculateApproximateMemoryCost); | 273 CalculateApproximateMemoryCost); |
265 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 274 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
266 DetachableResourceTimesOut); | 275 DetachableResourceTimesOut); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 DelegateMap delegate_map_; | 536 DelegateMap delegate_map_; |
528 | 537 |
529 scoped_ptr<ResourceScheduler> scheduler_; | 538 scoped_ptr<ResourceScheduler> scheduler_; |
530 | 539 |
531 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 540 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
532 }; | 541 }; |
533 | 542 |
534 } // namespace content | 543 } // namespace content |
535 | 544 |
536 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 545 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |