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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 int child_id, | 113 int child_id, |
114 int route_id, | 114 int route_id, |
115 ResourceContext* context); | 115 ResourceContext* context); |
116 | 116 |
117 // Cancels the given request if it still exists. We ignore cancels from the | 117 // Cancels the given request if it still exists. We ignore cancels from the |
118 // renderer in the event of a download. | 118 // renderer in the event of a download. |
119 void CancelRequest(int child_id, | 119 void CancelRequest(int child_id, |
120 int request_id, | 120 int request_id, |
121 bool from_renderer); | 121 bool from_renderer); |
122 | 122 |
| 123 // If the request still exists it is marked as canceled with a |
| 124 // HANDLED_EXTERNALLY status. |
| 125 void CancelRequestWithHandledExternallyStatus(int child_id, int request_id); |
| 126 |
123 // Follows a deferred redirect for the given request. | 127 // Follows a deferred redirect for the given request. |
124 // new_first_party_for_cookies, if non-empty, is the new cookie policy URL | 128 // new_first_party_for_cookies, if non-empty, is the new cookie policy URL |
125 // for the redirected URL. If the cookie policy URL needs changing, pass | 129 // for the redirected URL. If the cookie policy URL needs changing, pass |
126 // true as has_new_first_party_for_cookies and the new cookie policy URL as | 130 // true as has_new_first_party_for_cookies and the new cookie policy URL as |
127 // new_first_party_for_cookies. Otherwise, pass false as | 131 // new_first_party_for_cookies. Otherwise, pass false as |
128 // has_new_first_party_for_cookies, and new_first_party_for_cookies will not | 132 // has_new_first_party_for_cookies, and new_first_party_for_cookies will not |
129 // be used. | 133 // be used. |
130 void FollowDeferredRedirect(int child_id, | 134 void FollowDeferredRedirect(int child_id, |
131 int request_id, | 135 int request_id, |
132 bool has_new_first_party_for_cookies, | 136 bool has_new_first_party_for_cookies, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Internal function to finish handling the ResponseStarted message. Returns | 321 // Internal function to finish handling the ResponseStarted message. Returns |
318 // true on success. | 322 // true on success. |
319 bool CompleteResponseStarted(net::URLRequest* request); | 323 bool CompleteResponseStarted(net::URLRequest* request); |
320 | 324 |
321 void ResponseCompleted(net::URLRequest* request); | 325 void ResponseCompleted(net::URLRequest* request); |
322 void CallResponseCompleted(int child_id, int request_id); | 326 void CallResponseCompleted(int child_id, int request_id); |
323 | 327 |
324 // Helper function for regular and download requests. | 328 // Helper function for regular and download requests. |
325 void BeginRequestInternal(net::URLRequest* request); | 329 void BeginRequestInternal(net::URLRequest* request); |
326 | 330 |
| 331 // Helper function that resolves the request for the given (child_id, |
| 332 // request_id) pair, cancels that request and posts a completion notification |
| 333 // for the request if needed. |
| 334 void CancelRequestWorker(int child_id, |
| 335 int request_id, |
| 336 bool from_renderer, |
| 337 bool handled_externally); |
| 338 |
327 // Helper function that cancels |request|. Returns whether the | 339 // Helper function that cancels |request|. Returns whether the |
328 // request was actually cancelled. If a renderer cancels a request | 340 // request was actually cancelled. If a renderer cancels a request |
329 // for a download, we ignore the cancellation. | 341 // for a download, we ignore the cancellation. |
330 bool CancelRequestInternal(net::URLRequest* request, bool from_renderer); | 342 bool CancelRequestInternal(net::URLRequest* request, |
| 343 bool from_renderer, |
| 344 bool handled_externally); |
331 | 345 |
332 // Updates the "cost" of outstanding requests for |child_id|. | 346 // Updates the "cost" of outstanding requests for |child_id|. |
333 // The "cost" approximates how many bytes are consumed by all the in-memory | 347 // The "cost" approximates how many bytes are consumed by all the in-memory |
334 // data structures supporting this request (net::URLRequest object, | 348 // data structures supporting this request (net::URLRequest object, |
335 // HttpNetworkTransaction, etc...). | 349 // HttpNetworkTransaction, etc...). |
336 // The value of |cost| is added to the running total, and the resulting | 350 // The value of |cost| is added to the running total, and the resulting |
337 // sum is returned. | 351 // sum is returned. |
338 int IncrementOutstandingRequestsMemoryCost(int cost, | 352 int IncrementOutstandingRequestsMemoryCost(int cost, |
339 int child_id); | 353 int child_id); |
340 | 354 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // http://crbug.com/90971 - Assists in tracking down use-after-frees on | 539 // http://crbug.com/90971 - Assists in tracking down use-after-frees on |
526 // shutdown. | 540 // shutdown. |
527 std::set<const ResourceContext*> active_resource_contexts_; | 541 std::set<const ResourceContext*> active_resource_contexts_; |
528 | 542 |
529 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 543 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
530 }; | 544 }; |
531 | 545 |
532 } // namespace content | 546 } // namespace content |
533 | 547 |
534 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 548 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |