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

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

Issue 2287993003: [NoStatePrefetch] Add UMA histogram to count prefetch requests (Closed)
Patch Set: Rebase Created 4 years, 3 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
« 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/threading/thread_checker.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "chrome/browser/prerender/prerender_contents.h" 16 #include "chrome/browser/prerender/prerender_contents.h"
16 #include "chrome/browser/prerender/prerender_final_status.h" 17 #include "chrome/browser/prerender/prerender_final_status.h"
17 #include "chrome/browser/prerender/prerender_origin.h" 18 #include "chrome/browser/prerender/prerender_origin.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 namespace prerender { 21 namespace prerender {
21 22
22 // Navigation type for histograms. 23 // Navigation type for histograms.
23 enum NavigationType { 24 enum NavigationType {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Record the time since a page was recently visited. 99 // Record the time since a page was recently visited.
99 void RecordTimeSinceLastRecentVisit(Origin origin, 100 void RecordTimeSinceLastRecentVisit(Origin origin,
100 base::TimeDelta time) const; 101 base::TimeDelta time) const;
101 102
102 // Record the bytes in the prerender, whether it was used or not, and the 103 // Record the bytes in the prerender, whether it was used or not, and the
103 // total number of bytes fetched for this profile since the last call to 104 // total number of bytes fetched for this profile since the last call to
104 // RecordBytes. 105 // RecordBytes.
105 void RecordNetworkBytes(Origin origin, 106 void RecordNetworkBytes(Origin origin,
106 bool used, 107 bool used,
107 int64_t prerender_bytes, 108 int64_t prerender_bytes,
108 int64_t profile_bytes); 109 int64_t profile_bytes) const;
110
111 // Record resources loaded by NoStatePrefetch.
112 void RecordResourcePrefetch(Origin origin,
113 bool is_main_resource,
114 bool is_no_store) const;
109 115
110 private: 116 private:
111 base::TimeTicks GetCurrentTimeTicks() const; 117 base::TimeTicks GetCurrentTimeTicks() const;
112 118
113 // Returns the time elapsed since the last prerender happened. 119 // Returns the time elapsed since the last prerender happened.
114 base::TimeDelta GetTimeSinceLastPrerender() const; 120 base::TimeDelta GetTimeSinceLastPrerender() const;
115 121
116 // Returns whether the PrerenderManager is currently within the prerender 122 // Returns whether the PrerenderManager is currently within the prerender
117 // window - effectively, up to 30 seconds after a prerender tag has been 123 // window - effectively, up to 30 seconds after a prerender tag has been
118 // observed. 124 // observed.
(...skipping 13 matching lines...) Expand all
132 // This is used to record perceived PLT's for a certain amount of time 138 // This is used to record perceived PLT's for a certain amount of time
133 // from the point that we last saw a <link rel=prerender> tag. 139 // from the point that we last saw a <link rel=prerender> tag.
134 base::TimeTicks last_prerender_seen_time_; 140 base::TimeTicks last_prerender_seen_time_;
135 141
136 // Indicates whether we have recorded page load events after the most 142 // Indicates whether we have recorded page load events after the most
137 // recent prerender. These must be initialized to true, so that we don't 143 // recent prerender. These must be initialized to true, so that we don't
138 // start recording events before the first prerender occurs. 144 // start recording events before the first prerender occurs.
139 bool seen_any_pageload_; 145 bool seen_any_pageload_;
140 bool seen_pageload_started_after_prerender_; 146 bool seen_pageload_started_after_prerender_;
141 147
148 base::ThreadChecker thread_checker_;
149
142 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms); 150 DISALLOW_COPY_AND_ASSIGN(PrerenderHistograms);
143 }; 151 };
144 152
145 } // namespace prerender 153 } // namespace prerender
146 154
147 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_HISTOGRAMS_H_ 155 #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