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

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

Issue 5276007: Implement exponential back-off mechanism. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pull latest to merge 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
diff --git a/chrome/service/cloud_print/cloud_print_proxy_backend.cc b/chrome/service/cloud_print/cloud_print_proxy_backend.cc
index 7dac83e44740df9f0856338821b6ce55a3f6a60b..dbb374f14f10a31e8ad832b8490d7439ccaadb7d 100644
--- a/chrome/service/cloud_print/cloud_print_proxy_backend.cc
+++ b/chrome/service/cloud_print/cloud_print_proxy_backend.cc
@@ -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 @@ class CloudPrintProxyBackend::Core
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 @@ void CloudPrintProxyBackend::Core::DoInitializeWithToken(
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 @@ void CloudPrintProxyBackend::Core::GetRegisteredPrinters() {
&CloudPrintProxyBackend::Core::HandlePrinterListResponse;
request_ = new CloudPrintURLFetcher;
request_->StartGetRequest(printer_list_url, this, auth_token_,
- kCloudPrintAPIRetryPolicy);
+ kCloudPrintAPIMaxRetryCount);
}
void CloudPrintProxyBackend::Core::RegisterNextPrinter() {
@@ -511,7 +481,7 @@ void CloudPrintProxyBackend::Core::RegisterNextPrinter() {
&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