| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 virtual net::Error BeginDownload( | 77 virtual net::Error BeginDownload( |
| 78 scoped_ptr<net::URLRequest> request, | 78 scoped_ptr<net::URLRequest> request, |
| 79 bool is_content_initiated, | 79 bool is_content_initiated, |
| 80 ResourceContext* context, | 80 ResourceContext* context, |
| 81 int child_id, | 81 int child_id, |
| 82 int route_id, | 82 int route_id, |
| 83 bool prefer_cache, | 83 bool prefer_cache, |
| 84 const DownloadSaveInfo& save_info, | 84 const DownloadSaveInfo& save_info, |
| 85 const DownloadStartedCallback& started_callback) OVERRIDE; | 85 const DownloadStartedCallback& started_callback) OVERRIDE; |
| 86 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) OVERRIDE; | 86 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) OVERRIDE; |
| 87 virtual void MarkAsTransferredNavigation(net::URLRequest* request) OVERRIDE; | |
| 88 | 87 |
| 89 // Puts the resource dispatcher host in an inactive state (unable to begin | 88 // Puts the resource dispatcher host in an inactive state (unable to begin |
| 90 // new requests). Cancels all pending requests. | 89 // new requests). Cancels all pending requests. |
| 91 void Shutdown(); | 90 void Shutdown(); |
| 92 | 91 |
| 93 // Notify the ResourceDispatcherHostImpl of a new resource context. | 92 // Notify the ResourceDispatcherHostImpl of a new resource context. |
| 94 void AddResourceContext(ResourceContext* context); | 93 void AddResourceContext(ResourceContext* context); |
| 95 | 94 |
| 96 // Notify the ResourceDispatcherHostImpl of a resource context destruction. | 95 // Notify the ResourceDispatcherHostImpl of a resource context destruction. |
| 97 void RemoveResourceContext(ResourceContext* context); | 96 void RemoveResourceContext(ResourceContext* context); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 void StartDeferredRequest(int child_id, int request_id); | 136 void StartDeferredRequest(int child_id, int request_id); |
| 138 | 137 |
| 139 // Resumes network activity for a particular request. | 138 // Resumes network activity for a particular request. |
| 140 void ResumeDeferredRequest(int child_id, int request_id); | 139 void ResumeDeferredRequest(int child_id, int request_id); |
| 141 | 140 |
| 142 // Returns true if it's ok to send the data. If there are already too many | 141 // Returns true if it's ok to send the data. If there are already too many |
| 143 // data messages pending, it pauses the request and returns false. In this | 142 // data messages pending, it pauses the request and returns false. In this |
| 144 // case the caller should not send the data. | 143 // case the caller should not send the data. |
| 145 bool WillSendData(int child_id, int request_id); | 144 bool WillSendData(int child_id, int request_id); |
| 146 | 145 |
| 146 // Marks the request as "parked". This happens if a request is |
| 147 // redirected cross-site and needs to be resumed by a new render view. |
| 148 void MarkAsTransferredNavigation(net::URLRequest* request); |
| 149 |
| 147 // Returns the number of pending requests. This is designed for the unittests | 150 // Returns the number of pending requests. This is designed for the unittests |
| 148 int pending_requests() const { | 151 int pending_requests() const { |
| 149 return static_cast<int>(pending_requests_.size()); | 152 return static_cast<int>(pending_requests_.size()); |
| 150 } | 153 } |
| 151 | 154 |
| 152 // Intended for unit-tests only. Returns the memory cost of all the | 155 // Intended for unit-tests only. Returns the memory cost of all the |
| 153 // outstanding requests (pending and blocked) for |child_id|. | 156 // outstanding requests (pending and blocked) for |child_id|. |
| 154 int GetOutstandingRequestsMemoryCost(int child_id) const; | 157 int GetOutstandingRequestsMemoryCost(int child_id) const; |
| 155 | 158 |
| 156 // Intended for unit-tests only. Overrides the outstanding requests bound. | 159 // Intended for unit-tests only. Overrides the outstanding requests bound. |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 // http://crbug.com/90971 - Assists in tracking down use-after-frees on | 525 // http://crbug.com/90971 - Assists in tracking down use-after-frees on |
| 523 // shutdown. | 526 // shutdown. |
| 524 std::set<const ResourceContext*> active_resource_contexts_; | 527 std::set<const ResourceContext*> active_resource_contexts_; |
| 525 | 528 |
| 526 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 529 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 527 }; | 530 }; |
| 528 | 531 |
| 529 } // namespace content | 532 } // namespace content |
| 530 | 533 |
| 531 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 534 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |