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

Unified Diff: chrome/browser/metrics/first_web_contents_profiler.cc

Issue 1421293005: Move new Startup.FirstWebContents.* stats to Startup.FirstWebContents.*2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ab2_moar_betta_metrics
Patch Set: Created 5 years, 2 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: chrome/browser/metrics/first_web_contents_profiler.cc
diff --git a/chrome/browser/metrics/first_web_contents_profiler.cc b/chrome/browser/metrics/first_web_contents_profiler.cc
index ae630bd036485eea6eb8197ded5c802e4bf78217..cbeef39cf1b5e766fcf462c49547889be281e623 100644
--- a/chrome/browser/metrics/first_web_contents_profiler.cc
+++ b/chrome/browser/metrics/first_web_contents_profiler.cc
@@ -122,6 +122,7 @@ FirstWebContentsProfiler::FirstWebContentsProfiler(
collected_load_metric_(false),
collected_main_navigation_start_metric_(false),
collected_main_navigation_finished_metric_(false),
+ finished_(false),
delegate_(delegate),
responsiveness_histogram_(NULL),
responsiveness_1sec_histogram_(NULL),
@@ -141,7 +142,11 @@ void FirstWebContentsProfiler::DidFirstVisuallyNonEmptyPaint() {
}
collected_paint_metric_ = true;
- startup_metric_utils::RecordFirstWebContentsNonEmptyPaint(base::Time::Now());
+ const base::Time now = base::Time::Now();
+ // Record the old metric unconditionally.
+ startup_metric_utils::RecordDeprecatedFirstWebContentsNonEmptyPaint(now);
+ if (!finished_)
+ startup_metric_utils::RecordFirstWebContentsNonEmptyPaint(now);
metrics::TrackingSynchronizer::OnProfilingPhaseCompleted(
metrics::ProfilerEventProto::EVENT_FIRST_NONEMPTY_PAINT);
@@ -179,7 +184,11 @@ void FirstWebContentsProfiler::DocumentOnLoadCompletedInMainFrame() {
}
collected_load_metric_ = true;
- startup_metric_utils::RecordFirstWebContentsMainFrameLoad(base::Time::Now());
+ const base::Time now = base::Time::Now();
+ // Record the old metric unconditionally.
+ startup_metric_utils::RecordDeprecatedFirstWebContentsMainFrameLoad(now);
+ if (!finished_)
+ startup_metric_utils::RecordFirstWebContentsMainFrameLoad(now);
if (IsFinishedCollectingMetrics())
FinishedCollectingMetrics(FinishReason::DONE);
@@ -254,17 +263,22 @@ bool FirstWebContentsProfiler::IsFinishedCollectingMetrics() {
void FirstWebContentsProfiler::FinishedCollectingMetrics(
FinishReason finish_reason) {
- UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason",
- finish_reason, FinishReason::ENUM_MAX);
- if (!collected_paint_metric_) {
- UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoPaint",
- finish_reason, FinishReason::ENUM_MAX);
- }
- if (!collected_load_metric_) {
- UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoLoad",
+ if (!finished_) {
+ UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason",
finish_reason, FinishReason::ENUM_MAX);
+ if (!collected_paint_metric_) {
+ UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoPaint",
+ finish_reason, FinishReason::ENUM_MAX);
+ }
+ if (!collected_load_metric_) {
+ UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoLoad",
+ finish_reason, FinishReason::ENUM_MAX);
+ }
+ finished_ = true;
}
- delegate_->ProfilerFinishedCollectingMetrics();
+ // TODO(gab): Delete right away when getting rid of |finished_|.
+ if (IsFinishedCollectingMetrics())
+ delegate_->ProfilerFinishedCollectingMetrics();
}
void FirstWebContentsProfiler::InitHistograms() {
« no previous file with comments | « chrome/browser/metrics/first_web_contents_profiler.h ('k') | chrome/browser/ui/profile_error_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698