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