| 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 20 matching lines...) Expand all Loading... |
| 31 #include "ipc/ipc_message.h" | 31 #include "ipc/ipc_message.h" |
| 32 #include "net/url_request/url_request.h" | 32 #include "net/url_request/url_request.h" |
| 33 #include "webkit/glue/resource_type.h" | 33 #include "webkit/glue/resource_type.h" |
| 34 | 34 |
| 35 class DownloadFileManager; | 35 class DownloadFileManager; |
| 36 class ResourceDispatcherHostRequestInfo; | 36 class ResourceDispatcherHostRequestInfo; |
| 37 class ResourceHandler; | 37 class ResourceHandler; |
| 38 class ResourceMessageFilter; | 38 class ResourceMessageFilter; |
| 39 class SaveFileManager; | 39 class SaveFileManager; |
| 40 class TabContents; | 40 class TabContents; |
| 41 class WebKitThread; | |
| 42 struct DownloadSaveInfo; | 41 struct DownloadSaveInfo; |
| 43 struct GlobalRequestID; | 42 struct GlobalRequestID; |
| 44 struct ResourceHostMsg_Request; | 43 struct ResourceHostMsg_Request; |
| 45 struct ViewMsg_SwapOut_Params; | 44 struct ViewMsg_SwapOut_Params; |
| 46 | 45 |
| 47 namespace content { | 46 namespace content { |
| 48 class ResourceContext; | 47 class ResourceContext; |
| 49 class ResourceDispatcherHostDelegate; | 48 class ResourceDispatcherHostDelegate; |
| 50 } | 49 } |
| 51 namespace net { | 50 namespace net { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 SaveFileManager* save_file_manager() const { | 149 SaveFileManager* save_file_manager() const { |
| 151 return save_file_manager_; | 150 return save_file_manager_; |
| 152 } | 151 } |
| 153 | 152 |
| 154 WebKitThread* webkit_thread() const { | |
| 155 return webkit_thread_.get(); | |
| 156 } | |
| 157 | |
| 158 // Called when the unload handler for a cross-site request has finished. | 153 // Called when the unload handler for a cross-site request has finished. |
| 159 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); | 154 void OnSwapOutACK(const ViewMsg_SwapOut_Params& params); |
| 160 | 155 |
| 161 // Called when the renderer loads a resource from its internal cache. | 156 // Called when the renderer loads a resource from its internal cache. |
| 162 void OnDidLoadResourceFromMemoryCache(const GURL& url, | 157 void OnDidLoadResourceFromMemoryCache(const GURL& url, |
| 163 const std::string& security_info, | 158 const std::string& security_info, |
| 164 const std::string& http_method, | 159 const std::string& http_method, |
| 165 ResourceType::Type resource_type); | 160 ResourceType::Type resource_type); |
| 166 | 161 |
| 167 // Force cancels any pending requests for the given process. | 162 // Force cancels any pending requests for the given process. |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 445 |
| 451 // Handles the resource requests from the moment we want to start them. | 446 // Handles the resource requests from the moment we want to start them. |
| 452 ResourceQueue resource_queue_; | 447 ResourceQueue resource_queue_; |
| 453 | 448 |
| 454 // We own the download file writing thread and manager | 449 // We own the download file writing thread and manager |
| 455 scoped_refptr<DownloadFileManager> download_file_manager_; | 450 scoped_refptr<DownloadFileManager> download_file_manager_; |
| 456 | 451 |
| 457 // We own the save file manager. | 452 // We own the save file manager. |
| 458 scoped_refptr<SaveFileManager> save_file_manager_; | 453 scoped_refptr<SaveFileManager> save_file_manager_; |
| 459 | 454 |
| 460 // We own the WebKit thread and see to its destruction. | |
| 461 scoped_ptr<WebKitThread> webkit_thread_; | |
| 462 | |
| 463 // Request ID for browser initiated requests. request_ids generated by | 455 // Request ID for browser initiated requests. request_ids generated by |
| 464 // child processes are counted up from 0, while browser created requests | 456 // child processes are counted up from 0, while browser created requests |
| 465 // start at -2 and go down from there. (We need to start at -2 because -1 is | 457 // start at -2 and go down from there. (We need to start at -2 because -1 is |
| 466 // used as a special value all over the resource_dispatcher_host for | 458 // used as a special value all over the resource_dispatcher_host for |
| 467 // uninitialized variables.) This way, we no longer have the unlikely (but | 459 // uninitialized variables.) This way, we no longer have the unlikely (but |
| 468 // observed in the real world!) event where we have two requests with the same | 460 // observed in the real world!) event where we have two requests with the same |
| 469 // request_id_. | 461 // request_id_. |
| 470 int request_id_; | 462 int request_id_; |
| 471 | 463 |
| 472 // For running tasks. | 464 // For running tasks. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 497 |
| 506 content::ResourceDispatcherHostDelegate* delegate_; | 498 content::ResourceDispatcherHostDelegate* delegate_; |
| 507 | 499 |
| 508 static bool is_prefetch_enabled_; | 500 static bool is_prefetch_enabled_; |
| 509 bool allow_cross_origin_auth_prompt_; | 501 bool allow_cross_origin_auth_prompt_; |
| 510 | 502 |
| 511 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); | 503 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost); |
| 512 }; | 504 }; |
| 513 | 505 |
| 514 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ | 506 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_H_ |
| OLD | NEW |