Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1160)

Unified Diff: components/dom_distiller/content/distiller_page_web_contents.cc

Issue 1143173009: Add UMA histogram DomDistiller.Time.RunJavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/content/distiller_page_web_contents.cc
diff --git a/components/dom_distiller/content/distiller_page_web_contents.cc b/components/dom_distiller/content/distiller_page_web_contents.cc
index cfa408cd41c08b2ed9de86be1c07d173e8e875f2..1bf6a9187aeaceacc3f8e7f9fb6480ea455594e1 100644
--- a/components/dom_distiller/content/distiller_page_web_contents.cc
+++ b/components/dom_distiller/content/distiller_page_web_contents.cc
@@ -6,6 +6,7 @@
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
+#include "base/metrics/histogram.h"
#include "base/strings/utf_string_conversions.h"
#include "components/dom_distiller/content/web_contents_main_frame_observer.h"
#include "components/dom_distiller/core/distiller_page.h"
@@ -164,7 +165,7 @@ void DistillerPageWebContents::DidFailLoad(
DCHECK(state_ == LOADING_PAGE || state_ == EXECUTING_JAVASCRIPT);
state_ = PAGELOAD_FAILED;
scoped_ptr<base::Value> empty = base::Value::CreateNullValue();
- OnWebContentsDistillationDone(GURL(), empty.get());
+ OnWebContentsDistillationDone(GURL(), base::TimeTicks(), empty.get());
}
}
@@ -183,15 +184,24 @@ void DistillerPageWebContents::ExecuteJavaScript() {
base::UTF8ToUTF16(script_),
base::Bind(&DistillerPageWebContents::OnWebContentsDistillationDone,
base::Unretained(this),
- source_page_handle_->web_contents()->GetLastCommittedURL()));
+ source_page_handle_->web_contents()->GetLastCommittedURL(),
+ base::TimeTicks::Now()));
}
void DistillerPageWebContents::OnWebContentsDistillationDone(
const GURL& page_url,
+ const base::TimeTicks& javascript_start,
const base::Value* value) {
DCHECK(state_ == IDLE || state_ == LOADING_PAGE || // TODO(nyquist): 493795.
state_ == PAGELOAD_FAILED || state_ == EXECUTING_JAVASCRIPT);
state_ = IDLE;
+
+ if (!javascript_start.is_null()) {
+ base::TimeDelta javascript_time = base::TimeTicks::Now() - javascript_start;
+ UMA_HISTOGRAM_TIMES("DomDistiller.Time.RunJavaScript", javascript_time);
+ DVLOG(1) << "DomDistiller.Time.RunJavaScript = " << javascript_time;
+ }
+
DistillerPage::OnDistillationDone(page_url, value);
}
« no previous file with comments | « components/dom_distiller/content/distiller_page_web_contents.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698