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

Side by Side Diff: net/url_request/url_fetcher.h

Issue 11464028: Introduce ERR_NETWORK_CHANGED and allow URLFetcher to automatically retry on that error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed nits Created 8 years 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
« no previous file with comments | « net/url_request/test_url_fetcher_factory.cc ('k') | net/url_request/url_fetcher_core.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 NET_URL_REQUEST_URL_FETCHER_H_ 5 #ifndef NET_URL_REQUEST_URL_FETCHER_H_
6 #define NET_URL_REQUEST_URL_FETCHER_H_ 6 #define NET_URL_REQUEST_URL_FETCHER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // will be called, with the URLFetcher's URL set to the redirect destination, 179 // will be called, with the URLFetcher's URL set to the redirect destination,
180 // its status set to CANCELED, and its response code set to the relevant 3xx 180 // its status set to CANCELED, and its response code set to the relevant 3xx
181 // server response code. 181 // server response code.
182 virtual void SetStopOnRedirect(bool stop_on_redirect) = 0; 182 virtual void SetStopOnRedirect(bool stop_on_redirect) = 0;
183 183
184 // If |retry| is false, 5xx responses will be propagated to the observer, 184 // If |retry| is false, 5xx responses will be propagated to the observer,
185 // if it is true URLFetcher will automatically re-execute the request, 185 // if it is true URLFetcher will automatically re-execute the request,
186 // after backoff_delay() elapses. URLFetcher has it set to true by default. 186 // after backoff_delay() elapses. URLFetcher has it set to true by default.
187 virtual void SetAutomaticallyRetryOn5xx(bool retry) = 0; 187 virtual void SetAutomaticallyRetryOn5xx(bool retry) = 0;
188 188
189 virtual void SetMaxRetries(int max_retries) = 0; 189 virtual void SetMaxRetriesOn5xx(int max_retries) = 0;
190 virtual int GetMaxRetries() const = 0; 190 virtual int GetMaxRetriesOn5xx() const = 0;
191 191
192 // Returns the back-off delay before the request will be retried, 192 // Returns the back-off delay before the request will be retried,
193 // when a 5xx response was received. 193 // when a 5xx response was received.
194 virtual base::TimeDelta GetBackoffDelay() const = 0; 194 virtual base::TimeDelta GetBackoffDelay() const = 0;
195 195
196 // Retries up to |max_retries| times when requests fail with
197 // ERR_NETWORK_CHANGED. If ERR_NETWORK_CHANGED is received after having
198 // retried |max_retries| times then it is propagated to the observer.
199 // Each retry can be delayed if the network if currently offline, and will be
200 // attempted once the network connection is back. The first fetch is also
201 // delayed if the network is offline when Start() is invoked.
202 virtual void SetAutomaticallyRetryOnNetworkChanges(int max_retries) = 0;
203
196 // By default, the response is saved in a string. Call this method to save the 204 // By default, the response is saved in a string. Call this method to save the
197 // response to a file instead. Must be called before Start(). 205 // response to a file instead. Must be called before Start().
198 // |file_task_runner| will be used for all file operations. 206 // |file_task_runner| will be used for all file operations.
199 // To save to a temporary file, use SaveResponseToTemporaryFile(). 207 // To save to a temporary file, use SaveResponseToTemporaryFile().
200 // The created file is removed when the URLFetcher is deleted unless you 208 // The created file is removed when the URLFetcher is deleted unless you
201 // take ownership by calling GetResponseAsFilePath(). 209 // take ownership by calling GetResponseAsFilePath().
202 virtual void SaveResponseToFileAtPath( 210 virtual void SaveResponseToFileAtPath(
203 const FilePath& file_path, 211 const FilePath& file_path,
204 scoped_refptr<base::TaskRunner> file_task_runner) = 0; 212 scoped_refptr<base::TaskRunner> file_task_runner) = 0;
205 213
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // true, caller takes responsibility for the file, and it will not 271 // true, caller takes responsibility for the file, and it will not
264 // be removed once the URLFetcher is destroyed. User should not take 272 // be removed once the URLFetcher is destroyed. User should not take
265 // ownership more than once, or call this method after taking ownership. 273 // ownership more than once, or call this method after taking ownership.
266 virtual bool GetResponseAsFilePath(bool take_ownership, 274 virtual bool GetResponseAsFilePath(bool take_ownership,
267 FilePath* out_response_path) const = 0; 275 FilePath* out_response_path) const = 0;
268 }; 276 };
269 277
270 } // namespace net 278 } // namespace net
271 279
272 #endif // NET_URL_REQUEST_URL_FETCHER_H_ 280 #endif // NET_URL_REQUEST_URL_FETCHER_H_
OLDNEW
« no previous file with comments | « net/url_request/test_url_fetcher_factory.cc ('k') | net/url_request/url_fetcher_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698