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 the renderer loads a resource from its internal cache. | 153 // Called when the renderer loads a resource from its internal cache. |
159 void OnDidLoadResourceFromMemoryCache(const GURL& url, | 154 void OnDidLoadResourceFromMemoryCache(const GURL& url, |
160 const std::string& security_info, | 155 const std::string& security_info, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 DeletableFilesMap; // key is request id | 344 DeletableFilesMap; // key is request id |
350 typedef std::map<int, DeletableFilesMap> | 345 typedef std::map<int, DeletableFilesMap> |
351 RegisteredTempFiles; // key is child process id | 346 RegisteredTempFiles; // key is child process id |
352 RegisteredTempFiles registered_temp_files_; | 347 RegisteredTempFiles registered_temp_files_; |
353 | 348 |
354 // A timer that periodically calls UpdateLoadStates while pending_requests_ | 349 // A timer that periodically calls UpdateLoadStates while pending_requests_ |
355 // is not empty. | 350 // is not empty. |
356 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> > | 351 scoped_ptr<base::RepeatingTimer<ResourceDispatcherHostImpl> > |
357 update_load_states_timer_; | 352 update_load_states_timer_; |
358 | 353 |
359 // We own the download file writing thread and manager | |
360 scoped_refptr<DownloadFileManager> download_file_manager_; | |
361 | |
362 // We own the save file manager. | 354 // We own the save file manager. |
363 scoped_refptr<SaveFileManager> save_file_manager_; | 355 scoped_refptr<SaveFileManager> save_file_manager_; |
364 | 356 |
365 // Request ID for browser initiated requests. request_ids generated by | 357 // Request ID for browser initiated requests. request_ids generated by |
366 // child processes are counted up from 0, while browser created requests | 358 // child processes are counted up from 0, while browser created requests |
367 // start at -2 and go down from there. (We need to start at -2 because -1 is | 359 // start at -2 and go down from there. (We need to start at -2 because -1 is |
368 // used as a special value all over the resource_dispatcher_host for | 360 // used as a special value all over the resource_dispatcher_host for |
369 // uninitialized variables.) This way, we no longer have the unlikely (but | 361 // uninitialized variables.) This way, we no longer have the unlikely (but |
370 // observed in the real world!) event where we have two requests with the same | 362 // observed in the real world!) event where we have two requests with the same |
371 // request_id_. | 363 // request_id_. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // http://crbug.com/90971 - Assists in tracking down use-after-frees on | 401 // http://crbug.com/90971 - Assists in tracking down use-after-frees on |
410 // shutdown. | 402 // shutdown. |
411 std::set<const ResourceContext*> active_resource_contexts_; | 403 std::set<const ResourceContext*> active_resource_contexts_; |
412 | 404 |
413 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 405 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
414 }; | 406 }; |
415 | 407 |
416 } // namespace content | 408 } // namespace content |
417 | 409 |
418 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 410 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |