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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 class LoaderDelegate; | 63 class LoaderDelegate; |
64 class NavigationURLLoaderImplCore; | 64 class NavigationURLLoaderImplCore; |
65 class RenderFrameHostImpl; | 65 class RenderFrameHostImpl; |
66 class ResourceContext; | 66 class ResourceContext; |
67 class ResourceDispatcherHostDelegate; | 67 class ResourceDispatcherHostDelegate; |
68 class ResourceMessageDelegate; | 68 class ResourceMessageDelegate; |
69 class ResourceMessageFilter; | 69 class ResourceMessageFilter; |
70 class ResourceRequestInfoImpl; | 70 class ResourceRequestInfoImpl; |
71 class SaveFileManager; | 71 class SaveFileManager; |
72 class ServiceWorkerNavigationHandleCore; | 72 class ServiceWorkerNavigationHandleCore; |
73 class WebContentsImpl; | |
74 struct CommonNavigationParams; | 73 struct CommonNavigationParams; |
75 struct DownloadSaveInfo; | 74 struct DownloadSaveInfo; |
76 struct NavigationRequestInfo; | 75 struct NavigationRequestInfo; |
77 struct Referrer; | 76 struct Referrer; |
78 struct ResourceRequest; | 77 struct ResourceRequest; |
79 | 78 |
80 // This class is responsible for notifying the IO thread (specifically, the | 79 // This class is responsible for notifying the IO thread (specifically, the |
81 // ResourceDispatcherHostImpl) of frame events. It has an interace for callers | 80 // ResourceDispatcherHostImpl) of frame events. It has an interace for callers |
82 // to use and also sends notifications on WebContentsObserver events. All | 81 // to use and also sends notifications on WebContentsObserver events. All |
83 // methods (static or class) will be called from the UI thread and post to the | 82 // methods (static or class) will be called from the UI thread and post to the |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 void OnRenderViewHostDeleted(int child_id, int route_id); | 209 void OnRenderViewHostDeleted(int child_id, int route_id); |
211 | 210 |
212 // Called when a RenderViewHost starts or stops loading. | 211 // Called when a RenderViewHost starts or stops loading. |
213 void OnRenderViewHostSetIsLoading(int child_id, | 212 void OnRenderViewHostSetIsLoading(int child_id, |
214 int route_id, | 213 int route_id, |
215 bool is_loading); | 214 bool is_loading); |
216 | 215 |
217 // Force cancels any pending requests for the given process. | 216 // Force cancels any pending requests for the given process. |
218 void CancelRequestsForProcess(int child_id); | 217 void CancelRequestsForProcess(int child_id); |
219 | 218 |
220 void OnUserGesture(WebContentsImpl* contents); | 219 void OnUserGesture(); |
221 | 220 |
222 // Retrieves a net::URLRequest. Must be called from the IO thread. | 221 // Retrieves a net::URLRequest. Must be called from the IO thread. |
223 net::URLRequest* GetURLRequest(const GlobalRequestID& request_id); | 222 net::URLRequest* GetURLRequest(const GlobalRequestID& request_id); |
224 | 223 |
225 void RemovePendingRequest(int child_id, int request_id); | 224 void RemovePendingRequest(int child_id, int request_id); |
226 | 225 |
227 // Causes all new requests for the route identified by |routing_id| to be | 226 // Causes all new requests for the route identified by |routing_id| to be |
228 // blocked (not being started) until ResumeBlockedRequestsForRoute is called. | 227 // blocked (not being started) until ResumeBlockedRequestsForRoute is called. |
229 void BlockRequestsForRoute(const GlobalFrameRoutingId& global_routing_id); | 228 void BlockRequestsForRoute(const GlobalFrameRoutingId& global_routing_id); |
230 | 229 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 void BeginNavigationRequest( | 299 void BeginNavigationRequest( |
301 ResourceContext* resource_context, | 300 ResourceContext* resource_context, |
302 const NavigationRequestInfo& info, | 301 const NavigationRequestInfo& info, |
303 NavigationURLLoaderImplCore* loader, | 302 NavigationURLLoaderImplCore* loader, |
304 ServiceWorkerNavigationHandleCore* service_worker_handle_core); | 303 ServiceWorkerNavigationHandleCore* service_worker_handle_core); |
305 | 304 |
306 // Turns on stale-while-revalidate support, regardless of command-line flags | 305 // Turns on stale-while-revalidate support, regardless of command-line flags |
307 // or experiment status. For unit tests only. | 306 // or experiment status. For unit tests only. |
308 void EnableStaleWhileRevalidateForTesting(); | 307 void EnableStaleWhileRevalidateForTesting(); |
309 | 308 |
| 309 // Sets the LoaderDelegate, which must outlive this object. Ownership is not |
| 310 // transferred. The LoaderDelegate should be interacted with on the IO thread. |
310 void SetLoaderDelegate(LoaderDelegate* loader_delegate); | 311 void SetLoaderDelegate(LoaderDelegate* loader_delegate); |
311 | 312 |
312 private: | 313 private: |
313 friend class LoaderIOThreadNotifier; | 314 friend class LoaderIOThreadNotifier; |
314 friend class ResourceDispatcherHostTest; | 315 friend class ResourceDispatcherHostTest; |
315 | 316 |
316 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 317 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
317 TestBlockedRequestsProcessDies); | 318 TestBlockedRequestsProcessDies); |
318 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, | 319 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
319 CalculateApproximateMemoryCost); | 320 CalculateApproximateMemoryCost); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 // Allows tests to use a mock CertStore. If set, the CertStore must | 650 // Allows tests to use a mock CertStore. If set, the CertStore must |
650 // outlive this ResourceDispatcherHostImpl. | 651 // outlive this ResourceDispatcherHostImpl. |
651 CertStore* cert_store_for_testing_; | 652 CertStore* cert_store_for_testing_; |
652 | 653 |
653 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 654 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
654 }; | 655 }; |
655 | 656 |
656 } // namespace content | 657 } // namespace content |
657 | 658 |
658 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 659 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
OLD | NEW |