Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1424)

Side by Side Diff: content/browser/renderer_host/resource_loader_impl.h

Issue 11270027: Add a ResourceScheduler to ResourceDispatcherHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_LOADER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_LOADER_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_LOADER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_LOADER_IMPL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "content/browser/renderer_host/resource_handler.h" 10 #include "content/browser/renderer_host/resource_handler.h"
11 #include "content/browser/renderer_host/resource_loader.h"
11 #include "content/browser/ssl/ssl_error_handler.h" 12 #include "content/browser/ssl/ssl_error_handler.h"
12 #include "content/public/browser/resource_controller.h" 13 #include "content/public/browser/resource_controller.h"
13 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
14 15
15 namespace content { 16 namespace content {
16 class ResourceDispatcherHostLoginDelegate; 17 class ResourceDispatcherHostLoginDelegate;
17 class ResourceLoaderDelegate; 18 class ResourceLoaderImplDelegate;
18 class ResourceRequestInfoImpl; 19 class ResourceRequestInfoImpl;
19 class SSLClientAuthHandler; 20 class SSLClientAuthHandler;
20 21
21 // This class is responsible for driving the URLRequest (i.e., calling Start, 22 // This class is responsible for driving the URLRequest (i.e., calling Start,
22 // Read, and servicing events). It has a ResourceHandler, which is typically a 23 // Read, and servicing events). It has a ResourceHandler, which is typically a
23 // chain of ResourceHandlers, and is the ResourceController for its handler. 24 // chain of ResourceHandlers, and is the ResourceController for its handler.
24 class ResourceLoader : public net::URLRequest::Delegate, 25 class ResourceLoaderImpl : public ResourceLoader,
25 public SSLErrorHandler::Delegate, 26 public net::URLRequest::Delegate,
26 public ResourceController { 27 public SSLErrorHandler::Delegate,
28 public ResourceController {
27 public: 29 public:
28 ResourceLoader(scoped_ptr<net::URLRequest> request, 30 ResourceLoaderImpl(scoped_ptr<net::URLRequest> request,
29 scoped_ptr<ResourceHandler> handler, 31 scoped_ptr<ResourceHandler> handler,
30 ResourceLoaderDelegate* delegate); 32 ResourceLoaderImplDelegate* delegate);
31 virtual ~ResourceLoader(); 33 virtual ~ResourceLoaderImpl();
32 34
33 void StartRequest(); 35 // ResourceLoader implementation
36 virtual void StartRequest();
37 virtual net::URLRequest* request() { return request_.get(); }
38
34 void CancelRequest(bool from_renderer); 39 void CancelRequest(bool from_renderer);
35 40
36 void ReportUploadProgress(); 41 void ReportUploadProgress();
37 42
38 bool is_transferring() const { return is_transferring_; } 43 bool is_transferring() const { return is_transferring_; }
39 void MarkAsTransferring(); 44 void MarkAsTransferring();
40 void WillCompleteTransfer(); 45 void WillCompleteTransfer();
41 void CompleteTransfer(scoped_ptr<ResourceHandler> new_handler); 46 void CompleteTransfer(scoped_ptr<ResourceHandler> new_handler);
42 47
43 net::URLRequest* request() { return request_.get(); }
44 ResourceRequestInfoImpl* GetRequestInfo(); 48 ResourceRequestInfoImpl* GetRequestInfo();
45 49
46 void ClearLoginDelegate(); 50 void ClearLoginDelegate();
47 void ClearSSLClientAuthHandler(); 51 void ClearSSLClientAuthHandler();
48 52
49 // IPC message handlers: 53 // IPC message handlers:
50 void OnUploadProgressACK(); 54 void OnUploadProgressACK();
51 55
52 private: 56 private:
53 // net::URLRequest::Delegate implementation: 57 // net::URLRequest::Delegate implementation:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DEFERRED_NONE, 97 DEFERRED_NONE,
94 DEFERRED_START, 98 DEFERRED_START,
95 DEFERRED_REDIRECT, 99 DEFERRED_REDIRECT,
96 DEFERRED_READ, 100 DEFERRED_READ,
97 DEFERRED_FINISH 101 DEFERRED_FINISH
98 }; 102 };
99 DeferredStage deferred_stage_; 103 DeferredStage deferred_stage_;
100 104
101 scoped_ptr<net::URLRequest> request_; 105 scoped_ptr<net::URLRequest> request_;
102 scoped_ptr<ResourceHandler> handler_; 106 scoped_ptr<ResourceHandler> handler_;
103 ResourceLoaderDelegate* delegate_; 107 ResourceLoaderImplDelegate* delegate_;
104 108
105 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; 109 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_;
106 scoped_refptr<SSLClientAuthHandler> ssl_client_auth_handler_; 110 scoped_refptr<SSLClientAuthHandler> ssl_client_auth_handler_;
107 111
108 uint64 last_upload_position_; 112 uint64 last_upload_position_;
109 bool waiting_for_upload_progress_ack_; 113 bool waiting_for_upload_progress_ack_;
110 base::TimeTicks last_upload_ticks_; 114 base::TimeTicks last_upload_ticks_;
111 115
112 // Indicates that we are in a state of being transferred to a new downstream 116 // Indicates that we are in a state of being transferred to a new downstream
113 // consumer. We are waiting for a notification to complete the transfer, at 117 // consumer. We are waiting for a notification to complete the transfer, at
114 // which point we'll receive a new ResourceHandler. 118 // which point we'll receive a new ResourceHandler.
115 bool is_transferring_; 119 bool is_transferring_;
116 120
117 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; 121 base::WeakPtrFactory<ResourceLoaderImpl> weak_ptr_factory_;
118 122
119 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); 123 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderImpl);
120 }; 124 };
121 125
122 } // namespace content 126 } // namespace content
123 127
124 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_LOADER_H_ 128 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_LOADER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698