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

Side by Side Diff: components/google/core/browser/google_url_tracker.cc

Issue 544833002: Apply the network changed retry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 6 years, 3 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/google/core/browser/google_url_tracker.h" 5 #include "components/google/core/browser/google_url_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 already_fetched_ = true; 239 already_fetched_ = true;
240 fetcher_.reset(net::URLFetcher::Create( 240 fetcher_.reset(net::URLFetcher::Create(
241 fetcher_id_, GURL(kSearchDomainCheckURL), net::URLFetcher::GET, this)); 241 fetcher_id_, GURL(kSearchDomainCheckURL), net::URLFetcher::GET, this));
242 ++fetcher_id_; 242 ++fetcher_id_;
243 // We don't want this fetch to set new entries in the cache or cookies, lest 243 // We don't want this fetch to set new entries in the cache or cookies, lest
244 // we alarm the user. 244 // we alarm the user.
245 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | 245 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE |
246 net::LOAD_DO_NOT_SAVE_COOKIES); 246 net::LOAD_DO_NOT_SAVE_COOKIES);
247 fetcher_->SetRequestContext(client_->GetRequestContext()); 247 fetcher_->SetRequestContext(client_->GetRequestContext());
248 248
249 // Configure to max_retries at most kMaxRetries times for 5xx errors. 249 // Configure to retry at most kMaxRetries times for 5xx errors.
250 static const int kMaxRetries = 5; 250 static const int kMaxRetries = 5;
251 fetcher_->SetMaxRetriesOn5xx(kMaxRetries); 251 fetcher_->SetMaxRetriesOn5xx(kMaxRetries);
252 252
253 // Also retry kMaxRetries times on network change errors. A network change can
254 // propagate through Chrome in various stages, so it's possible for this code
255 // to be reached via OnNetworkChanged(), and then have the fetch we kick off
256 // be canceled due to e.g. the DNS server changing at a later time. In general
257 // it's not possible to ensure that by the time we reach here any requests we
258 // start won't be canceled in this fashion, so retrying is the best we can do.
259 fetcher_->SetAutomaticallyRetryOnNetworkChanges(kMaxRetries);
260
253 fetcher_->Start(); 261 fetcher_->Start();
254 } 262 }
255 263
256 void GoogleURLTracker::OnNavigationPending( 264 void GoogleURLTracker::OnNavigationPending(
257 scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper, 265 scoped_ptr<GoogleURLTrackerNavigationHelper> nav_helper,
258 infobars::InfoBarManager* infobar_manager, 266 infobars::InfoBarManager* infobar_manager,
259 int pending_id) { 267 int pending_id) {
260 GoogleURLTrackerMapEntry* map_entry = NULL; 268 GoogleURLTrackerMapEntry* map_entry = NULL;
261 269
262 EntryMap::iterator i(entry_map_.find(infobar_manager)); 270 EntryMap::iterator i(entry_map_.find(infobar_manager));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 406 }
399 if (client_->IsListeningForNavigationStart()) { 407 if (client_->IsListeningForNavigationStart()) {
400 DCHECK(!search_committed_); 408 DCHECK(!search_committed_);
401 client_->SetListeningForNavigationStart(false); 409 client_->SetListeningForNavigationStart(false);
402 } 410 }
403 } 411 }
404 412
405 void GoogleURLTracker::NotifyGoogleURLUpdated() { 413 void GoogleURLTracker::NotifyGoogleURLUpdated() {
406 callback_list_.Notify(); 414 callback_list_.Notify();
407 } 415 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698