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

Unified Diff: chrome/browser/prerender/prerender_histograms.h

Issue 2738783002: Prerender: Remove PerceivedPLT histograms (Closed)
Patch Set: set the origin in prerender_tab_helper Created 3 years, 9 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
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/prerender/prerender_histograms.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_histograms.h
diff --git a/chrome/browser/prerender/prerender_histograms.h b/chrome/browser/prerender/prerender_histograms.h
index 71bff438758ac90e03a948094b9de17a19b66c51..3fda4bee4bd05b163d6e14f668a559a2b16b4013 100644
--- a/chrome/browser/prerender/prerender_histograms.h
+++ b/chrome/browser/prerender/prerender_histograms.h
@@ -28,43 +28,34 @@ enum NavigationType {
NAVIGATION_TYPE_PRERENDERED,
};
-// PrerenderHistograms is responsible for recording all prerender specific
-// histograms for PrerenderManager. It keeps track of the type of prerender
-// currently underway (based on the PrerenderOrigin of the most recent
-// prerenders, and any experiments detected).
-// PrerenderHistograms does not necessarily record all histograms related to
-// prerendering, only the ones in the context of PrerenderManager.
+// Records histograms for PrerenderManager.
+//
+// A few histograms are dynamically constructed to avoid binary size bloat from
+// histogram_macros.h. Such histograms require careful handling:
+// 1. slow - make sure only rare events are recorded this way, a handful of such
+// events per page load should be OK
+// 2. may lead to small sporadic memory leaks in Histogram::Factory::Build() -
+// ensuring that they are recorded from the same thread is sufficient
+//
+// Besides thread checking this class is stateless, all public methods are
+// const.
class PrerenderHistograms {
public:
// Owned by a PrerenderManager object for the lifetime of the
// PrerenderManager.
PrerenderHistograms();
- // Records the perceived page load time for a page - effectively the time from
- // when the user navigates to a page to when it finishes loading. The actual
- // load may have started prior to navigation due to prerender hints.
- void RecordPerceivedPageLoadTime(Origin origin,
- base::TimeDelta perceived_page_load_time,
- NavigationType navigation_type,
- const GURL& url);
-
// Record that a first contentful paint occured, and whether we were able to
// successfuly record the perceived FCP.
void RecordPerceivedFirstContentfulPaintStatus(Origin origin,
bool successful,
- bool was_hidden);
+ bool was_hidden) const;
// Records, in a histogram, the percentage of the page load time that had
// elapsed by the time it is swapped in. Values outside of [0, 1.0] are
// invalid and ignored.
void RecordPercentLoadDoneAtSwapin(Origin origin, double fraction) const;
- // Records the actual pageload time of a prerender that has not been swapped
- // in yet, but finished loading.
- void RecordPageLoadTimeNotSwappedIn(Origin origin,
- base::TimeDelta page_load_time,
- const GURL& url) const;
-
// Records the time from when a page starts prerendering to when the user
// navigates to it. This must be called on the UI thread.
void RecordTimeUntilUsed(Origin origin,
@@ -85,16 +76,9 @@ class PrerenderHistograms {
// Record a final status of a prerendered page in a histogram.
void RecordFinalStatus(Origin origin, FinalStatus final_status) const;
- // To be called when a new prerender is added.
- void RecordPrerender();
-
// To be called when a new prerender is started.
void RecordPrerenderStarted(Origin origin) const;
- // To be called when we know how many prerenders are running after starting
- // a prerender.
- void RecordConcurrency(size_t prerender_count) const;
-
// Called when we swap in a prerender.
void RecordUsedPrerender(Origin origin) const;
@@ -129,34 +113,14 @@ class PrerenderHistograms {
// advance of navigation start). One of several histograms is used, depending
// on whether this URL could have been prefetched before the navigation
// leading to the paint.
- void RecordPrefetchFirstContentfulPaintTime(Origin origin,
- bool is_no_store,
- bool was_hidden,
- base::TimeDelta time,
- base::TimeDelta prefetch_age);
+ void RecordPrefetchFirstContentfulPaintTime(
+ Origin origin,
+ bool is_no_store,
+ bool was_hidden,
+ base::TimeDelta time,
+ base::TimeDelta prefetch_age) const;
private:
- base::TimeTicks GetCurrentTimeTicks() const;
-
- // Returns the time elapsed since the last prerender happened.
- base::TimeDelta GetTimeSinceLastPrerender() const;
-
- // Returns whether the PrerenderManager is currently within the prerender
- // window - effectively, up to 30 seconds after a prerender tag has been
- // observed.
- bool WithinWindow() const;
-
- // The time when we last saw a prerender request coming from a renderer.
- // This is used to record perceived PLT's for a certain amount of time
- // from the point that we last saw a <link rel=prerender> tag.
- base::TimeTicks last_prerender_seen_time_;
-
- // Indicates whether we have recorded page load events after the most
- // recent prerender. These must be initialized to true, so that we don't
- // start recording events before the first prerender occurs.
- bool seen_any_pageload_;
- bool seen_pageload_started_after_prerender_;
-
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms);
« no previous file with comments | « chrome/browser/prerender/prerender_browsertest.cc ('k') | chrome/browser/prerender/prerender_histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698