| 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 NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void ProcessPublicKeyPinsHeader(); | 58 void ProcessPublicKeyPinsHeader(); |
| 59 | 59 |
| 60 // |result| should be net::OK, or the request is canceled. | 60 // |result| should be net::OK, or the request is canceled. |
| 61 void OnHeadersReceivedCallback(int result); | 61 void OnHeadersReceivedCallback(int result); |
| 62 void OnStartCompleted(int result); | 62 void OnStartCompleted(int result); |
| 63 void OnReadCompleted(int result); | 63 void OnReadCompleted(int result); |
| 64 void NotifyBeforeSendHeadersCallback(int result); | 64 void NotifyBeforeSendHeadersCallback(int result); |
| 65 | 65 |
| 66 void RestartTransactionWithAuth(const AuthCredentials& credentials); | 66 void RestartTransactionWithAuth(const AuthCredentials& credentials); |
| 67 | 67 |
| 68 void RetryRequestOnError(int result); | |
| 69 | |
| 70 // Returns true if this request should be retried after receiving the given | |
| 71 // error as a result of a call to Start. | |
| 72 bool ShouldRetryRequest(int result) const; | |
| 73 | |
| 74 // Overridden from URLRequestJob: | 68 // Overridden from URLRequestJob: |
| 75 virtual void SetUpload(UploadData* upload) OVERRIDE; | 69 virtual void SetUpload(UploadData* upload) OVERRIDE; |
| 76 virtual void SetExtraRequestHeaders( | 70 virtual void SetExtraRequestHeaders( |
| 77 const HttpRequestHeaders& headers) OVERRIDE; | 71 const HttpRequestHeaders& headers) OVERRIDE; |
| 78 virtual void Start() OVERRIDE; | 72 virtual void Start() OVERRIDE; |
| 79 virtual void Kill() OVERRIDE; | 73 virtual void Kill() OVERRIDE; |
| 80 virtual LoadState GetLoadState() const OVERRIDE; | 74 virtual LoadState GetLoadState() const OVERRIDE; |
| 81 virtual UploadProgress GetUploadProgress() const OVERRIDE; | 75 virtual UploadProgress GetUploadProgress() const OVERRIDE; |
| 82 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; | 76 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE; |
| 83 virtual bool GetCharset(std::string* charset) OVERRIDE; | 77 virtual bool GetCharset(std::string* charset) OVERRIDE; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 typedef base::RefCountedData<bool> SharedBoolean; | 143 typedef base::RefCountedData<bool> SharedBoolean; |
| 150 | 144 |
| 151 class HttpFilterContext; | 145 class HttpFilterContext; |
| 152 class HttpTransactionDelegateImpl; | 146 class HttpTransactionDelegateImpl; |
| 153 | 147 |
| 154 virtual ~URLRequestHttpJob(); | 148 virtual ~URLRequestHttpJob(); |
| 155 | 149 |
| 156 void RecordTimer(); | 150 void RecordTimer(); |
| 157 void ResetTimer(); | 151 void ResetTimer(); |
| 158 | 152 |
| 159 void RecordRetryResult(int result) const; | |
| 160 | |
| 161 virtual void UpdatePacketReadTimes() OVERRIDE; | 153 virtual void UpdatePacketReadTimes() OVERRIDE; |
| 162 void RecordPacketStats(FilterContext::StatisticSelector statistic) const; | 154 void RecordPacketStats(FilterContext::StatisticSelector statistic) const; |
| 163 | 155 |
| 164 void RecordCompressionHistograms(); | 156 void RecordCompressionHistograms(); |
| 165 bool IsCompressibleContent() const; | 157 bool IsCompressibleContent() const; |
| 166 | 158 |
| 167 // Starts the transaction if extensions using the webrequest API do not | 159 // Starts the transaction if extensions using the webrequest API do not |
| 168 // object. | 160 // object. |
| 169 void StartTransaction(); | 161 void StartTransaction(); |
| 170 void StartTransactionInternal(); | 162 void StartTransactionInternal(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 234 |
| 243 // Flag used to verify that |this| is not deleted while we are awaiting | 235 // Flag used to verify that |this| is not deleted while we are awaiting |
| 244 // a callback from the NetworkDelegate. Used as a fail-fast mechanism. | 236 // a callback from the NetworkDelegate. Used as a fail-fast mechanism. |
| 245 // True if we are waiting a callback and | 237 // True if we are waiting a callback and |
| 246 // NetworkDelegate::NotifyURLRequestDestroyed has not been called, yet, | 238 // NetworkDelegate::NotifyURLRequestDestroyed has not been called, yet, |
| 247 // to inform the NetworkDelegate that it may not call back. | 239 // to inform the NetworkDelegate that it may not call back. |
| 248 bool awaiting_callback_; | 240 bool awaiting_callback_; |
| 249 | 241 |
| 250 scoped_ptr<HttpTransactionDelegateImpl> http_transaction_delegate_; | 242 scoped_ptr<HttpTransactionDelegateImpl> http_transaction_delegate_; |
| 251 | 243 |
| 252 // True if the request job has automatically retried the request as a result | |
| 253 // of an error. | |
| 254 bool has_retried_; | |
| 255 | |
| 256 // The network error code error that |this| was automatically retried as a | |
| 257 // result of, if any. If this request has not been retried, must be 0. | |
| 258 // Reset once it's been used to log histograms. | |
| 259 int error_before_retry_; | |
| 260 | |
| 261 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); | 244 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); |
| 262 }; | 245 }; |
| 263 | 246 |
| 264 } // namespace net | 247 } // namespace net |
| 265 | 248 |
| 266 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ | 249 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ |
| OLD | NEW |