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

Unified Diff: chrome/service/cloud_print/cloud_print_proxy_backend.cc

Issue 4194001: Implement exponential back-off mechanism and enforce it at the URLRequestHttpJob level. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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: chrome/service/cloud_print/cloud_print_proxy_backend.cc
===================================================================
--- chrome/service/cloud_print/cloud_print_proxy_backend.cc (revision 67336)
+++ chrome/service/cloud_print/cloud_print_proxy_backend.cc (working copy)
@@ -15,7 +15,6 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/common/net/url_fetcher_protect.h"
#include "chrome/service/cloud_print/cloud_print_consts.h"
#include "chrome/service/cloud_print/cloud_print_helpers.h"
#include "chrome/service/cloud_print/cloud_print_url_fetcher.h"
@@ -119,8 +118,6 @@
const std::string& email);
void NotifyAuthenticationFailed();
- URLFetcherProtectEntry* CreateDefaultRetryPolicy();
-
// Starts a new printer registration process.
void StartRegistration();
// Ends the printer registration process.
@@ -357,36 +354,9 @@
proxy_id_ = proxy_id;
- // Register the request retry policies for cloud print APIs and job data
- // requests.
- URLFetcherProtectManager::GetInstance()->Register(
- kCloudPrintAPIRetryPolicy, CreateDefaultRetryPolicy());
- URLFetcherProtectManager::GetInstance()->Register(
- kJobDataRetryPolicy, CreateDefaultRetryPolicy())->SetMaxRetries(
- kJobDataMaxRetryCount);
-
StartRegistration();
}
-URLFetcherProtectEntry*
-CloudPrintProxyBackend::Core::CreateDefaultRetryPolicy() {
- // Times are in milliseconds.
- const int kSlidingWindowPeriod = 2000;
- const int kMaxSendThreshold = 20;
- const int kMaxRetries = -1;
- const int kInitialTimeout = 100;
- const double kMultiplier = 2.0;
- const int kConstantFactor = 100;
- const int kMaximumTimeout = 5*60*1000;
- return new URLFetcherProtectEntry(kSlidingWindowPeriod,
- kMaxSendThreshold,
- kMaxRetries,
- kInitialTimeout,
- kMultiplier,
- kConstantFactor,
- kMaximumTimeout);
-}
-
void CloudPrintProxyBackend::Core::StartRegistration() {
DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop());
printer_list_.clear();
@@ -444,7 +414,7 @@
&CloudPrintProxyBackend::Core::HandlePrinterListResponse;
request_ = new CloudPrintURLFetcher;
request_->StartGetRequest(printer_list_url, this, auth_token_,
- kCloudPrintAPIRetryPolicy);
+ kCloudPrintAPIMaxRetryCount);
}
void CloudPrintProxyBackend::Core::RegisterNextPrinter() {
@@ -511,7 +481,7 @@
&CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse;
request_ = new CloudPrintURLFetcher;
request_->StartPostRequest(register_url, this, auth_token_,
- kCloudPrintAPIRetryPolicy, mime_type,
+ kCloudPrintAPIMaxRetryCount, mime_type,
post_data);
} else {
« no previous file with comments | « chrome/service/cloud_print/cloud_print_consts.cc ('k') | chrome/service/cloud_print/cloud_print_url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698