| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 public ResourceLoaderDelegate { | 71 public ResourceLoaderDelegate { |
| 72 public: | 72 public: |
| 73 ResourceDispatcherHostImpl(); | 73 ResourceDispatcherHostImpl(); |
| 74 virtual ~ResourceDispatcherHostImpl(); | 74 virtual ~ResourceDispatcherHostImpl(); |
| 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 virtual void SetDelegate(ResourceDispatcherHostDelegate* delegate) override; |
| 82 virtual void SetAllowCrossOriginAuthPrompt(bool value) OVERRIDE; | 82 virtual void SetAllowCrossOriginAuthPrompt(bool value) override; |
| 83 virtual DownloadInterruptReason BeginDownload( | 83 virtual 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 virtual void ClearLoginDelegateForRequest(net::URLRequest* request) override; |
| 95 virtual void BlockRequestsForRoute(int child_id, int route_id) OVERRIDE; | 95 virtual void BlockRequestsForRoute(int child_id, int route_id) override; |
| 96 virtual void ResumeBlockedRequestsForRoute( | 96 virtual void ResumeBlockedRequestsForRoute( |
| 97 int child_id, int route_id) OVERRIDE; | 97 int child_id, int route_id) override; |
| 98 | 98 |
| 99 // Puts the resource dispatcher host in an inactive state (unable to begin | 99 // Puts the resource dispatcher host in an inactive state (unable to begin |
| 100 // new requests). Cancels all pending requests. | 100 // new requests). Cancels all pending requests. |
| 101 void Shutdown(); | 101 void Shutdown(); |
| 102 | 102 |
| 103 // Notify the ResourceDispatcherHostImpl of a new resource context. | 103 // Notify the ResourceDispatcherHostImpl of a new resource context. |
| 104 void AddResourceContext(ResourceContext* context); | 104 void AddResourceContext(ResourceContext* context); |
| 105 | 105 |
| 106 // Notify the ResourceDispatcherHostImpl of a resource context destruction. | 106 // Notify the ResourceDispatcherHostImpl of a resource context destruction. |
| 107 void RemoveResourceContext(ResourceContext* context); | 107 void RemoveResourceContext(ResourceContext* context); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 int memory_cost; | 284 int memory_cost; |
| 285 int num_requests; | 285 int num_requests; |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 friend class ShutdownTask; | 288 friend class ShutdownTask; |
| 289 friend class ResourceMessageDelegate; | 289 friend class ResourceMessageDelegate; |
| 290 | 290 |
| 291 // ResourceLoaderDelegate implementation: | 291 // ResourceLoaderDelegate implementation: |
| 292 virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( | 292 virtual ResourceDispatcherHostLoginDelegate* CreateLoginDelegate( |
| 293 ResourceLoader* loader, | 293 ResourceLoader* loader, |
| 294 net::AuthChallengeInfo* auth_info) OVERRIDE; | 294 net::AuthChallengeInfo* auth_info) override; |
| 295 virtual bool HandleExternalProtocol(ResourceLoader* loader, | 295 virtual bool HandleExternalProtocol(ResourceLoader* loader, |
| 296 const GURL& url) OVERRIDE; | 296 const GURL& url) override; |
| 297 virtual void DidStartRequest(ResourceLoader* loader) OVERRIDE; | 297 virtual void DidStartRequest(ResourceLoader* loader) override; |
| 298 virtual void DidReceiveRedirect(ResourceLoader* loader, | 298 virtual void DidReceiveRedirect(ResourceLoader* loader, |
| 299 const GURL& new_url) OVERRIDE; | 299 const GURL& new_url) override; |
| 300 virtual void DidReceiveResponse(ResourceLoader* loader) OVERRIDE; | 300 virtual void DidReceiveResponse(ResourceLoader* loader) override; |
| 301 virtual void DidFinishLoading(ResourceLoader* loader) OVERRIDE; | 301 virtual void DidFinishLoading(ResourceLoader* loader) override; |
| 302 | 302 |
| 303 // An init helper that runs on the IO thread. | 303 // An init helper that runs on the IO thread. |
| 304 void OnInit(); | 304 void OnInit(); |
| 305 | 305 |
| 306 // A shutdown helper that runs on the IO thread. | 306 // A shutdown helper that runs on the IO thread. |
| 307 void OnShutdown(); | 307 void OnShutdown(); |
| 308 | 308 |
| 309 // Helper function for regular and download requests. | 309 // Helper function for regular and download requests. |
| 310 void BeginRequestInternal(scoped_ptr<net::URLRequest> request, | 310 void BeginRequestInternal(scoped_ptr<net::URLRequest> request, |
| 311 scoped_ptr<ResourceHandler> handler); | 311 scoped_ptr<ResourceHandler> handler); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 DelegateMap delegate_map_; | 538 DelegateMap delegate_map_; |
| 539 | 539 |
| 540 scoped_ptr<ResourceScheduler> scheduler_; | 540 scoped_ptr<ResourceScheduler> scheduler_; |
| 541 | 541 |
| 542 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); | 542 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl); |
| 543 }; | 543 }; |
| 544 | 544 |
| 545 } // namespace content | 545 } // namespace content |
| 546 | 546 |
| 547 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ | 547 #endif // CONTENT_BROWSER_LOADER_RESOURCE_DISPATCHER_HOST_IMPL_H_ |
| OLD | NEW |