summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authorbcwhite <bcwhite@chromium.org>2015-04-17 16:53:08 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-17 23:54:10 +0000
commiteb20e70ac87ab034d184456ed396d962ef65e9f8 (patch)
treef2cc56385cdf95742098fdeec345076db04a4099 /google_apis
parent45e9781773ede997a17bdbf1f95ce6512356c9e0 (diff)
downloadchromium_src-eb20e70ac87ab034d184456ed396d962ef65e9f8.zip
chromium_src-eb20e70ac87ab034d184456ed396d962ef65e9f8.tar.gz
chromium_src-eb20e70ac87ab034d184456ed396d962ef65e9f8.tar.bz2
Added backoff to successive token requests after transient errors.
BUG=475064 Review URL: https://codereview.chromium.org/1077183002 Cr-Commit-Position: refs/heads/master@{#325738}
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/BUILD.gn4
-rw-r--r--google_apis/gaia/oauth2_access_token_fetcher_immediate_error.cc (renamed from google_apis/gaia/oauth2_access_token_fetcher_permanent_error.cc)32
-rw-r--r--google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h (renamed from google_apis/gaia/oauth2_access_token_fetcher_permanent_error.h)22
-rw-r--r--google_apis/google_apis.gyp4
4 files changed, 31 insertions, 31 deletions
diff --git a/google_apis/BUILD.gn b/google_apis/BUILD.gn
index e6e22ab..a595bd8 100644
--- a/google_apis/BUILD.gn
+++ b/google_apis/BUILD.gn
@@ -104,8 +104,8 @@ source_set("google_apis") {
"gaia/oauth2_access_token_fetcher.h",
"gaia/oauth2_access_token_fetcher_impl.cc",
"gaia/oauth2_access_token_fetcher_impl.h",
- "gaia/oauth2_access_token_fetcher_permanent_error.cc",
- "gaia/oauth2_access_token_fetcher_permanent_error.h",
+ "gaia/oauth2_access_token_fetcher_immediate_error.cc",
+ "gaia/oauth2_access_token_fetcher_immediate_error.h",
"gaia/oauth2_api_call_flow.cc",
"gaia/oauth2_api_call_flow.h",
"gaia/oauth2_mint_token_flow.cc",
diff --git a/google_apis/gaia/oauth2_access_token_fetcher_permanent_error.cc b/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.cc
index 0f24e3d..d4bb79d 100644
--- a/google_apis/gaia/oauth2_access_token_fetcher_permanent_error.cc
+++ b/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.cc
@@ -2,71 +2,71 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "google_apis/gaia/oauth2_access_token_fetcher_permanent_error.h"
+#include "google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "google_apis/gaia/google_service_auth_error.h"
-OAuth2AccessTokenFetcherPermanentError::FailCaller::FailCaller(
- OAuth2AccessTokenFetcherPermanentError* fetcher)
+OAuth2AccessTokenFetcherImmediateError::FailCaller::FailCaller(
+ OAuth2AccessTokenFetcherImmediateError* fetcher)
: fetcher_(fetcher) {
base::MessageLoop* looper = base::MessageLoop::current();
DCHECK(looper);
looper->PostTask(
FROM_HERE,
- base::Bind(&OAuth2AccessTokenFetcherPermanentError::FailCaller::run,
+ base::Bind(&OAuth2AccessTokenFetcherImmediateError::FailCaller::run,
this));
}
-OAuth2AccessTokenFetcherPermanentError::FailCaller::~FailCaller() {
+OAuth2AccessTokenFetcherImmediateError::FailCaller::~FailCaller() {
}
-void OAuth2AccessTokenFetcherPermanentError::FailCaller::run() {
+void OAuth2AccessTokenFetcherImmediateError::FailCaller::run() {
if (fetcher_) {
fetcher_->Fail();
fetcher_ = NULL;
}
}
-void OAuth2AccessTokenFetcherPermanentError::FailCaller::detach() {
+void OAuth2AccessTokenFetcherImmediateError::FailCaller::detach() {
fetcher_ = NULL;
}
-OAuth2AccessTokenFetcherPermanentError::OAuth2AccessTokenFetcherPermanentError(
+OAuth2AccessTokenFetcherImmediateError::OAuth2AccessTokenFetcherImmediateError(
OAuth2AccessTokenConsumer* consumer,
const GoogleServiceAuthError& error)
: OAuth2AccessTokenFetcher(consumer),
- permanent_error_(error) {
- DCHECK(!permanent_error_.IsTransientError());
+ immediate_error_(error) {
+ DCHECK(immediate_error_ != GoogleServiceAuthError::AuthErrorNone());
}
-OAuth2AccessTokenFetcherPermanentError::
- ~OAuth2AccessTokenFetcherPermanentError() {
+OAuth2AccessTokenFetcherImmediateError::
+ ~OAuth2AccessTokenFetcherImmediateError() {
CancelRequest();
}
-void OAuth2AccessTokenFetcherPermanentError::CancelRequest() {
+void OAuth2AccessTokenFetcherImmediateError::CancelRequest() {
if (failer_) {
failer_->detach();
failer_ = NULL;
}
}
-void OAuth2AccessTokenFetcherPermanentError::Start(
+void OAuth2AccessTokenFetcherImmediateError::Start(
const std::string& client_id,
const std::string& client_secret,
const std::vector<std::string>& scopes) {
failer_ = new FailCaller(this);
}
-void OAuth2AccessTokenFetcherPermanentError::Fail() {
+void OAuth2AccessTokenFetcherImmediateError::Fail() {
// The call below will likely destruct this object. We have to make a copy
// of the error into a local variable because the class member thus will
// be destroyed after which the copy-passed-by-reference will cause a
// memory violation when accessed.
- GoogleServiceAuthError error_copy = permanent_error_;
+ GoogleServiceAuthError error_copy = immediate_error_;
FireOnGetTokenFailure(error_copy);
}
diff --git a/google_apis/gaia/oauth2_access_token_fetcher_permanent_error.h b/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h
index e7053ce..0408deb 100644
--- a/google_apis/gaia/oauth2_access_token_fetcher_permanent_error.h
+++ b/google_apis/gaia/oauth2_access_token_fetcher_immediate_error.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_PERMANENT_ERROR_H_
-#define GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_PERMANENT_ERROR_H_
+#ifndef GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMMEDIATE_ERROR_H_
+#define GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMMEDIATE_ERROR_H_
#include "base/memory/ref_counted.h"
#include "google_apis/gaia/google_service_auth_error.h"
@@ -12,7 +12,7 @@
// This is an implementation of the OAuth2 fetcher that immediately returns
// an error. This is useful as a replacement to a real fetcher when a
-// permanent error has previously been seen.
+// immediate error has previously been seen.
//
// This class should be used on a single thread, but it can be whichever thread
// that you like.
@@ -27,11 +27,11 @@
//
// This class can handle one request at a time. To parallelize requests,
// create multiple instances.
-class OAuth2AccessTokenFetcherPermanentError : public OAuth2AccessTokenFetcher {
+class OAuth2AccessTokenFetcherImmediateError : public OAuth2AccessTokenFetcher {
public:
- OAuth2AccessTokenFetcherPermanentError(OAuth2AccessTokenConsumer* consumer,
+ OAuth2AccessTokenFetcherImmediateError(OAuth2AccessTokenConsumer* consumer,
const GoogleServiceAuthError& error);
- ~OAuth2AccessTokenFetcherPermanentError() override;
+ ~OAuth2AccessTokenFetcherImmediateError() override;
void Start(const std::string& client_id,
const std::string& client_secret,
@@ -42,7 +42,7 @@ class OAuth2AccessTokenFetcherPermanentError : public OAuth2AccessTokenFetcher {
private:
class FailCaller : public base::RefCounted<FailCaller> {
public:
- FailCaller(OAuth2AccessTokenFetcherPermanentError* fetcher);
+ FailCaller(OAuth2AccessTokenFetcherImmediateError* fetcher);
void run();
void detach();
@@ -51,14 +51,14 @@ class OAuth2AccessTokenFetcherPermanentError : public OAuth2AccessTokenFetcher {
friend class base::RefCounted<FailCaller>;
~FailCaller();
- OAuth2AccessTokenFetcherPermanentError* fetcher_;
+ OAuth2AccessTokenFetcherImmediateError* fetcher_;
};
void Fail();
scoped_refptr<FailCaller> failer_;
- GoogleServiceAuthError permanent_error_;
- DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcherPermanentError);
+ GoogleServiceAuthError immediate_error_;
+ DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcherImmediateError);
};
-#endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_PERMANENT_ERROR_H_
+#endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_IMMEDIATE_ERROR_H_
diff --git a/google_apis/google_apis.gyp b/google_apis/google_apis.gyp
index 0969651..c3263d0 100644
--- a/google_apis/google_apis.gyp
+++ b/google_apis/google_apis.gyp
@@ -95,8 +95,8 @@
'gaia/oauth2_access_token_fetcher.h',
'gaia/oauth2_access_token_fetcher_impl.cc',
'gaia/oauth2_access_token_fetcher_impl.h',
- 'gaia/oauth2_access_token_fetcher_permanent_error.cc',
- 'gaia/oauth2_access_token_fetcher_permanent_error.h',
+ 'gaia/oauth2_access_token_fetcher_immediate_error.cc',
+ 'gaia/oauth2_access_token_fetcher_immediate_error.h',
'gaia/oauth2_api_call_flow.cc',
'gaia/oauth2_api_call_flow.h',
'gaia/oauth2_mint_token_flow.cc',