| 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 <stdint.h> | 15 #include <stdint.h> |
| 16 | 16 |
| 17 #include <map> | 17 #include <map> |
| 18 #include <memory> | 18 #include <memory> |
| 19 #include <string> | 19 #include <string> |
| 20 #include <vector> | 20 #include <vector> |
| 21 | 21 |
| 22 #include "base/callback_forward.h" | 22 #include "base/callback_forward.h" |
| 23 #include "base/gtest_prod_util.h" | 23 #include "base/gtest_prod_util.h" |
| 24 #include "base/macros.h" | 24 #include "base/macros.h" |
| 25 #include "base/memory/ref_counted.h" | 25 #include "base/memory/ref_counted.h" |
| 26 #include "base/observer_list.h" | 26 #include "base/observer_list.h" |
| 27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "content/browser/loader/global_routing_id.h" | 28 #include "content/browser/loader/global_routing_id.h" |
| 29 #include "content/browser/loader/loader_globals.h" |
| 29 #include "content/browser/loader/resource_loader_delegate.h" | 30 #include "content/browser/loader/resource_loader_delegate.h" |
| 30 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
| 31 #include "content/common/url_loader.mojom.h" | 32 #include "content/common/url_loader.mojom.h" |
| 32 #include "content/public/browser/global_request_id.h" | 33 #include "content/public/browser/global_request_id.h" |
| 33 #include "content/public/browser/resource_dispatcher_host.h" | 34 #include "content/public/browser/resource_dispatcher_host.h" |
| 34 #include "content/public/browser/resource_request_info.h" | 35 #include "content/public/browser/resource_request_info.h" |
| 35 #include "content/public/common/previews_state.h" | 36 #include "content/public/common/previews_state.h" |
| 36 #include "content/public/common/request_context_type.h" | 37 #include "content/public/common/request_context_type.h" |
| 37 #include "content/public/common/resource_type.h" | 38 #include "content/public/common/resource_type.h" |
| 38 #include "ipc/ipc_message.h" | 39 #include "ipc/ipc_message.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Used to handle the result of SyncLoad IPC. |result| is null if it's | 85 // Used to handle the result of SyncLoad IPC. |result| is null if it's |
| 85 // unavailable due to an error. | 86 // unavailable due to an error. |
| 86 using SyncLoadResultCallback = | 87 using SyncLoadResultCallback = |
| 87 base::Callback<void(const SyncLoadResult* result)>; | 88 base::Callback<void(const SyncLoadResult* result)>; |
| 88 | 89 |
| 89 // This constructor should be used if we want downloads to work correctly. | 90 // This constructor should be used if we want downloads to work correctly. |
| 90 // TODO(ananta) | 91 // TODO(ananta) |
| 91 // Work on moving creation of download handlers out of | 92 // Work on moving creation of download handlers out of |
| 92 // ResourceDispatcherHostImpl. | 93 // ResourceDispatcherHostImpl. |
| 93 ResourceDispatcherHostImpl( | 94 ResourceDispatcherHostImpl( |
| 94 CreateDownloadHandlerIntercept download_handler_intercept); | 95 CreateDownloadHandlerIntercept download_handler_intercept, |
| 96 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_runner, |
| 97 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner); |
| 95 ResourceDispatcherHostImpl(); | 98 ResourceDispatcherHostImpl(); |
| 96 ~ResourceDispatcherHostImpl() override; | 99 ~ResourceDispatcherHostImpl() override; |
| 97 | 100 |
| 98 // Returns the current ResourceDispatcherHostImpl. May return NULL if it | 101 // Returns the current ResourceDispatcherHostImpl. May return NULL if it |
| 99 // hasn't been created yet. | 102 // hasn't been created yet. |
| 100 static ResourceDispatcherHostImpl* Get(); | 103 static ResourceDispatcherHostImpl* Get(); |
| 101 | 104 |
| 102 // ResourceDispatcherHost implementation: | 105 // ResourceDispatcherHost implementation: |
| 103 void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; | 106 void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; |
| 104 void SetAllowCrossOriginAuthPrompt(bool value) override; | 107 void SetAllowCrossOriginAuthPrompt(bool value) override; |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 DelegateMap delegate_map_; | 753 DelegateMap delegate_map_; |
| 751 | 754 |
| 752 std::unique_ptr<ResourceScheduler> scheduler_; | 755 std::unique_ptr<ResourceScheduler> scheduler_; |
| 753 | 756 |
| 754 // Used to invoke an interceptor for the HTTP header. | 757 // Used to invoke an interceptor for the HTTP header. |
| 755 HeaderInterceptorMap http_header_interceptor_map_; | 758 HeaderInterceptorMap http_header_interceptor_map_; |
| 756 | 759 |
| 757 // Points to the registered download handler intercept. | 760 // Points to the registered download handler intercept. |
| 758 CreateDownloadHandlerIntercept create_download_handler_intercept_; | 761 CreateDownloadHandlerIntercept create_download_handler_intercept_; |
| 759 | 762 |
| 763 // Points to the global instance of the LoaderGlobals class. |
| 764 std::unique_ptr<LoaderGlobals> loader_globals_; |
| 765 |
| 760 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 766 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 761 }; | 767 }; |
| 762 | 768 |
| 763 } // namespace content | 769 } // namespace content |
| 764 | 770 |
| 765 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 771 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |