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

Side by Side Diff: components/page_load_metrics/browser/metrics_web_contents_observer.h

Issue 1433533007: [page_load_metrics] Get navigation_start from NavigationHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@change-names-refactor
Patch Set: navigation_start => NavigationStart Created 5 years, 1 month 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 | components/page_load_metrics/browser/metrics_web_contents_observer.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE RVER_H_ 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE RVER_H_
6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE RVER_H_ 6 #define COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_OBSE RVER_H_
7 7
8 #include "base/containers/scoped_ptr_map.h" 8 #include "base/containers/scoped_ptr_map.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // provisional load, until a new navigation commits or the navigation fails. It 188 // provisional load, until a new navigation commits or the navigation fails. It
189 // also records RAPPOR/UMA about the page load. 189 // also records RAPPOR/UMA about the page load.
190 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as 190 // MetricsWebContentsObserver manages a set of provisional PageLoadTrackers, as
191 // well as a committed PageLoadTracker. 191 // well as a committed PageLoadTracker.
192 class PageLoadTracker { 192 class PageLoadTracker {
193 public: 193 public:
194 // Caller must guarantee that the observers and embedder_interface pointers 194 // Caller must guarantee that the observers and embedder_interface pointers
195 // outlives this class. 195 // outlives this class.
196 PageLoadTracker(bool in_foreground, 196 PageLoadTracker(bool in_foreground,
197 PageLoadMetricsEmbedderInterface* embedder_interface, 197 PageLoadMetricsEmbedderInterface* embedder_interface,
198 content::NavigationHandle* navigation_handle,
198 base::ObserverList<PageLoadMetricsObserver, true>* observers); 199 base::ObserverList<PageLoadMetricsObserver, true>* observers);
199 ~PageLoadTracker(); 200 ~PageLoadTracker();
200 void Commit(content::NavigationHandle* navigation_handle); 201 void Commit(content::NavigationHandle* navigation_handle);
201 void WebContentsHidden(); 202 void WebContentsHidden();
202 void WebContentsShown(); 203 void WebContentsShown();
203 204
204 // Returns true if the timing was successfully updated. 205 // Returns true if the timing was successfully updated.
205 bool UpdateTiming(const PageLoadTiming& timing); 206 bool UpdateTiming(const PageLoadTiming& timing);
206 void RecordProvisionalEvent(ProvisionalLoadEvent event); 207 void RecordProvisionalEvent(ProvisionalLoadEvent event);
207 void RecordCommittedEvent(CommittedLoadEvent event, bool backgrounded); 208 void RecordCommittedEvent(CommittedLoadEvent event, bool backgrounded);
208 bool HasBackgrounded(); 209 bool HasBackgrounded();
209 210
210 private: 211 private:
211 PageLoadExtraInfo GetPageLoadMetricsInfo(); 212 PageLoadExtraInfo GetPageLoadMetricsInfo();
212 // Only valid to call post-commit. 213 // Only valid to call post-commit.
213 const GURL& GetCommittedURL(); 214 const GURL& GetCommittedURL();
214 215
215 base::TimeDelta GetBackgroundDelta(); 216 base::TimeDelta GetBackgroundDelta();
216 void RecordTimingHistograms(); 217 void RecordTimingHistograms();
217 void RecordRappor(); 218 void RecordRappor();
218 219
219 bool has_commit_; 220 bool has_commit_;
220 221
222 // The navigation start in TimeTicks, not the wall time reported by Blink.
223 const base::TimeTicks navigation_start_;
224
221 // We record separate metrics for events that occur after a background, 225 // We record separate metrics for events that occur after a background,
222 // because metrics like layout/paint are delayed artificially 226 // because metrics like layout/paint are delayed artificially
223 // when they occur in the background. 227 // when they occur in the background.
224 base::TimeTicks background_time_; 228 base::TimeTicks background_time_;
225 base::TimeTicks foreground_time_; 229 base::TimeTicks foreground_time_;
226 bool started_in_foreground_; 230 bool started_in_foreground_;
227 231
228 PageLoadTiming timing_; 232 PageLoadTiming timing_;
229 GURL url_; 233 GURL url_;
230 234
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 293
290 scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_; 294 scoped_ptr<PageLoadMetricsEmbedderInterface> embedder_interface_;
291 base::ObserverList<PageLoadMetricsObserver, true> observers_; 295 base::ObserverList<PageLoadMetricsObserver, true> observers_;
292 296
293 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver); 297 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserver);
294 }; 298 };
295 299
296 } // namespace page_load_metrics 300 } // namespace page_load_metrics
297 301
298 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O BSERVER_H_ 302 #endif // COMPONENTS_PAGE_LOAD_METRICS_BROWSER_PAGE_LOAD_METRICS_WEB_CONTENTS_O BSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | components/page_load_metrics/browser/metrics_web_contents_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698