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

Side by Side Diff: chrome/browser/policy/device_management_service.cc

Issue 11572044: Automatically retry the following URLFetchers when the network changes: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Document the retry behavior 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 | « chrome/browser/policy/app_pack_updater.cc ('k') | google_apis/gaia/gaia_oauth_client.cc » ('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 #include "chrome/browser/policy/device_management_service.h" 5 #include "chrome/browser/policy/device_management_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 505
506 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job, 506 void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job,
507 bool bypass_proxy) { 507 bool bypass_proxy) {
508 net::URLFetcher* fetcher = net::URLFetcher::Create( 508 net::URLFetcher* fetcher = net::URLFetcher::Create(
509 0, job->GetURL(server_url_), net::URLFetcher::POST, this); 509 0, job->GetURL(server_url_), net::URLFetcher::POST, this);
510 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 510 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
511 net::LOAD_DO_NOT_SAVE_COOKIES | 511 net::LOAD_DO_NOT_SAVE_COOKIES |
512 net::LOAD_DISABLE_CACHE | 512 net::LOAD_DISABLE_CACHE |
513 (bypass_proxy ? net::LOAD_BYPASS_PROXY : 0)); 513 (bypass_proxy ? net::LOAD_BYPASS_PROXY : 0));
514 fetcher->SetRequestContext(request_context_getter_.get()); 514 fetcher->SetRequestContext(request_context_getter_.get());
515 // Early device policy fetches on ChromeOS and Auto-Enrollment checks are
516 // often interrupted during ChromeOS startup when network change notifications
517 // are sent. Allowing the fetcher to retry once after that is enough to
518 // recover; allow it to retry up to 3 times just in case.
519 // http://crosbug.com/16114
520 fetcher->SetAutomaticallyRetryOnNetworkChanges(3);
515 job->ConfigureRequest(fetcher); 521 job->ConfigureRequest(fetcher);
516 pending_jobs_[fetcher] = job; 522 pending_jobs_[fetcher] = job;
517 fetcher->Start(); 523 fetcher->Start();
518 } 524 }
519 525
520 void DeviceManagementService::OnURLFetchComplete( 526 void DeviceManagementService::OnURLFetchComplete(
521 const net::URLFetcher* source) { 527 const net::URLFetcher* source) {
522 JobFetcherMap::iterator entry(pending_jobs_.find(source)); 528 JobFetcherMap::iterator entry(pending_jobs_.find(source));
523 if (entry == pending_jobs_.end()) { 529 if (entry == pending_jobs_.end()) {
524 NOTREACHED() << "Callback from foreign URL fetcher"; 530 NOTREACHED() << "Callback from foreign URL fetcher";
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 } 586 }
581 } 587 }
582 588
583 const JobQueue::iterator elem = 589 const JobQueue::iterator elem =
584 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); 590 std::find(queued_jobs_.begin(), queued_jobs_.end(), job);
585 if (elem != queued_jobs_.end()) 591 if (elem != queued_jobs_.end())
586 queued_jobs_.erase(elem); 592 queued_jobs_.erase(elem);
587 } 593 }
588 594
589 } // namespace policy 595 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/app_pack_updater.cc ('k') | google_apis/gaia/gaia_oauth_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698