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

Side by Side Diff: chrome/browser/prerender/prerender_histograms.h

Issue 7605020: Move prerender histograms out of prerender manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_histograms.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/time.h"
12 #include "chrome/browser/prerender/prerender_final_status.h"
13 #include "chrome/browser/prerender/prerender_origin.h"
14 #include "googleurl/src/gurl.h"
15
16 namespace prerender {
17
18 // PrerenderHistograms is responsible for recording all prerender specific
19 // histograms for PrerenderManager. It keeps track of the type of prerender
20 // currently underway (based on the PrerenderOrigin of the most recent
21 // prerenders, and any experiments detected).
22 // PrerenderHistograms does not necessarily record all histograms related to
23 // prerendering, only the ones in the context of PrerenderManager.
24 class PrerenderHistograms {
25 public:
26 // Owned by a PrerenderManager object for the lifetime of the
27 // PrerenderManager.
28 PrerenderHistograms();
29
30 // Records the perceived page load time for a page - effectively the time from
31 // when the user navigates to a page to when it finishes loading. The actual
32 // load may have started prior to navigation due to prerender hints.
33 void RecordPerceivedPageLoadTime(base::TimeDelta perceived_page_load_time,
34 bool was_prerender) const;
35
36 // Records the time from when a page starts prerendering to when the user
37 // navigates to it. This must be called on the UI thread.
38 void RecordTimeUntilUsed(base::TimeDelta time_until_used,
39 base::TimeDelta max_age) const;
40
41 // Record a PerSessionCount data point.
42 void RecordPerSessionCount(int count) const;
43
44 // Record time between two prerender requests.
45 void RecordTimeBetweenPrerenderRequests(base::TimeDelta time) const;
46
47 // Record a final status of a prerendered page in a histogram.
48 void RecordFinalStatus(Origin origin,
49 uint8 experiment_id,
50 FinalStatus final_status) const;
51
52
53 // To be called when a new prerender is added.
54 void RecordPrerender(Origin origin, const GURL& url);
55
56 private:
57 base::TimeTicks GetCurrentTimeTicks() const;
58
59 // Returns whether the PrerenderManager is currently within the prerender
60 // window - effectively, up to 30 seconds after a prerender tag has been
61 // observed.
62 bool WithinWindow() const;
63
64 // Returns the histogram name for the current window.
65 std::string GetDefaultHistogramName(const std::string& name) const;
66 // Returns the current experiment.
67 uint8 GetCurrentExperimentId() const;
68 // Returns the current origin.
69 Origin GetCurrentOrigin() const;
70 // Returns whether or not there is currently an origin/experiment wash.
71 bool IsOriginExperimentWash() const;
72
73 // An integer indicating a Prerendering Experiment being currently conducted.
74 // (The last experiment ID seen).
75 uint8 last_experiment_id_;
76
77 // Origin of the last prerender seen.
78 Origin last_origin_;
79
80 // A boolean indicating that we have recently encountered a combination of
81 // different experiments and origins, making an attribution of PPLT's to
82 // experiments / origins impossible.
83 bool origin_experiment_wash_;
84
85 // The time when we last saw a prerender request coming from a renderer.
86 // This is used to record perceived PLT's for a certain amount of time
87 // from the point that we last saw a <link rel=prerender> tag.
88 base::TimeTicks last_prerender_seen_time_;
89
90 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms);
91 };
92
93 } // namespace prerender
94
95 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698