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

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 explicit PrerenderHistograms();
dominich 2011/08/10 17:16:22 no need for explicit here now.
tburkard 2011/08/10 17:49:14 Done.
29 virtual ~PrerenderHistograms() { }
30
31 // Records the perceived page load time for a page - effectively the time from
32 // when the user navigates to a page to when it finishes loading. The actual
33 // load may have started prior to navigation due to prerender hints.
34 void RecordPerceivedPageLoadTime(base::TimeDelta perceived_page_load_time,
35 bool was_prerender) const;
36
37 // Records the time from when a page starts prerendering to when the user
38 // navigates to it. This must be called on the UI thread.
39 void RecordTimeUntilUsed(base::TimeDelta time_until_used,
40 base::TimeDelta max_age) const;
41
42 // Record a PerSessionCount data point.
43 void RecordPerSessionCount(int count) const;
44
45 // Record time between two prerender requests.
46 void RecordTimeBetweenPrerenderRequests(base::TimeDelta time) const;
47
48 // Record a final status of a prerendered page in a histogram.
49 void RecordFinalStatus(Origin origin,
50 uint8 experiment_id,
51 FinalStatus final_status) const;
52
53
54 // To be called when a new prerender is added.
55 void RecordPrerender(Origin origin, const GURL& url);
56
57 private:
58 virtual base::TimeTicks GetCurrentTimeTicks() const;
dominich 2011/08/10 17:16:22 This is virtual so that browser tests could overri
tburkard 2011/08/10 17:49:14 Done.
59
60 // Returns whether the PrerenderManager is currently within the prerender
61 // window - effectively, up to 30 seconds after a prerender tag has been
62 // observed.
63 bool WithinWindow() const;
64
65 // Returns the histogram name for the current window.
66 std::string GetDefaultHistogramName(const std::string& name) const;
67 // Returns the current experiment.
68 uint8 GetCurrentExperimentId() const;
69 // Returns the current origin.
70 Origin GetCurrentOrigin() const;
71 // Returns whether or not there is currently an origin/experiment wash.
72 bool IsOriginExperimentWash() const;
73
74 // An integer indicating a Prerendering Experiment being currently conducted.
75 // (The last experiment ID seen).
76 uint8 last_experiment_id_;
77
78 // Origin of the last prerender seen.
79 Origin last_origin_;
80
81 // A boolean indicating that we have recently encountered a combination of
82 // different experiments and origins, making an attribution of PPLT's to
83 // experiments / origins impossible.
84 bool origin_experiment_wash_;
85
86 // The time when we last saw a prerender request coming from a renderer.
87 // This is used to record perceived PLT's for a certain amount of time
88 // from the point that we last saw a <link rel=prerender> tag.
89 base::TimeTicks last_prerender_seen_time_;
90
91 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms);
92 };
93
94 } // namespace prerender
95
96 #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