Chromium Code Reviews| 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 // specified |id|. | 484 // specified |id|. |
| 485 void RegisterResourceMessageDelegate(const GlobalRequestID& id, | 485 void RegisterResourceMessageDelegate(const GlobalRequestID& id, |
| 486 ResourceMessageDelegate* delegate); | 486 ResourceMessageDelegate* delegate); |
| 487 void UnregisterResourceMessageDelegate(const GlobalRequestID& id, | 487 void UnregisterResourceMessageDelegate(const GlobalRequestID& id, |
| 488 ResourceMessageDelegate* delegate); | 488 ResourceMessageDelegate* delegate); |
| 489 | 489 |
| 490 int BuildLoadFlagsForRequest(const ResourceHostMsg_Request& request_data, | 490 int BuildLoadFlagsForRequest(const ResourceHostMsg_Request& request_data, |
| 491 int child_id, | 491 int child_id, |
| 492 bool is_sync_load); | 492 bool is_sync_load); |
| 493 | 493 |
| 494 // Schedules UpdateLoadInfo() to be invoked after a delay (for coalescing). | |
| 495 // This is only necessary when a page is loading or if there is an upload in | |
| 496 // progress. We want to avoid repeatedly calling this when we have a "hanging | |
| 497 // get" request like when on a Google Docs document. | |
|
mmenke
2015/05/21 15:53:25
nit: Don't use "we" in comments, due to ambiguity
Andre
2015/05/21 22:05:39
Done.
| |
| 498 void ScheduleUpdateLoadInfo(); | |
| 499 | |
| 494 LoaderMap pending_loaders_; | 500 LoaderMap pending_loaders_; |
| 495 | 501 |
| 496 // Collection of temp files downloaded for child processes via | 502 // Collection of temp files downloaded for child processes via |
| 497 // the download_to_file mechanism. We avoid deleting them until | 503 // the download_to_file mechanism. We avoid deleting them until |
| 498 // the client no longer needs them. | 504 // the client no longer needs them. |
| 499 typedef std::map<int, scoped_refptr<storage::ShareableFileReference> > | 505 typedef std::map<int, scoped_refptr<storage::ShareableFileReference> > |
| 500 DeletableFilesMap; // key is request id | 506 DeletableFilesMap; // key is request id |
| 501 typedef std::map<int, DeletableFilesMap> | 507 typedef std::map<int, DeletableFilesMap> |
| 502 RegisteredTempFiles; // key is child process id | 508 RegisteredTempFiles; // key is child process id |
| 503 RegisteredTempFiles registered_temp_files_; | 509 RegisteredTempFiles registered_temp_files_; |
| 504 | 510 |
| 505 // A timer that periodically calls UpdateLoadStates while pending_requests_ | 511 // A timer for scheduling a call to UpdateLoadInfo after a delay. |
| 506 // is not empty. | 512 scoped_ptr<base::OneShotTimer<ResourceDispatcherHostImpl> > |
| 507 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> > | |
| 508 update_load_states_timer_; | 513 update_load_states_timer_; |
| 509 | 514 |
| 510 // We own the save file manager. | 515 // We own the save file manager. |
| 511 scoped_refptr<SaveFileManager> save_file_manager_; | 516 scoped_refptr<SaveFileManager> save_file_manager_; |
| 512 | 517 |
| 513 // Request ID for browser initiated requests. request_ids generated by | 518 // Request ID for browser initiated requests. request_ids generated by |
| 514 // child processes are counted up from 0, while browser created requests | 519 // child processes are counted up from 0, while browser created requests |
| 515 // start at -2 and go down from there. (We need to start at -2 because -1 is | 520 // start at -2 and go down from there. (We need to start at -2 because -1 is |
| 516 // used as a special value all over the resource_dispatcher_host for | 521 // used as a special value all over the resource_dispatcher_host for |
| 517 // uninitialized variables.) This way, we no longer have the unlikely (but | 522 // uninitialized variables.) This way, we no longer have the unlikely (but |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 DelegateMap delegate_map_; | 583 DelegateMap delegate_map_; |
| 579 | 584 |
| 580 scoped_ptr<ResourceScheduler> scheduler_; | 585 scoped_ptr<ResourceScheduler> scheduler_; |
| 581 | 586 |
| 582 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 587 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 583 }; | 588 }; |
| 584 | 589 |
| 585 } // namespace content | 590 } // namespace content |
| 586 | 591 |
| 587 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 592 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |