summaryrefslogtreecommitdiffstats
path: root/components/translate
diff options
context:
space:
mode:
authorvadimt <vadimt@chromium.org>2014-10-15 18:16:52 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-16 01:17:08 +0000
commitd2b5bf6d43f44b429242f6b8a1589d340931ca4b (patch)
tree7076010448e2f09cdc0e0cf034746e7e56108e0e /components/translate
parent83afd876646fc45deb677780d16b615915cd56eb (diff)
downloadchromium_src-d2b5bf6d43f44b429242f6b8a1589d340931ca4b.zip
chromium_src-d2b5bf6d43f44b429242f6b8a1589d340931ca4b.tar.gz
chromium_src-d2b5bf6d43f44b429242f6b8a1589d340931ca4b.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 callbacks of TranslateURLFetcher::OnURLFetchComplete: 1. TranslateLanguageList::OnLanguageListFetchComplete 2. TranslateScript::OnScriptFetchComplete BUG=422577 TBR=andrewhayden@chromium.org Review URL: https://codereview.chromium.org/656183002 Cr-Commit-Position: refs/heads/master@{#299805}
Diffstat (limited to 'components/translate')
-rw-r--r--components/translate/core/browser/translate_language_list.cc6
-rw-r--r--components/translate/core/browser/translate_script.cc6
2 files changed, 12 insertions, 0 deletions
diff --git a/components/translate/core/browser/translate_language_list.cc b/components/translate/core/browser/translate_language_list.cc
index f4b5aa9..6a9b8c2 100644
--- a/components/translate/core/browser/translate_language_list.cc
+++ b/components/translate/core/browser/translate_language_list.cc
@@ -10,6 +10,7 @@
#include "base/json/json_reader.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/profiler/scoped_profile.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -228,6 +229,11 @@ void TranslateLanguageList::OnLanguageListFetchComplete(
int id,
bool success,
const std::string& data) {
+ // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed.
+ tracked_objects::ScopedProfile tracking_profile(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "422577 TranslateLanguageList::OnLanguageListFetchComplete"));
+
if (!success) {
// Since it fails just now, omit to schedule resource requests if
// ResourceRequestAllowedNotifier think it's ready. Otherwise, a callback
diff --git a/components/translate/core/browser/translate_script.cc b/components/translate/core/browser/translate_script.cc
index a3c18eb..ff4288c 100644
--- a/components/translate/core/browser/translate_script.cc
+++ b/components/translate/core/browser/translate_script.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
+#include "base/profiler/scoped_profile.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -117,6 +118,11 @@ void TranslateScript::Request(const RequestCallback& callback) {
void TranslateScript::OnScriptFetchComplete(
int id, bool success, const std::string& data) {
+ // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed.
+ tracked_objects::ScopedProfile tracking_profile(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "422577 TranslateScript::OnScriptFetchComplete"));
+
DCHECK_EQ(kFetcherId, id);
scoped_ptr<const TranslateURLFetcher> delete_ptr(fetcher_.release());