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