| 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.h" | 28 #include "content/browser/renderer_host/resource_loader.h" |
| 29 #include "content/browser/renderer_host/resource_loader_delegate.h" | 29 #include "content/browser/renderer_host/resource_loader_delegate.h" |
| 30 #include "content/common/content_export.h" | 30 #include "content/common/content_export.h" |
| 31 #include "content/public/browser/child_process_data.h" | 31 #include "content/public/browser/child_process_data.h" |
| 32 #include "content/public/browser/notification_types.h" | 32 #include "content/public/browser/notification_types.h" |
| 33 #include "content/public/browser/resource_dispatcher_host.h" | 33 #include "content/public/browser/resource_dispatcher_host.h" |
| 34 #include "ipc/ipc_message.h" | 34 #include "ipc/ipc_message.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 CookieList; | 45 class CookieList; |
| 47 class URLRequestJobFactory; | 46 class URLRequestJobFactory; |
| 48 } | 47 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 138 |
| 140 // Intended for unit-tests only. Overrides the outstanding requests bound. | 139 // Intended for unit-tests only. Overrides the outstanding requests bound. |
| 141 void set_max_outstanding_requests_cost_per_process(int limit) { | 140 void set_max_outstanding_requests_cost_per_process(int limit) { |
| 142 max_outstanding_requests_cost_per_process_ = limit; | 141 max_outstanding_requests_cost_per_process_ = limit; |
| 143 } | 142 } |
| 144 | 143 |
| 145 // The average private bytes increase of the browser for each new pending | 144 // The average private bytes increase of the browser for each new pending |
| 146 // request. Experimentally obtained. | 145 // request. Experimentally obtained. |
| 147 static const int kAvgBytesPerOutstandingRequest = 4400; | 146 static const int kAvgBytesPerOutstandingRequest = 4400; |
| 148 | 147 |
| 149 DownloadFileManager* download_file_manager() const { | |
| 150 return download_file_manager_; | |
| 151 } | |
| 152 | |
| 153 SaveFileManager* save_file_manager() const { | 148 SaveFileManager* save_file_manager() const { |
| 154 return save_file_manager_; | 149 return save_file_manager_; |
| 155 } | 150 } |
| 156 | 151 |
| 157 // Called when the unload handler for a cross-site request has finished. | 152 // Called when the unload handler for a cross-site request has finished. |
| 158 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); | 153 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); |
| 159 | 154 |
| 160 // Called when the renderer loads a resource from its internal cache. | 155 // Called when the renderer loads a resource from its internal cache. |
| 161 void OnDidLoadResourceFromMemoryCache(const GURL& url, | 156 void OnDidLoadResourceFromMemoryCache(const GURL& url, |
| 162 const std::string& security_info, | 157 const std::string& security_info, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 DeletableFilesMap; // key is request id | 346 DeletableFilesMap; // key is request id |
| 352 typedef std::map<int, DeletableFilesMap> | 347 typedef std::map<int, DeletableFilesMap> |
| 353 RegisteredTempFiles; // key is child process id | 348 RegisteredTempFiles; // key is child process id |
| 354 RegisteredTempFiles registered_temp_files_; | 349 RegisteredTempFiles registered_temp_files_; |
| 355 | 350 |
| 356 // A timer that periodically calls UpdateLoadStates while pending_requests_ | 351 // A timer that periodically calls UpdateLoadStates while pending_requests_ |
| 357 // is not empty. | 352 // is not empty. |
| 358 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> > | 353 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> > |
| 359 update_load_states_timer_; | 354 update_load_states_timer_; |
| 360 | 355 |
| 361 // We own the download file writing thread and manager | |
| 362 scoped_refptr<DownloadFileManager> download_file_manager_; | |
| 363 | |
| 364 // We own the save file manager. | 356 // We own the save file manager. |
| 365 scoped_refptr<SaveFileManager> save_file_manager_; | 357 scoped_refptr<SaveFileManager> save_file_manager_; |
| 366 | 358 |
| 367 // Request ID for browser initiated requests. request_ids generated by | 359 // Request ID for browser initiated requests. request_ids generated by |
| 368 // child processes are counted up from 0, while browser created requests | 360 // child processes are counted up from 0, while browser created requests |
| 369 // start at -2 and go down from there. (We need to start at -2 because -1 is | 361 // start at -2 and go down from there. (We need to start at -2 because -1 is |
| 370 // used as a special value all over the resource_dispatcher_host for | 362 // used as a special value all over the resource_dispatcher_host for |
| 371 // uninitialized variables.) This way, we no longer have the unlikely (but | 363 // uninitialized variables.) This way, we no longer have the unlikely (but |
| 372 // observed in the real world!) event where we have two requests with the same | 364 // observed in the real world!) event where we have two requests with the same |
| 373 // request_id_. | 365 // request_id_. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // http://crbug.com/90971 - Assists in tracking down use-after-frees on | 403 // http://crbug.com/90971 - Assists in tracking down use-after-frees on |
| 412 // shutdown. | 404 // shutdown. |
| 413 std::set<const ResourceContext*> active_resource_contexts_; | 405 std::set<const ResourceContext*> active_resource_contexts_; |
| 414 | 406 |
| 415 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 407 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 416 }; | 408 }; |
| 417 | 409 |
| 418 } // namespace content | 410 } // namespace content |
| 419 | 411 |
| 420 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 412 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |