| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 net::URLRequest* request, | 242 net::URLRequest* request, |
| 243 ResourceResponse* response, | 243 ResourceResponse* response, |
| 244 std::string* payload); | 244 std::string* payload); |
| 245 | 245 |
| 246 ResourceScheduler* scheduler() { return scheduler_.get(); } | 246 ResourceScheduler* scheduler() { return scheduler_.get(); } |
| 247 | 247 |
| 248 // Called by a ResourceHandler when it's ready to start reading data and | 248 // Called by a ResourceHandler when it's ready to start reading data and |
| 249 // sending it to the renderer. Returns true if there are enough file | 249 // sending it to the renderer. Returns true if there are enough file |
| 250 // descriptors available for the shared memory buffer. If false is returned, | 250 // descriptors available for the shared memory buffer. If false is returned, |
| 251 // the request should cancel. | 251 // the request should cancel. |
| 252 bool HasSufficientResourcesForRequest(const net::URLRequest* request_); | 252 bool HasSufficientResourcesForRequest(net::URLRequest* request); |
| 253 | 253 |
| 254 // Called by a ResourceHandler after it has finished its request and is done | 254 // 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 | 255 // using its shared memory buffer. Frees up that file descriptor to be used |
| 256 // elsewhere. | 256 // elsewhere. |
| 257 void FinishedWithResourcesForRequest(const net::URLRequest* request_); | 257 void FinishedWithResourcesForRequest(net::URLRequest* request); |
| 258 | 258 |
| 259 // PlzNavigate | 259 // PlzNavigate |
| 260 // Called by NavigationRequest to start a navigation request in the node | 260 // Called by NavigationRequest to start a navigation request in the node |
| 261 // identified by |frame_node_id|. | 261 // identified by |frame_node_id|. |
| 262 void StartNavigationRequest(const CommonNavigationParams& common_params, | 262 void StartNavigationRequest(const CommonNavigationParams& common_params, |
| 263 const NavigationRequestInfo& info, | 263 const NavigationRequestInfo& info, |
| 264 scoped_refptr<ResourceRequestBody> request_body, | 264 scoped_refptr<ResourceRequestBody> request_body, |
| 265 int64 navigation_request_id, | 265 int64 navigation_request_id, |
| 266 int64 frame_node_id); | 266 int64 frame_node_id); |
| 267 | 267 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // the renderer that made the request in |info|. | 336 // the renderer that made the request in |info|. |
| 337 void UpdateOutstandingRequestsStats(const ResourceRequestInfoImpl& info, | 337 void UpdateOutstandingRequestsStats(const ResourceRequestInfoImpl& info, |
| 338 const OustandingRequestsStats& stats); | 338 const OustandingRequestsStats& stats); |
| 339 | 339 |
| 340 // Called every time an outstanding request is created or deleted. |count| | 340 // Called every time an outstanding request is created or deleted. |count| |
| 341 // indicates whether the request is new or deleted. |count| must be 1 or -1. | 341 // indicates whether the request is new or deleted. |count| must be 1 or -1. |
| 342 OustandingRequestsStats IncrementOutstandingRequestsMemory( | 342 OustandingRequestsStats IncrementOutstandingRequestsMemory( |
| 343 int count, | 343 int count, |
| 344 const ResourceRequestInfoImpl& info); | 344 const ResourceRequestInfoImpl& info); |
| 345 | 345 |
| 346 // Called every time an in flight request is issued or finished. |count| | 346 // Called when an in flight request allocates or releases a shared memory |
| 347 // indicates whether the request is issuing or finishing. |count| must be 1 | 347 // buffer. |count| indicates whether the request is issuing or finishing. |
| 348 // or -1. | 348 // |count| must be 1 or -1. |
| 349 OustandingRequestsStats IncrementOutstandingRequestsCount( | 349 OustandingRequestsStats IncrementOutstandingRequestsCount( |
| 350 int count, | 350 int count, |
| 351 const ResourceRequestInfoImpl& info); | 351 ResourceRequestInfoImpl* info); |
| 352 | 352 |
| 353 // Estimate how much heap space |request| will consume to run. | 353 // Estimate how much heap space |request| will consume to run. |
| 354 static int CalculateApproximateMemoryCost(net::URLRequest* request); | 354 static int CalculateApproximateMemoryCost(net::URLRequest* request); |
| 355 | 355 |
| 356 // Force cancels any pending requests for the given route id. This method | 356 // Force cancels any pending requests for the given route id. This method |
| 357 // acts like CancelRequestsForProcess when route_id is -1. | 357 // acts like CancelRequestsForProcess when route_id is -1. |
| 358 void CancelRequestsForRoute(int child_id, int route_id); | 358 void CancelRequestsForRoute(int child_id, int route_id); |
| 359 | 359 |
| 360 // The list of all requests that we have pending. This list is not really | 360 // The list of all requests that we have pending. This list is not really |
| 361 // optimized, and assumes that we have relatively few requests pending at once | 361 // optimized, and assumes that we have relatively few requests pending at once |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 DelegateMap delegate_map_; | 544 DelegateMap delegate_map_; |
| 545 | 545 |
| 546 scoped_ptr<ResourceScheduler> scheduler_; | 546 scoped_ptr<ResourceScheduler> scheduler_; |
| 547 | 547 |
| 548 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 548 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 549 }; | 549 }; |
| 550 | 550 |
| 551 } // namespace content | 551 } // namespace content |
| 552 | 552 |
| 553 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 553 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |