diff options
author | piman <piman@chromium.org> | 2015-05-05 16:21:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-05 23:22:35 +0000 |
commit | 80c2c73da358d9797c8a6ac7cf159710e9a5c94b (patch) | |
tree | e1fbf1fb08dd2ea4eaaae4c94e61a3238048315a /components/signin | |
parent | 37bf7edbf1bd467b6162033b7eb164a76b057d20 (diff) | |
download | chromium_src-80c2c73da358d9797c8a6ac7cf159710e9a5c94b.zip chromium_src-80c2c73da358d9797c8a6ac7cf159710e9a5c94b.tar.gz chromium_src-80c2c73da358d9797c8a6ac7cf159710e9a5c94b.tar.bz2 |
Revert of Delay CookieManagerService calls until network is available. (patchset #15 id:280001 of https://codereview.chromium.org/1108393004/)
Reason for revert:
ChromeSigninClientTest failures
https://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%281%29/builds/37726/steps/unit_tests/logs/stdio
Original issue's description:
> Delay CookieManagerService calls until network is available. This affects AddAccount, LogOut and ListAccounts. Note that ChromeOS will pass the call to the ChromeOS specific implementation of DelayNetworkCall; other platforms just wait for connection availability. This integrates with the existing backoff/retry.
>
> BUG=466799
>
> Committed: https://crrev.com/f96f43ab771a6a1b3c2ffe8fee76f7fb4a6a0691
> Cr-Commit-Position: refs/heads/master@{#328401}
TBR=rogerta@chromium.org,xiyuan@chromium.org,mlerman@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=466799
Review URL: https://codereview.chromium.org/1126893002
Cr-Commit-Position: refs/heads/master@{#328433}
Diffstat (limited to 'components/signin')
5 files changed, 17 insertions, 57 deletions
diff --git a/components/signin/core/browser/gaia_cookie_manager_service.cc b/components/signin/core/browser/gaia_cookie_manager_service.cc index 7eb1c28..e1728c8 100644 --- a/components/signin/core/browser/gaia_cookie_manager_service.cc +++ b/components/signin/core/browser/gaia_cookie_manager_service.cc @@ -318,11 +318,8 @@ void GaiaCookieManagerService::AddAccountToCookie( DCHECK(!account_id.empty()); VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id; requests_.push_back(GaiaCookieRequest::CreateAddAccountRequest(account_id)); - if (requests_.size() == 1) { - signin_client_->DelayNetworkCall( - base::Bind(&GaiaCookieManagerService::StartFetchingUbertoken, - base::Unretained(this))); - } + if (requests_.size() == 1) + StartFetchingUbertoken(); } bool GaiaCookieManagerService::ListAccounts( @@ -339,9 +336,7 @@ bool GaiaCookieManagerService::ListAccounts( if (!list_accounts_fetched_once_) { fetcher_retries_ = 0; requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest()); - signin_client_->DelayNetworkCall( - base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, - base::Unretained(this))); + StartFetchingListAccounts(); return false; } @@ -391,9 +386,7 @@ void GaiaCookieManagerService::LogOutAllAccounts() { requests_.push_back(GaiaCookieRequest::CreateLogOutRequest()); if (requests_.size() == 1) { fetcher_retries_ = 0; - signin_client_->DelayNetworkCall( - base::Bind(&GaiaCookieManagerService::StartLogOutUrlFetch, - base::Unretained(this))); + StartLogOutUrlFetch(); } } } @@ -425,9 +418,7 @@ void GaiaCookieManagerService::OnCookieChanged( if (requests_.empty()) { requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest()); fetcher_retries_ = 0; - signin_client_->DelayNetworkCall( - base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, - base::Unretained(this))); + StartFetchingListAccounts(); } else { // Remove all pending ListAccount calls; for efficiency, only call // after all pending requests are processed. @@ -488,9 +479,7 @@ void GaiaCookieManagerService::OnUbertokenSuccess( return; } - signin_client_->DelayNetworkCall( - base::Bind(&GaiaCookieManagerService::StartFetchingMergeSession, - base::Unretained(this))); + StartFetchingMergeSession(); } void GaiaCookieManagerService::OnUbertokenFailure( @@ -527,12 +516,8 @@ void GaiaCookieManagerService::OnMergeSessionFailure( if (++fetcher_retries_ < kMaxFetcherRetries && IsTransientError(error)) { fetcher_backoff_.InformOfRequest(false); fetcher_timer_.Start( - FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), - base::Bind(&SigninClient::DelayNetworkCall, - base::Unretained(signin_client_), - base::Bind( - &GaiaCookieManagerService::StartFetchingMergeSession, - base::Unretained(this)))); + FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), this, + &GaiaCookieManagerService::StartFetchingMergeSession); return; } @@ -575,12 +560,8 @@ void GaiaCookieManagerService::OnListAccountsFailure( if (++fetcher_retries_ < kMaxFetcherRetries && IsTransientError(error)) { fetcher_backoff_.InformOfRequest(false); fetcher_timer_.Start( - FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), - base::Bind(&SigninClient::DelayNetworkCall, - base::Unretained(signin_client_), - base::Bind( - &GaiaCookieManagerService::StartFetchingListAccounts, - base::Unretained(this)))); + FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), this, + &GaiaCookieManagerService::StartFetchingListAccounts); return; } @@ -627,12 +608,8 @@ void GaiaCookieManagerService::OnURLFetchComplete( ++fetcher_retries_ < kMaxFetcherRetries) { fetcher_backoff_.InformOfRequest(false); fetcher_timer_.Start( - FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), - base::Bind(&SigninClient::DelayNetworkCall, - base::Unretained(signin_client_), - base::Bind( - &GaiaCookieManagerService::StartLogOutUrlFetch, - base::Unretained(this)))); + FROM_HERE, fetcher_backoff_.GetTimeUntilRelease(), this, + &GaiaCookieManagerService::StartLogOutUrlFetch); return; } @@ -662,20 +639,14 @@ void GaiaCookieManagerService::HandleNextRequest() { } else { switch (requests_.front().request_type()) { case GaiaCookieRequestType::ADD_ACCOUNT: - signin_client_->DelayNetworkCall( - base::Bind(&GaiaCookieManagerService::StartFetchingUbertoken, - base::Unretained(this))); + StartFetchingUbertoken(); break; case GaiaCookieRequestType::LOG_OUT: - signin_client_->DelayNetworkCall( - base::Bind(&GaiaCookieManagerService::StartLogOutUrlFetch, - base::Unretained(this))); + StartLogOutUrlFetch(); break; case GaiaCookieRequestType::LIST_ACCOUNTS: uber_token_fetcher_.reset(); - signin_client_->DelayNetworkCall( - base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, - base::Unretained(this))); + StartFetchingListAccounts(); break; }; } diff --git a/components/signin/core/browser/gaia_cookie_manager_service.h b/components/signin/core/browser/gaia_cookie_manager_service.h index 7349809..d5b6c51 100644 --- a/components/signin/core/browser/gaia_cookie_manager_service.h +++ b/components/signin/core/browser/gaia_cookie_manager_service.h @@ -239,12 +239,9 @@ class GaiaCookieManagerService : public KeyedService, scoped_ptr<UbertokenFetcher> uber_token_fetcher_; ExternalCcResultFetcher external_cc_result_fetcher_; - // If the GaiaAuthFetcher or URLFetcher fails, retry with exponential backoff - // and network delay. + // If the GaiaAuthFetcher or URLFetcher fails, retry with exponential backoff. net::BackoffEntry fetcher_backoff_; - // We can safely depend on the SigninClient here because there is an explicit - // dependency, as noted in the GaiaCookieManagerServiceFactory. - base::OneShotTimer<SigninClient> fetcher_timer_; + base::OneShotTimer<GaiaCookieManagerService> fetcher_timer_; int fetcher_retries_; // The last fetched ubertoken, for use in MergeSession retries. diff --git a/components/signin/core/browser/signin_client.h b/components/signin/core/browser/signin_client.h index 2ccf7cd..2575e5d 100644 --- a/components/signin/core/browser/signin_client.h +++ b/components/signin/core/browser/signin_client.h @@ -123,9 +123,6 @@ class SigninClient : public KeyedService { // the core SigninClient. virtual ios::ProfileOAuth2TokenServiceIOSProvider* GetIOSProvider() = 0; #endif - - // Execute |callback| if and when there is a network connection. - virtual void DelayNetworkCall(const base::Closure& callback) = 0; }; #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_CLIENT_H_ diff --git a/components/signin/core/browser/test_signin_client.cc b/components/signin/core/browser/test_signin_client.cc index dd52bb2..707a850 100644 --- a/components/signin/core/browser/test_signin_client.cc +++ b/components/signin/core/browser/test_signin_client.cc @@ -128,7 +128,3 @@ void TestSigninClient::AddContentSettingsObserver( void TestSigninClient::RemoveContentSettingsObserver( content_settings::Observer* observer) { } - -void TestSigninClient::DelayNetworkCall(const base::Closure& callback) { - callback.Run(); -} diff --git a/components/signin/core/browser/test_signin_client.h b/components/signin/core/browser/test_signin_client.h index 50353b4..e1e3a47 100644 --- a/components/signin/core/browser/test_signin_client.h +++ b/components/signin/core/browser/test_signin_client.h @@ -98,7 +98,6 @@ class TestSigninClient : public SigninClient { content_settings::Observer* observer) override; void RemoveContentSettingsObserver( content_settings::Observer* observer) override; - void DelayNetworkCall(const base::Closure& callback) override; private: // Loads the token database. |