More instrumentations in ChromeNetworkDelegate, TaskManager and ResourceLoader.
Prior instrumentations showed that most of the jank happens in these methods:
ResourceLoader::OnResponseStarted
ChromeNetworkDelegate::OnRawBytesRead
ResourceLoader::OnReadCompleted,
but outside of other instrumentations.
Adding more instrumentations.
BUG=423948
Review URL: https://codereview.chromium.org/751573005
Cr-Commit-Position: refs/heads/master@{#305940}
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 0dd36c7..0ca475f 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -509,8 +509,23 @@
#if defined(ENABLE_TASK_MANAGER)
// This is not completely accurate, but as a first approximation ignore
// requests that are served from the cache. See bug 330931 for more info.
- if (!request.was_cached())
- TaskManager::GetInstance()->model()->NotifyBytesRead(request, bytes_read);
+ if (!request.was_cached()) {
+ // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
+ // I suspect that the jank is in creating a TaskManager instance. After the
+ // bug is fixed, rewrite the operators below as one line.
+ tracked_objects::ScopedTracker tracking_profile1(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "423948 ChromeNetworkDelegate::OnRawBytesRead1"));
+
+ TaskManager* task_manager = TaskManager::GetInstance();
+
+ // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
+ tracked_objects::ScopedTracker tracking_profile2(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "423948 ChromeNetworkDelegate::OnRawBytesRead2"));
+
+ task_manager->model()->NotifyBytesRead(request, bytes_read);
+ }
#endif // defined(ENABLE_TASK_MANAGER)
}