| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 struct CommonNavigationParams; | 64 struct CommonNavigationParams; |
| 65 struct DownloadSaveInfo; | 65 struct DownloadSaveInfo; |
| 66 struct NavigationRequestInfo; | 66 struct NavigationRequestInfo; |
| 67 struct Referrer; | 67 struct Referrer; |
| 68 | 68 |
| 69 class CONTENT_EXPORT ResourceDispatcherHostImpl | 69 class CONTENT_EXPORT ResourceDispatcherHostImpl |
| 70 : public ResourceDispatcherHost, | 70 : public ResourceDispatcherHost, |
| 71 public ResourceLoaderDelegate { | 71 public ResourceLoaderDelegate { |
| 72 public: | 72 public: |
| 73 ResourceDispatcherHostImpl(); | 73 ResourceDispatcherHostImpl(); |
| 74 virtual ~ResourceDispatcherHostImpl(); | 74 ~ResourceDispatcherHostImpl() override; |
| 75 | 75 |
| 76 // Returns the current ResourceDispatcherHostImpl. May return NULL if it | 76 // Returns the current ResourceDispatcherHostImpl. May return NULL if it |
| 77 // hasn't been created yet. | 77 // hasn't been created yet. |
| 78 static ResourceDispatcherHostImpl* Get(); | 78 static ResourceDispatcherHostImpl* Get(); |
| 79 | 79 |
| 80 // ResourceDispatcherHost implementation: | 80 // ResourceDispatcherHost implementation: |
| 81 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; | 81 void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; |
| 82 virtual void SetAllowCrossOriginAuthPrompt(bool value) override; | 82 void SetAllowCrossOriginAuthPrompt(bool value) override; |
| 83 virtual DownloadInterruptReason BeginDownload( | 83 DownloadInterruptReason BeginDownload( |
| 84 scoped_ptr<net::URLRequest> request, | 84 scoped_ptr<net::URLRequest> request, |
| 85 const Referrer& referrer, | 85 const Referrer& referrer, |
| 86 bool is_content_initiated, | 86 bool is_content_initiated, |
| 87 ResourceContext* context, | 87 ResourceContext* context, |
| 88 int child_id, | 88 int child_id, |
| 89 int route_id, | 89 int route_id, |
| 90 bool prefer_cache, | 90 bool prefer_cache, |
| 91 scoped_ptr<DownloadSaveInfo> save_info, | 91 scoped_ptr<DownloadSaveInfo> save_info, |
| 92 uint32 download_id, | 92 uint32 download_id, |
| 93 const DownloadStartedCallback& started_callback) override; | 93 const DownloadStartedCallback& started_callback) override; |
| 94 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) override; | 94 void ClearLoginDelegateForRequest(net::URLRequest* request) override; |
| 95 virtual void BlockRequestsForRoute(int child_id, int route_id) override; | 95 void BlockRequestsForRoute(int child_id, int route_id) override; |
| 96 virtual void ResumeBlockedRequestsForRoute( | 96 void ResumeBlockedRequestsForRoute(int child_id, int route_id) override; |
| 97 int child_id, int route_id) override; | |
| 98 | 97 |
| 99 // Puts the resource dispatcher host in an inactive state (unable to begin | 98 // Puts the resource dispatcher host in an inactive state (unable to begin |
| 100 // new requests). Cancels all pending requests. | 99 // new requests). Cancels all pending requests. |
| 101 void Shutdown(); | 100 void Shutdown(); |
| 102 | 101 |
| 103 // Notify the ResourceDispatcherHostImpl of a new resource context. | 102 // Notify the ResourceDispatcherHostImpl of a new resource context. |
| 104 void AddResourceContext(ResourceContext* context); | 103 void AddResourceContext(ResourceContext* context); |
| 105 | 104 |
| 106 // Notify the ResourceDispatcherHostImpl of a resource context destruction. | 105 // Notify the ResourceDispatcherHostImpl of a resource context destruction. |
| 107 void RemoveResourceContext(ResourceContext* context); | 106 void RemoveResourceContext(ResourceContext* context); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 287 |
| 289 struct OustandingRequestsStats { | 288 struct OustandingRequestsStats { |
| 290 int memory_cost; | 289 int memory_cost; |
| 291 int num_requests; | 290 int num_requests; |
| 292 }; | 291 }; |
| 293 | 292 |
| 294 friend class ShutdownTask; | 293 friend class ShutdownTask; |
| 295 friend class ResourceMessageDelegate; | 294 friend class ResourceMessageDelegate; |
| 296 | 295 |
| 297 // ResourceLoaderDelegate implementation: | 296 // ResourceLoaderDelegate implementation: |
| 298 virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( | 297 ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( |
| 299 ResourceLoader* loader, | 298 ResourceLoader* loader, |
| 300 net::AuthChallengeInfo* auth_info) override; | 299 net::AuthChallengeInfo* auth_info) override; |
| 301 virtual bool HandleExternalProtocol(ResourceLoader* loader, | 300 bool HandleExternalProtocol(ResourceLoader* loader, const GURL& url) override; |
| 302 const GURL& url) override; | 301 void DidStartRequest(ResourceLoader* loader) override; |
| 303 virtual void DidStartRequest(ResourceLoader* loader) override; | 302 void DidReceiveRedirect(ResourceLoader* loader, const GURL& new_url) override; |
| 304 virtual void DidReceiveRedirect(ResourceLoader* loader, | 303 void DidReceiveResponse(ResourceLoader* loader) override; |
| 305 const GURL& new_url) override; | 304 void DidFinishLoading(ResourceLoader* loader) override; |
| 306 virtual void DidReceiveResponse(ResourceLoader* loader) override; | |
| 307 virtual void DidFinishLoading(ResourceLoader* loader) override; | |
| 308 | 305 |
| 309 // An init helper that runs on the IO thread. | 306 // An init helper that runs on the IO thread. |
| 310 void OnInit(); | 307 void OnInit(); |
| 311 | 308 |
| 312 // A shutdown helper that runs on the IO thread. | 309 // A shutdown helper that runs on the IO thread. |
| 313 void OnShutdown(); | 310 void OnShutdown(); |
| 314 | 311 |
| 315 // Helper function for regular and download requests. | 312 // Helper function for regular and download requests. |
| 316 void BeginRequestInternal(scoped_ptr<net::URLRequest> request, | 313 void BeginRequestInternal(scoped_ptr<net::URLRequest> request, |
| 317 scoped_ptr<ResourceHandler> handler); | 314 scoped_ptr<ResourceHandler> handler); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 DelegateMap delegate_map_; | 541 DelegateMap delegate_map_; |
| 545 | 542 |
| 546 scoped_ptr<ResourceScheduler> scheduler_; | 543 scoped_ptr<ResourceScheduler> scheduler_; |
| 547 | 544 |
| 548 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 545 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 549 }; | 546 }; |
| 550 | 547 |
| 551 } // namespace content | 548 } // namespace content |
| 552 | 549 |
| 553 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 550 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |