diff options
author | vadimt <vadimt@chromium.org> | 2014-10-20 15:40:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-20 22:41:01 +0000 |
commit | a23c1c6d16f59e5adfe79beabb94e18e31a73ab0 (patch) | |
tree | 9ed60aca7ede017f6c58d103b51fc2eb0acd1994 | |
parent | f898f99146b7cde544c9c10d7cbe9861a6c71bc5 (diff) | |
download | chromium_src-a23c1c6d16f59e5adfe79beabb94e18e31a73ab0.zip chromium_src-a23c1c6d16f59e5adfe79beabb94e18e31a73ab0.tar.gz chromium_src-a23c1c6d16f59e5adfe79beabb94e18e31a73ab0.tar.bz2 |
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. 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 most popular OnRefreshTokenAvailable overrides.
BUG=422460
TBR=jam@chromium.org, zelidrag@chromium.org, erikwright@chromium.org
Review URL: https://codereview.chromium.org/643183003
Cr-Commit-Position: refs/heads/master@{#300361}
6 files changed, 36 insertions, 0 deletions
diff --git a/chrome/browser/policy/cloud/user_policy_signin_service.cc b/chrome/browser/policy/cloud/user_policy_signin_service.cc index e39ccc6..a4c3812 100644 --- a/chrome/browser/policy/cloud/user_policy_signin_service.cc +++ b/chrome/browser/policy/cloud/user_policy_signin_service.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" +#include "base/profiler/scoped_profile.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/profile.h" @@ -107,6 +108,11 @@ void UserPolicySigninService::CallPolicyRegistrationCallback( void UserPolicySigninService::OnRefreshTokenAvailable( const std::string& account_id) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 UserPolicySigninService::OnRefreshTokenAvailable")); + // If using a TestingProfile with no UserCloudPolicyManager, skip // initialization. if (!policy_manager()) { diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index d726545..72f7999 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -19,6 +19,7 @@ #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/string16.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_restrictions.h" @@ -755,6 +756,11 @@ void ProfileSyncService::OnGetTokenFailure( void ProfileSyncService::OnRefreshTokenAvailable( const std::string& account_id) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 ProfileSyncService::OnRefreshTokenAvailable")); + if (account_id == signin_->GetAccountIdToUse()) OnRefreshTokensLoaded(); } diff --git a/components/signin/core/browser/account_tracker_service.cc b/components/signin/core/browser/account_tracker_service.cc index 4a6fdc6..2c5f2cb 100644 --- a/components/signin/core/browser/account_tracker_service.cc +++ b/components/signin/core/browser/account_tracker_service.cc @@ -7,6 +7,7 @@ #include "base/debug/trace_event.h" #include "base/prefs/pref_service.h" #include "base/prefs/scoped_user_pref_update.h" +#include "base/profiler/scoped_profile.h" #include "base/strings/utf_string_conversions.h" #include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/common/signin_pref_names.h" @@ -257,6 +258,11 @@ AccountTrackerService::GetMigrationState(PrefService* pref_service) { void AccountTrackerService::OnRefreshTokenAvailable( const std::string& account_id) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 AccountTrackerService::OnRefreshTokenAvailable")); + TRACE_EVENT1("AccountTrackerService", "AccountTracker::OnRefreshTokenAvailable", "account_id", diff --git a/components/signin/core/browser/signin_account_id_helper.cc b/components/signin/core/browser/signin_account_id_helper.cc index 57a69b2..8570e11 100644 --- a/components/signin/core/browser/signin_account_id_helper.cc +++ b/components/signin/core/browser/signin_account_id_helper.cc @@ -5,6 +5,7 @@ #include "components/signin/core/browser/signin_account_id_helper.h" #include "base/prefs/pref_service.h" +#include "base/profiler/scoped_profile.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_client.h" #include "components/signin/core/common/signin_pref_names.h" @@ -136,6 +137,11 @@ void SigninAccountIdHelper::GoogleSignedOut(const std::string& account_id, void SigninAccountIdHelper::OnRefreshTokenAvailable( const std::string& account_id) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 SigninAccountIdHelper::OnRefreshTokenAvailable")); + if (account_id == signin_manager_->GetAuthenticatedAccountId()) { std::string current_gaia_id = client_->GetPrefs()->GetString(prefs::kGoogleServicesUserAccountId); diff --git a/google_apis/gaia/account_tracker.cc b/google_apis/gaia/account_tracker.cc index 50c4e70..d6476b5 100644 --- a/google_apis/gaia/account_tracker.cc +++ b/google_apis/gaia/account_tracker.cc @@ -6,6 +6,7 @@ #include "base/debug/trace_event.h" #include "base/logging.h" +#include "base/profiler/scoped_profile.h" #include "base/stl_util.h" #include "net/url_request/url_request_context_getter.h" @@ -84,6 +85,11 @@ AccountIds AccountTracker::FindAccountIdsByGaiaId(const std::string& gaia_id) { } void AccountTracker::OnRefreshTokenAvailable(const std::string& account_id) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 AccountTracker::OnRefreshTokenAvailable")); + TRACE_EVENT1("identity", "AccountTracker::OnRefreshTokenAvailable", "account_key", diff --git a/google_apis/gaia/identity_provider.cc b/google_apis/gaia/identity_provider.cc index 842891e..73abe2a 100644 --- a/google_apis/gaia/identity_provider.cc +++ b/google_apis/gaia/identity_provider.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/profiler/scoped_profile.h" #include "google_apis/gaia/identity_provider.h" IdentityProvider::Observer::~Observer() {} @@ -39,6 +40,11 @@ void IdentityProvider::RemoveObserver(Observer* observer) { } void IdentityProvider::OnRefreshTokenAvailable(const std::string& account_id) { + // TODO(vadimt): Remove ScopedProfile below once crbug.com/422460 is fixed. + tracked_objects::ScopedProfile tracking_profile( + FROM_HERE_WITH_EXPLICIT_FUNCTION( + "422460 IdentityProvider::OnRefreshTokenAvailable")); + if (account_id != GetActiveAccountId()) return; FOR_EACH_OBSERVER(OAuth2TokenService::Observer, |