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

Unified Diff: net/url_request/url_fetcher_core.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: 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_fetcher_core.h
diff --git a/net/url_request/url_fetcher_core.h b/net/url_request/url_fetcher_core.h
index 4b258e5384c380e611447da09d29d79838b678d1..04d844925368c18e334d335b84eb647bde67c106 100644
--- a/net/url_request/url_fetcher_core.h
+++ b/net/url_request/url_fetcher_core.h
@@ -20,6 +20,7 @@
#include "base/timer.h"
#include "googleurl/src/gurl.h"
#include "net/base/host_port_pair.h"
+#include "net/base/network_change_notifier.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request.h"
@@ -38,7 +39,8 @@ class URLRequestThrottlerEntryInterface;
class URLFetcherCore
: public base::RefCountedThreadSafe<URLFetcherCore>,
- public URLRequest::Delegate {
+ public URLRequest::Delegate,
+ public NetworkChangeNotifier::ConnectionTypeObserver {
public:
URLFetcherCore(URLFetcher* fetcher,
const GURL& original_url,
@@ -89,6 +91,7 @@ class URLFetcherCore
void SetMaxRetries(int max_retries);
int GetMaxRetries() const;
base::TimeDelta GetBackoffDelay() const;
+ void SetAutomaticallyRetryOnNetworkChanges(int max_retries);
void SaveResponseToFileAtPath(
const FilePath& file_path,
scoped_refptr<base::TaskRunner> file_task_runner);
@@ -122,6 +125,10 @@ class URLFetcherCore
virtual void OnReadCompleted(URLRequest* request,
int bytes_read) OVERRIDE;
+ // Overridden from NetworkChangeNotifier::ConnectionTypeObserver:
+ virtual void OnConnectionTypeChanged(
+ NetworkChangeNotifier::ConnectionType type) OVERRIDE;
+
URLFetcherDelegate* delegate() const { return delegate_; }
static void CancelAll();
static int GetNumFetcherCores();
@@ -389,6 +396,10 @@ class URLFetcherCore
// Back-off time delay. 0 by default.
base::TimeDelta backoff_delay_;
+ // Number of times to retry when the request fails with ERR_NETWORK_CHANGED.
+ // Defaults to 0.
pauljensen 2012/12/07 23:00:05 nit: Maybe change to "0 by default." to match two
Joao da Silva 2012/12/10 15:32:42 Done.
+ int max_retries_on_network_changes_;
+
// Timer to poll the progress of uploading for POST and PUT requests.
// When crbug.com/119629 is fixed, scoped_ptr is not necessary here.
scoped_ptr<base::RepeatingTimer<URLFetcherCore> >

Powered by Google App Engine
This is Rietveld 408576698