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