| 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 17 matching lines...) Expand all Loading... |
| 28 #include "content/browser/renderer_host/resource_loader_delegate.h" | 28 #include "content/browser/renderer_host/resource_loader_delegate.h" |
| 29 #include "content/common/content_export.h" | 29 #include "content/common/content_export.h" |
| 30 #include "content/public/browser/child_process_data.h" | 30 #include "content/public/browser/child_process_data.h" |
| 31 #include "content/public/browser/notification_types.h" | 31 #include "content/public/browser/notification_types.h" |
| 32 #include "content/public/browser/resource_dispatcher_host.h" | 32 #include "content/public/browser/resource_dispatcher_host.h" |
| 33 #include "ipc/ipc_message.h" | 33 #include "ipc/ipc_message.h" |
| 34 #include "net/cookies/canonical_cookie.h" | 34 #include "net/cookies/canonical_cookie.h" |
| 35 #include "net/url_request/url_request.h" | 35 #include "net/url_request/url_request.h" |
| 36 #include "webkit/glue/resource_type.h" | 36 #include "webkit/glue/resource_type.h" |
| 37 | 37 |
| 38 class DownloadFileManager; | |
| 39 class ResourceHandler; | 38 class ResourceHandler; |
| 40 class SaveFileManager; | 39 class SaveFileManager; |
| 41 class WebContentsImpl; | 40 class WebContentsImpl; |
| 42 struct ResourceHostMsg_Request; | 41 struct ResourceHostMsg_Request; |
| 43 struct ViewMsg_SwapOut_Params; | 42 struct ViewMsg_SwapOut_Params; |
| 44 | 43 |
| 45 namespace net { | 44 namespace net { |
| 46 class URLRequestJobFactory; | 45 class URLRequestJobFactory; |
| 47 } | 46 } |
| 48 | 47 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 136 |
| 138 // Intended for unit-tests only. Overrides the outstanding requests bound. | 137 // Intended for unit-tests only. Overrides the outstanding requests bound. |
| 139 void set_max_outstanding_requests_cost_per_process(int limit) { | 138 void set_max_outstanding_requests_cost_per_process(int limit) { |
| 140 max_outstanding_requests_cost_per_process_ = limit; | 139 max_outstanding_requests_cost_per_process_ = limit; |
| 141 } | 140 } |
| 142 | 141 |
| 143 // The average private bytes increase of the browser for each new pending | 142 // The average private bytes increase of the browser for each new pending |
| 144 // request. Experimentally obtained. | 143 // request. Experimentally obtained. |
| 145 static const int kAvgBytesPerOutstandingRequest = 4400; | 144 static const int kAvgBytesPerOutstandingRequest = 4400; |
| 146 | 145 |
| 147 DownloadFileManager* download_file_manager() const { | |
| 148 return download_file_manager_; | |
| 149 } | |
| 150 | |
| 151 SaveFileManager* save_file_manager() const { | 146 SaveFileManager* save_file_manager() const { |
| 152 return save_file_manager_; | 147 return save_file_manager_; |
| 153 } | 148 } |
| 154 | 149 |
| 155 // Called when the unload handler for a cross-site request has finished. | 150 // Called when the unload handler for a cross-site request has finished. |
| 156 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); | 151 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); |
| 157 | 152 |
| 158 // Called when we want to simulate the renderer process sending | 153 // Called when we want to simulate the renderer process sending |
| 159 // ViewHostMsg_SwapOut_ACK in cases where the renderer has died or is | 154 // ViewHostMsg_SwapOut_ACK in cases where the renderer has died or is |
| 160 // unresponsive. | 155 // unresponsive. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 DeletableFilesMap; // key is request id | 355 DeletableFilesMap; // key is request id |
| 361 typedef std::map<int, DeletableFilesMap> | 356 typedef std::map<int, DeletableFilesMap> |
| 362 RegisteredTempFiles; // key is child process id | 357 RegisteredTempFiles; // key is child process id |
| 363 RegisteredTempFiles registered_temp_files_; | 358 RegisteredTempFiles registered_temp_files_; |
| 364 | 359 |
| 365 // A timer that periodically calls UpdateLoadStates while pending_requests_ | 360 // A timer that periodically calls UpdateLoadStates while pending_requests_ |
| 366 // is not empty. | 361 // is not empty. |
| 367 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> > | 362 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> > |
| 368 update_load_states_timer_; | 363 update_load_states_timer_; |
| 369 | 364 |
| 370 // We own the download file writing thread and manager | |
| 371 scoped_refptr<DownloadFileManager> download_file_manager_; | |
| 372 | |
| 373 // We own the save file manager. | 365 // We own the save file manager. |
| 374 scoped_refptr<SaveFileManager> save_file_manager_; | 366 scoped_refptr<SaveFileManager> save_file_manager_; |
| 375 | 367 |
| 376 // Request ID for browser initiated requests. request_ids generated by | 368 // Request ID for browser initiated requests. request_ids generated by |
| 377 // child processes are counted up from 0, while browser created requests | 369 // child processes are counted up from 0, while browser created requests |
| 378 // start at -2 and go down from there. (We need to start at -2 because -1 is | 370 // start at -2 and go down from there. (We need to start at -2 because -1 is |
| 379 // used as a special value all over the resource_dispatcher_host for | 371 // used as a special value all over the resource_dispatcher_host for |
| 380 // uninitialized variables.) This way, we no longer have the unlikely (but | 372 // uninitialized variables.) This way, we no longer have the unlikely (but |
| 381 // observed in the real world!) event where we have two requests with the same | 373 // observed in the real world!) event where we have two requests with the same |
| 382 // request_id_. | 374 // request_id_. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // http://crbug.com/90971 - Assists in tracking down use-after-frees on | 412 // http://crbug.com/90971 - Assists in tracking down use-after-frees on |
| 421 // shutdown. | 413 // shutdown. |
| 422 std::set<const ResourceContext*> active_resource_contexts_; | 414 std::set<const ResourceContext*> active_resource_contexts_; |
| 423 | 415 |
| 424 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 416 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 425 }; | 417 }; |
| 426 | 418 |
| 427 } // namespace content | 419 } // namespace content |
| 428 | 420 |
| 429 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 421 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |