| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "google_apis/gaia/account_tracker.h" | 5 #include "google_apis/gaia/account_tracker.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 while (!accounts_.empty()) | 229 while (!accounts_.empty()) |
| 230 StopTrackingAccount(accounts_.begin()->first); | 230 StopTrackingAccount(accounts_.begin()->first); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void AccountTracker::StartFetchingUserInfo(const std::string account_key) { | 233 void AccountTracker::StartFetchingUserInfo(const std::string account_key) { |
| 234 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. | 234 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
| 235 tracked_objects::ScopedTracker tracking_profile( | 235 tracked_objects::ScopedTracker tracking_profile( |
| 236 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 236 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 237 "422460 AccountTracker::StartFetchingUserInfo")); | 237 "422460 AccountTracker::StartFetchingUserInfo")); |
| 238 | 238 |
| 239 if (ContainsKey(user_info_requests_, account_key)) | 239 if (ContainsKey(user_info_requests_, account_key)) { |
| 240 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
| 241 tracked_objects::ScopedTracker tracking_profile1( |
| 242 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 243 "422460 AccountTracker::StartFetchingUserInfo 1")); |
| 244 |
| 240 DeleteFetcher(user_info_requests_[account_key]); | 245 DeleteFetcher(user_info_requests_[account_key]); |
| 246 } |
| 241 | 247 |
| 242 DVLOG(1) << "StartFetching " << account_key; | 248 DVLOG(1) << "StartFetching " << account_key; |
| 249 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
| 250 tracked_objects::ScopedTracker tracking_profile2( |
| 251 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 252 "422460 AccountTracker::StartFetchingUserInfo 2")); |
| 253 |
| 243 AccountIdFetcher* fetcher = | 254 AccountIdFetcher* fetcher = |
| 244 new AccountIdFetcher(identity_provider_->GetTokenService(), | 255 new AccountIdFetcher(identity_provider_->GetTokenService(), |
| 245 request_context_getter_.get(), | 256 request_context_getter_.get(), |
| 246 this, | 257 this, |
| 247 account_key); | 258 account_key); |
| 248 user_info_requests_[account_key] = fetcher; | 259 user_info_requests_[account_key] = fetcher; |
| 260 |
| 261 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed. |
| 262 tracked_objects::ScopedTracker tracking_profile3( |
| 263 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 264 "422460 AccountTracker::StartFetchingUserInfo 3")); |
| 265 |
| 249 fetcher->Start(); | 266 fetcher->Start(); |
| 250 } | 267 } |
| 251 | 268 |
| 252 void AccountTracker::OnUserInfoFetchSuccess(AccountIdFetcher* fetcher, | 269 void AccountTracker::OnUserInfoFetchSuccess(AccountIdFetcher* fetcher, |
| 253 const std::string& gaia_id) { | 270 const std::string& gaia_id) { |
| 254 const std::string& account_key = fetcher->account_key(); | 271 const std::string& account_key = fetcher->account_key(); |
| 255 DCHECK(ContainsKey(accounts_, account_key)); | 272 DCHECK(ContainsKey(accounts_, account_key)); |
| 256 AccountState& account = accounts_[account_key]; | 273 AccountState& account = accounts_[account_key]; |
| 257 | 274 |
| 258 account.ids.gaia = gaia_id; | 275 account.ids.gaia = gaia_id; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 "AccountIdFetcher", | 372 "AccountIdFetcher", |
| 356 this, | 373 this, |
| 357 "OnNetworkError", | 374 "OnNetworkError", |
| 358 "response_code", | 375 "response_code", |
| 359 response_code); | 376 response_code); |
| 360 LOG(ERROR) << "OnNetworkError " << response_code; | 377 LOG(ERROR) << "OnNetworkError " << response_code; |
| 361 tracker_->OnUserInfoFetchFailure(this); | 378 tracker_->OnUserInfoFetchFailure(this); |
| 362 } | 379 } |
| 363 | 380 |
| 364 } // namespace gaia | 381 } // namespace gaia |
| OLD | NEW |