Commit 76e9fa8f authored by vadimt's avatar vadimt Committed by Commit bot

Adding instrumentation to locate the source of jankiness.

Previous instrumentations showed that TemplateURLService::ChangeToLoadedState
alone is responsible for 2.74 janks per hour in UI thread in Win (8.15 on Mac). I need to instrument
the code inside it to find out which part causes jank.

This is a 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.

BUG=422460

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

Cr-Commit-Position: refs/heads/master@{#302147}
parent 9e47ab57
......@@ -1625,17 +1625,33 @@ void TemplateURLService::SetTemplateURLs(TemplateURLVector* urls) {
}
void TemplateURLService::ChangeToLoadedState() {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed.
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"422460 TemplateURLService::ChangeToLoadedState 1"));
DCHECK(!loaded_);
provider_map_->Init(template_urls_, search_terms_data());
loaded_ = true;
// TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed.
tracked_objects::ScopedTracker tracking_profile2(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"422460 TemplateURLService::ChangeToLoadedState 2"));
// This will cause a call to NotifyObservers().
ApplyDefaultSearchChangeNoMetrics(
initial_default_search_provider_ ?
&initial_default_search_provider_->data() : NULL,
default_search_provider_source_);
initial_default_search_provider_.reset();
// TODO(vadimt): Remove ScopedTracker below once crbug.com/422460 is fixed.
tracked_objects::ScopedTracker tracking_profile3(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"422460 TemplateURLService::ChangeToLoadedState 3"));
on_loaded_callbacks_.Notify();
}
......
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