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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 // ResourceLoaderDelegate implementation: | 324 // ResourceLoaderDelegate implementation: |
325 ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( | 325 ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( |
326 ResourceLoader* loader, | 326 ResourceLoader* loader, |
327 net::AuthChallengeInfo* auth_info) override; | 327 net::AuthChallengeInfo* auth_info) override; |
328 bool HandleExternalProtocol(ResourceLoader* loader, const GURL& url) override; | 328 bool HandleExternalProtocol(ResourceLoader* loader, const GURL& url) override; |
329 void DidStartRequest(ResourceLoader* loader) override; | 329 void DidStartRequest(ResourceLoader* loader) override; |
330 void DidReceiveRedirect(ResourceLoader* loader, const GURL& new_url) override; | 330 void DidReceiveRedirect(ResourceLoader* loader, const GURL& new_url) override; |
331 void DidReceiveResponse(ResourceLoader* loader) override; | 331 void DidReceiveResponse(ResourceLoader* loader) override; |
332 void DidFinishLoading(ResourceLoader* loader) override; | 332 void DidFinishLoading(ResourceLoader* loader) override; |
| 333 void LoaderDestroyed(ResourceLoader* loader) override; |
333 | 334 |
334 // An init helper that runs on the IO thread. | 335 // An init helper that runs on the IO thread. |
335 void OnInit(); | 336 void OnInit(); |
336 | 337 |
337 // A shutdown helper that runs on the IO thread. | 338 // A shutdown helper that runs on the IO thread. |
338 void OnShutdown(); | 339 void OnShutdown(); |
339 | 340 |
340 // Helper function for regular and download requests. | 341 // Helper function for regular and download requests. |
341 void BeginRequestInternal(scoped_ptr<net::URLRequest> request, | 342 void BeginRequestInternal(scoped_ptr<net::URLRequest> request, |
342 scoped_ptr<ResourceHandler> handler); | 343 scoped_ptr<ResourceHandler> handler); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 ResourceMessageDelegate* delegate); | 517 ResourceMessageDelegate* delegate); |
517 void UnregisterResourceMessageDelegate(const GlobalRequestID& id, | 518 void UnregisterResourceMessageDelegate(const GlobalRequestID& id, |
518 ResourceMessageDelegate* delegate); | 519 ResourceMessageDelegate* delegate); |
519 | 520 |
520 int BuildLoadFlagsForRequest(const ResourceHostMsg_Request& request_data, | 521 int BuildLoadFlagsForRequest(const ResourceHostMsg_Request& request_data, |
521 int child_id, | 522 int child_id, |
522 bool is_sync_load); | 523 bool is_sync_load); |
523 | 524 |
524 LoaderMap pending_loaders_; | 525 LoaderMap pending_loaders_; |
525 | 526 |
| 527 // Keep a set of request ids currently in use. This is used to validate |
| 528 // incoming request ids from renderers and disallow duplicates. |
| 529 std::set<GlobalRequestID> request_ids_in_use_; |
| 530 |
526 // Collection of temp files downloaded for child processes via | 531 // Collection of temp files downloaded for child processes via |
527 // the download_to_file mechanism. We avoid deleting them until | 532 // the download_to_file mechanism. We avoid deleting them until |
528 // the client no longer needs them. | 533 // the client no longer needs them. |
529 typedef std::map<int, scoped_refptr<storage::ShareableFileReference> > | 534 typedef std::map<int, scoped_refptr<storage::ShareableFileReference> > |
530 DeletableFilesMap; // key is request id | 535 DeletableFilesMap; // key is request id |
531 typedef std::map<int, DeletableFilesMap> | 536 typedef std::map<int, DeletableFilesMap> |
532 RegisteredTempFiles; // key is child process id | 537 RegisteredTempFiles; // key is child process id |
533 RegisteredTempFiles registered_temp_files_; | 538 RegisteredTempFiles registered_temp_files_; |
534 | 539 |
535 // A timer that periodically calls UpdateLoadInfo while pending_loaders_ is | 540 // A timer that periodically calls UpdateLoadInfo while pending_loaders_ is |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 DelegateMap delegate_map_; | 616 DelegateMap delegate_map_; |
612 | 617 |
613 scoped_ptr<ResourceScheduler> scheduler_; | 618 scoped_ptr<ResourceScheduler> scheduler_; |
614 | 619 |
615 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 620 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
616 }; | 621 }; |
617 | 622 |
618 } // namespace content | 623 } // namespace content |
619 | 624 |
620 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 625 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |