| 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 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_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 "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 public ResourceController { | 34 public ResourceController { |
| 35 public: | 35 public: |
| 36 ResourceLoader(scoped_ptr<net::URLRequest> request, | 36 ResourceLoader(scoped_ptr<net::URLRequest> request, |
| 37 scoped_ptr<ResourceHandler> handler, | 37 scoped_ptr<ResourceHandler> handler, |
| 38 ResourceLoaderDelegate* delegate); | 38 ResourceLoaderDelegate* delegate); |
| 39 ~ResourceLoader() override; | 39 ~ResourceLoader() override; |
| 40 | 40 |
| 41 void StartRequest(); | 41 void StartRequest(); |
| 42 void CancelRequest(bool from_renderer); | 42 void CancelRequest(bool from_renderer); |
| 43 | 43 |
| 44 void ReportUploadProgress(); | |
| 45 | |
| 46 bool is_transferring() const { return is_transferring_; } | 44 bool is_transferring() const { return is_transferring_; } |
| 47 void MarkAsTransferring(); | 45 void MarkAsTransferring(); |
| 48 void CompleteTransfer(); | 46 void CompleteTransfer(); |
| 49 | 47 |
| 50 net::URLRequest* request() { return request_.get(); } | 48 net::URLRequest* request() { return request_.get(); } |
| 51 ResourceRequestInfoImpl* GetRequestInfo(); | 49 ResourceRequestInfoImpl* GetRequestInfo(); |
| 52 | 50 |
| 53 void ClearLoginDelegate(); | 51 void ClearLoginDelegate(); |
| 54 | 52 |
| 55 // IPC message handlers: | |
| 56 void OnUploadProgressACK(); | |
| 57 | |
| 58 private: | 53 private: |
| 59 // net::URLRequest::Delegate implementation: | 54 // net::URLRequest::Delegate implementation: |
| 60 void OnReceivedRedirect(net::URLRequest* request, | 55 void OnReceivedRedirect(net::URLRequest* request, |
| 61 const net::RedirectInfo& redirect_info, | 56 const net::RedirectInfo& redirect_info, |
| 62 bool* defer) override; | 57 bool* defer) override; |
| 63 void OnAuthRequired(net::URLRequest* request, | 58 void OnAuthRequired(net::URLRequest* request, |
| 64 net::AuthChallengeInfo* info) override; | 59 net::AuthChallengeInfo* info) override; |
| 65 void OnCertificateRequested(net::URLRequest* request, | 60 void OnCertificateRequested(net::URLRequest* request, |
| 66 net::SSLCertRequestInfo* info) override; | 61 net::SSLCertRequestInfo* info) override; |
| 67 void OnSSLCertificateError(net::URLRequest* request, | 62 void OnSSLCertificateError(net::URLRequest* request, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 }; | 124 }; |
| 130 DeferredStage deferred_stage_; | 125 DeferredStage deferred_stage_; |
| 131 | 126 |
| 132 scoped_ptr<net::URLRequest> request_; | 127 scoped_ptr<net::URLRequest> request_; |
| 133 scoped_ptr<ResourceHandler> handler_; | 128 scoped_ptr<ResourceHandler> handler_; |
| 134 ResourceLoaderDelegate* delegate_; | 129 ResourceLoaderDelegate* delegate_; |
| 135 | 130 |
| 136 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; | 131 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; |
| 137 scoped_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; | 132 scoped_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; |
| 138 | 133 |
| 139 uint64 last_upload_position_; | |
| 140 bool waiting_for_upload_progress_ack_; | |
| 141 base::TimeTicks last_upload_ticks_; | |
| 142 base::TimeTicks read_deferral_start_time_; | 134 base::TimeTicks read_deferral_start_time_; |
| 143 | 135 |
| 144 // Indicates that we are in a state of being transferred to a new downstream | 136 // Indicates that we are in a state of being transferred to a new downstream |
| 145 // consumer. We are waiting for a notification to complete the transfer, at | 137 // consumer. We are waiting for a notification to complete the transfer, at |
| 146 // which point we'll receive a new ResourceHandler. | 138 // which point we'll receive a new ResourceHandler. |
| 147 bool is_transferring_; | 139 bool is_transferring_; |
| 148 | 140 |
| 149 // Instrumentation add to investigate http://crbug.com/503306. | 141 // Instrumentation add to investigate http://crbug.com/503306. |
| 150 // TODO(mmenke): Remove once bug is fixed. | 142 // TODO(mmenke): Remove once bug is fixed. |
| 151 int times_cancelled_before_request_start_; | 143 int times_cancelled_before_request_start_; |
| 152 bool started_request_; | 144 bool started_request_; |
| 153 int times_cancelled_after_request_start_; | 145 int times_cancelled_after_request_start_; |
| 154 | 146 |
| 155 base::RepeatingTimer<ResourceLoader> progress_timer_; | |
| 156 | |
| 157 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; | 147 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; |
| 158 | 148 |
| 159 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 149 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
| 160 }; | 150 }; |
| 161 | 151 |
| 162 } // namespace content | 152 } // namespace content |
| 163 | 153 |
| 164 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 154 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
| OLD | NEW |