From 5cc2cfc1f3b0174d4b89eb836c75e910a6696b9a Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 24 Oct 2014 19:24:11 -0700 Subject: [PATCH] Adding instrumentation to locate the source of jankiness. Mechanical change that adds instrumentation required to locate the source of jankiness (i.e. a long-running fragment of code executed as a part of the task that causes jank) in the code. See the bug for details on what kind of jank we are after. A number of similar CLs were landed, and none of them caused issues. They've helped to find and fix janky code. The code of the instrumentation is highly optimized and is not expected to affect performance. The code simply creates a diagnostic task which is identical to ones created by PostTask or IPC message handlers. Landing as TBR since this is a mechanical, safe and temporary change. This CL instruments code invoked from AccountTracker::OnRefreshTokenAvailable, which is responsible for 20.6 jph. BUG=422460 TBR=brettw@chromium.org Review URL: https://codereview.chromium.org/676123002 Cr-Commit-Position: refs/heads/master@{#301267} --- google_apis/gaia/account_tracker.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/google_apis/gaia/account_tracker.cc b/google_apis/gaia/account_tracker.cc index d6476b5c4d3c..b134fc09eea6 100644 --- a/google_apis/gaia/account_tracker.cc +++ b/google_apis/gaia/account_tracker.cc @@ -164,6 +164,11 @@ void AccountTracker::NotifyAccountRemoved(const AccountState& account) { } void AccountTracker::NotifySignInChanged(const AccountState& account) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 AccountTracker::NotifySignInChanged")); + DCHECK(!account.ids.gaia.empty()); FOR_EACH_OBSERVER(Observer, observer_list_, @@ -172,6 +177,10 @@ void AccountTracker::NotifySignInChanged(const AccountState& account) { void AccountTracker::UpdateSignInState(const std::string account_key, bool is_signed_in) { + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 AccountTracker::UpdateSignInState")); + StartTrackingAccount(account_key); AccountState& account = accounts_[account_key]; bool needs_gaia_id = account.ids.gaia.empty(); @@ -186,6 +195,11 @@ void AccountTracker::UpdateSignInState(const std::string account_key, } void AccountTracker::StartTrackingAccount(const std::string account_key) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 AccountTracker::StartTrackingAccount")); + if (!ContainsKey(accounts_, account_key)) { DVLOG(1) << "StartTracking " << account_key; AccountState account_state; @@ -217,6 +231,11 @@ void AccountTracker::StopTrackingAllAccounts() { } void AccountTracker::StartFetchingUserInfo(const std::string account_key) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 AccountTracker::StartFetchingUserInfo")); + if (ContainsKey(user_info_requests_, account_key)) DeleteFetcher(user_info_requests_[account_key]); -- 2.11.4.GIT