| 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 |
| 11 | 11 |
| 12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| 13 #define CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 13 #define CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| 14 | 14 |
| 15 #include <map> | 15 #include <map> |
| 16 #include <set> | 16 #include <set> |
| 17 #include <string> | 17 #include <string> |
| 18 #include <vector> | 18 #include <vector> |
| 19 | 19 |
| 20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
| 21 #include "base/gtest_prod_util.h" | 21 #include "base/gtest_prod_util.h" |
| 22 #include "base/memory/linked_ptr.h" | 22 #include "base/memory/linked_ptr.h" |
| 23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
| 24 #include "base/observer_list.h" | 24 #include "base/observer_list.h" |
| 25 #include "base/time.h" | 25 #include "base/time.h" |
| 26 #include "base/timer.h" | 26 #include "base/timer.h" |
| 27 #include "content/browser/download/download_resource_handler.h" | 27 #include "content/browser/download/download_resource_handler.h" |
| 28 #include "content/browser/loader/resource_loader.h" | 28 #include "content/browser/loader/resource_loader.h" |
| 29 #include "content/browser/loader/resource_loader_delegate.h" | 29 #include "content/browser/loader/resource_loader_delegate.h" |
| 30 #include "content/browser/loader/resource_scheduler.h" |
| 30 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
| 31 #include "content/public/browser/child_process_data.h" | 32 #include "content/public/browser/child_process_data.h" |
| 32 #include "content/public/browser/download_id.h" | 33 #include "content/public/browser/download_id.h" |
| 33 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
| 34 #include "content/public/browser/resource_dispatcher_host.h" | 35 #include "content/public/browser/resource_dispatcher_host.h" |
| 35 #include "ipc/ipc_message.h" | 36 #include "ipc/ipc_message.h" |
| 36 #include "net/cookies/canonical_cookie.h" | 37 #include "net/cookies/canonical_cookie.h" |
| 37 #include "net/url_request/url_request.h" | 38 #include "net/url_request/url_request.h" |
| 38 #include "webkit/glue/resource_type.h" | 39 #include "webkit/glue/resource_type.h" |
| 39 | 40 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( | 211 scoped_ptr<ResourceHandler> CreateResourceHandlerForDownload( |
| 211 net::URLRequest* request, | 212 net::URLRequest* request, |
| 212 bool is_content_initiated, | 213 bool is_content_initiated, |
| 213 bool must_download, | 214 bool must_download, |
| 214 DownloadId id, | 215 DownloadId id, |
| 215 scoped_ptr<DownloadSaveInfo> save_info, | 216 scoped_ptr<DownloadSaveInfo> save_info, |
| 216 const DownloadResourceHandler::OnStartedCallback& started_cb); | 217 const DownloadResourceHandler::OnStartedCallback& started_cb); |
| 217 | 218 |
| 218 void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); | 219 void ClearSSLClientAuthHandlerForRequest(net::URLRequest* request); |
| 219 | 220 |
| 221 ResourceScheduler* scheduler() { return &scheduler_; } |
| 222 |
| 220 private: | 223 private: |
| 221 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 224 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 222 TestBlockedRequestsProcessDies); | 225 TestBlockedRequestsProcessDies); |
| 223 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 226 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 224 IncrementOutstandingRequestsMemoryCost); | 227 IncrementOutstandingRequestsMemoryCost); |
| 225 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 228 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 226 CalculateApproximateMemoryCost); | 229 CalculateApproximateMemoryCost); |
| 227 | 230 |
| 228 class ShutdownTask; | 231 class ShutdownTask; |
| 229 | 232 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 bool allow_cross_origin_auth_prompt_; | 425 bool allow_cross_origin_auth_prompt_; |
| 423 | 426 |
| 424 // http://crbug.com/90971 - Assists in tracking down use-after-frees on | 427 // http://crbug.com/90971 - Assists in tracking down use-after-frees on |
| 425 // shutdown. | 428 // shutdown. |
| 426 std::set<const ResourceContext*> active_resource_contexts_; | 429 std::set<const ResourceContext*> active_resource_contexts_; |
| 427 | 430 |
| 428 typedef std::map<GlobalRequestID, | 431 typedef std::map<GlobalRequestID, |
| 429 ObserverList<ResourceMessageDelegate>*> DelegateMap; | 432 ObserverList<ResourceMessageDelegate>*> DelegateMap; |
| 430 DelegateMap delegate_map_; | 433 DelegateMap delegate_map_; |
| 431 | 434 |
| 435 ResourceScheduler scheduler_; |
| 436 |
| 432 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 437 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 433 }; | 438 }; |
| 434 | 439 |
| 435 } // namespace content | 440 } // namespace content |
| 436 | 441 |
| 437 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 442 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |