| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 13 matching lines...) Expand all Loading... |
| 24 #include "base/timer.h" | 24 #include "base/timer.h" |
| 25 #include "content/browser/renderer_host/resource_queue.h" | 25 #include "content/browser/renderer_host/resource_queue.h" |
| 26 #include "content/common/child_process_info.h" | 26 #include "content/common/child_process_info.h" |
| 27 #include "content/common/content_notification_types.h" | 27 #include "content/common/content_notification_types.h" |
| 28 #include "ipc/ipc_message.h" | 28 #include "ipc/ipc_message.h" |
| 29 #include "net/url_request/url_request.h" | 29 #include "net/url_request/url_request.h" |
| 30 #include "webkit/glue/resource_type.h" | 30 #include "webkit/glue/resource_type.h" |
| 31 | 31 |
| 32 class CrossSiteResourceHandler; | 32 class CrossSiteResourceHandler; |
| 33 class DownloadFileManager; | 33 class DownloadFileManager; |
| 34 class DownloadRequestLimiter; | |
| 35 class LoginHandler; | 34 class LoginHandler; |
| 36 class NotificationDetails; | 35 class NotificationDetails; |
| 37 class PluginService; | 36 class PluginService; |
| 38 class ResourceDispatcherHostDelegate; | 37 class ResourceDispatcherHostDelegate; |
| 39 class ResourceDispatcherHostRequestInfo; | 38 class ResourceDispatcherHostRequestInfo; |
| 40 class ResourceHandler; | 39 class ResourceHandler; |
| 41 class ResourceMessageFilter; | 40 class ResourceMessageFilter; |
| 42 class SaveFileManager; | 41 class SaveFileManager; |
| 43 class SSLClientAuthHandler; | 42 class SSLClientAuthHandler; |
| 44 class TabContents; | 43 class TabContents; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 139 } |
| 141 | 140 |
| 142 // The average private bytes increase of the browser for each new pending | 141 // The average private bytes increase of the browser for each new pending |
| 143 // request. Experimentally obtained. | 142 // request. Experimentally obtained. |
| 144 static const int kAvgBytesPerOutstandingRequest = 4400; | 143 static const int kAvgBytesPerOutstandingRequest = 4400; |
| 145 | 144 |
| 146 DownloadFileManager* download_file_manager() const { | 145 DownloadFileManager* download_file_manager() const { |
| 147 return download_file_manager_; | 146 return download_file_manager_; |
| 148 } | 147 } |
| 149 | 148 |
| 150 DownloadRequestLimiter* download_request_limiter() const { | |
| 151 return download_request_limiter_.get(); | |
| 152 } | |
| 153 | |
| 154 SaveFileManager* save_file_manager() const { | 149 SaveFileManager* save_file_manager() const { |
| 155 return save_file_manager_; | 150 return save_file_manager_; |
| 156 } | 151 } |
| 157 | 152 |
| 158 WebKitThread* webkit_thread() const { | 153 WebKitThread* webkit_thread() const { |
| 159 return webkit_thread_.get(); | 154 return webkit_thread_.get(); |
| 160 } | 155 } |
| 161 | 156 |
| 162 // Called when the unload handler for a cross-site request has finished. | 157 // Called when the unload handler for a cross-site request has finished. |
| 163 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); | 158 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 // A timer that periodically calls UpdateLoadStates while pending_requests_ | 451 // A timer that periodically calls UpdateLoadStates while pending_requests_ |
| 457 // is not empty. | 452 // is not empty. |
| 458 base::RepeatingTimer<ResourceDispatcherHost> update_load_states_timer_; | 453 base::RepeatingTimer<ResourceDispatcherHost> update_load_states_timer_; |
| 459 | 454 |
| 460 // Handles the resource requests from the moment we want to start them. | 455 // Handles the resource requests from the moment we want to start them. |
| 461 ResourceQueue resource_queue_; | 456 ResourceQueue resource_queue_; |
| 462 | 457 |
| 463 // We own the download file writing thread and manager | 458 // We own the download file writing thread and manager |
| 464 scoped_refptr<DownloadFileManager> download_file_manager_; | 459 scoped_refptr<DownloadFileManager> download_file_manager_; |
| 465 | 460 |
| 466 // Determines whether a download is allowed. | |
| 467 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; | |
| 468 | |
| 469 // We own the save file manager. | 461 // We own the save file manager. |
| 470 scoped_refptr<SaveFileManager> save_file_manager_; | 462 scoped_refptr<SaveFileManager> save_file_manager_; |
| 471 | 463 |
| 472 // We own the WebKit thread and see to its destruction. | 464 // We own the WebKit thread and see to its destruction. |
| 473 scoped_ptr<WebKitThread> webkit_thread_; | 465 scoped_ptr<WebKitThread> webkit_thread_; |
| 474 | 466 |
| 475 // Request ID for browser initiated requests. request_ids generated by | 467 // Request ID for browser initiated requests. request_ids generated by |
| 476 // child processes are counted up from 0, while browser created requests | 468 // child processes are counted up from 0, while browser created requests |
| 477 // start at -2 and go down from there. (We need to start at -2 because -1 is | 469 // start at -2 and go down from there. (We need to start at -2 because -1 is |
| 478 // used as a special value all over the resource_dispatcher_host for | 470 // used as a special value all over the resource_dispatcher_host for |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 509 |
| 518 ResourceDispatcherHostDelegate* delegate_; | 510 ResourceDispatcherHostDelegate* delegate_; |
| 519 | 511 |
| 520 static bool is_prefetch_enabled_; | 512 static bool is_prefetch_enabled_; |
| 521 bool allow_cross_origin_auth_prompt_; | 513 bool allow_cross_origin_auth_prompt_; |
| 522 | 514 |
| 523 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 515 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
| 524 }; | 516 }; |
| 525 | 517 |
| 526 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 518 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| OLD | NEW |