Commit 61f1c291 authored by mlerman's avatar mlerman Committed by Commit bot

Instrument the MutablePO2TS.

BUG=461364

Review URL: https://codereview.chromium.org/957313002

Cr-Commit-Position: refs/heads/master@{#318257}
parent 7c4800b8
...@@ -125,13 +125,16 @@ MutableProfileOAuth2TokenService::AccountInfo::GetAuthStatus() const { ...@@ -125,13 +125,16 @@ MutableProfileOAuth2TokenService::AccountInfo::GetAuthStatus() const {
MutableProfileOAuth2TokenService::MutableProfileOAuth2TokenService() MutableProfileOAuth2TokenService::MutableProfileOAuth2TokenService()
: web_data_service_request_(0) { : web_data_service_request_(0) {
VLOG(1) << "MutablePO2TS::MutablePO2TS";
} }
MutableProfileOAuth2TokenService::~MutableProfileOAuth2TokenService() { MutableProfileOAuth2TokenService::~MutableProfileOAuth2TokenService() {
VLOG(1) << "MutablePO2TS::~MutablePO2TS";
DCHECK(server_revokes_.empty()); DCHECK(server_revokes_.empty());
} }
void MutableProfileOAuth2TokenService::Shutdown() { void MutableProfileOAuth2TokenService::Shutdown() {
VLOG(1) << "MutablePO2TS::Shutdown";
server_revokes_.clear(); server_revokes_.clear();
CancelWebTokenFetch(); CancelWebTokenFetch();
CancelAllRequests(); CancelAllRequests();
...@@ -187,6 +190,8 @@ void MutableProfileOAuth2TokenService::LoadCredentials( ...@@ -187,6 +190,8 @@ void MutableProfileOAuth2TokenService::LoadCredentials(
void MutableProfileOAuth2TokenService::OnWebDataServiceRequestDone( void MutableProfileOAuth2TokenService::OnWebDataServiceRequestDone(
WebDataServiceBase::Handle handle, WebDataServiceBase::Handle handle,
const WDTypedResult* result) { const WDTypedResult* result) {
VLOG(1) << "MutablePO2TS::OnWebDataServiceRequestDone. Result type: "
<< (result == nullptr ? -1 : (int)result->GetType());
DCHECK_EQ(web_data_service_request_, handle); DCHECK_EQ(web_data_service_request_, handle);
web_data_service_request_ = 0; web_data_service_request_ = 0;
...@@ -231,6 +236,8 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory( ...@@ -231,6 +236,8 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory(
{ {
ScopedBatchChange batch(this); ScopedBatchChange batch(this);
VLOG(1) << "MutablePO2TS::LoadAllCredentialsIntoMemory; "
<< db_tokens.size() << " Credential(s).";
for (std::map<std::string, std::string>::const_iterator iter = for (std::map<std::string, std::string>::const_iterator iter =
db_tokens.begin(); db_tokens.begin();
iter != db_tokens.end(); iter != db_tokens.end();
...@@ -276,6 +283,7 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory( ...@@ -276,6 +283,7 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory(
void MutableProfileOAuth2TokenService::UpdateAuthError( void MutableProfileOAuth2TokenService::UpdateAuthError(
const std::string& account_id, const std::string& account_id,
const GoogleServiceAuthError& error) { const GoogleServiceAuthError& error) {
VLOG(1) << "MutablePO2TS::UpdateAuthError. Error: " << error.state();
ValidateAccountId(account_id); ValidateAccountId(account_id);
// Do not report connection errors as these are not actually auth errors. // Do not report connection errors as these are not actually auth errors.
...@@ -322,6 +330,8 @@ void MutableProfileOAuth2TokenService::UpdateCredentials( ...@@ -322,6 +330,8 @@ void MutableProfileOAuth2TokenService::UpdateCredentials(
// If token present, and different from the new one, cancel its requests, // If token present, and different from the new one, cancel its requests,
// and clear the entries in cache related to that account. // and clear the entries in cache related to that account.
if (refresh_token_present) { if (refresh_token_present) {
VLOG(1) << "MutablePO2TS::UpdateCredentials; Refresh Token was present. "
<< "account_id=" << account_id;
std::string revoke_reason = refresh_token_present ? "token differs" : std::string revoke_reason = refresh_token_present ? "token differs" :
"token is missing"; "token is missing";
LOG(WARNING) << "Revoking refresh token on server. " LOG(WARNING) << "Revoking refresh token on server. "
...@@ -331,6 +341,8 @@ void MutableProfileOAuth2TokenService::UpdateCredentials( ...@@ -331,6 +341,8 @@ void MutableProfileOAuth2TokenService::UpdateCredentials(
ClearCacheForAccount(account_id); ClearCacheForAccount(account_id);
refresh_tokens_[account_id]->set_refresh_token(refresh_token); refresh_tokens_[account_id]->set_refresh_token(refresh_token);
} else { } else {
VLOG(1) << "MutablePO2TS::UpdateCredentials; Refresh Token was absent. "
<< "account_id=" << account_id;
refresh_tokens_[account_id].reset( refresh_tokens_[account_id].reset(
new AccountInfo(signin_error_controller(), new AccountInfo(signin_error_controller(),
account_id, account_id,
...@@ -351,6 +363,7 @@ void MutableProfileOAuth2TokenService::RevokeCredentials( ...@@ -351,6 +363,7 @@ void MutableProfileOAuth2TokenService::RevokeCredentials(
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
if (refresh_tokens_.count(account_id) > 0) { if (refresh_tokens_.count(account_id) > 0) {
VLOG(1) << "MutablePO2TS::RevokeCredentials for account_id=" << account_id;
ScopedBatchChange batch(this); ScopedBatchChange batch(this);
RevokeCredentialsOnServer(refresh_tokens_[account_id]->refresh_token()); RevokeCredentialsOnServer(refresh_tokens_[account_id]->refresh_token());
CancelRequestsForAccount(account_id); CancelRequestsForAccount(account_id);
...@@ -366,6 +379,7 @@ void MutableProfileOAuth2TokenService::PersistCredentials( ...@@ -366,6 +379,7 @@ void MutableProfileOAuth2TokenService::PersistCredentials(
const std::string& refresh_token) { const std::string& refresh_token) {
scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase(); scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase();
if (token_web_data.get()) { if (token_web_data.get()) {
VLOG(1) << "MutablePO2TS::PersistCredentials for account_id=" << account_id;
token_web_data->SetTokenForService(ApplyAccountIdPrefix(account_id), token_web_data->SetTokenForService(ApplyAccountIdPrefix(account_id),
refresh_token); refresh_token);
} }
...@@ -374,8 +388,11 @@ void MutableProfileOAuth2TokenService::PersistCredentials( ...@@ -374,8 +388,11 @@ void MutableProfileOAuth2TokenService::PersistCredentials(
void MutableProfileOAuth2TokenService::ClearPersistedCredentials( void MutableProfileOAuth2TokenService::ClearPersistedCredentials(
const std::string& account_id) { const std::string& account_id) {
scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase(); scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase();
if (token_web_data.get()) if (token_web_data.get()) {
VLOG(1) << "MutablePO2TS::ClearPersistedCredentials for account_id="
<< account_id;
token_web_data->RemoveTokenForService(ApplyAccountIdPrefix(account_id)); token_web_data->RemoveTokenForService(ApplyAccountIdPrefix(account_id));
}
} }
void MutableProfileOAuth2TokenService::RevokeAllCredentials() { void MutableProfileOAuth2TokenService::RevokeAllCredentials() {
...@@ -385,6 +402,7 @@ void MutableProfileOAuth2TokenService::RevokeAllCredentials() { ...@@ -385,6 +402,7 @@ void MutableProfileOAuth2TokenService::RevokeAllCredentials() {
ScopedBatchChange batch(this); ScopedBatchChange batch(this);
VLOG(1) << "MutablePO2TS::RevokeAllCredentials";
CancelWebTokenFetch(); CancelWebTokenFetch();
CancelAllRequests(); CancelAllRequests();
ClearCache(); ClearCache();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment