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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_tracker.h

Issue 2692373003: Refactor PageLoadExtraInfo::committed_url to url and did_commit fields. (Closed)
Patch Set: fix test Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 // This method returns true if this page load has been aborted with type of 192 // This method returns true if this page load has been aborted with type of
193 // ABORT_OTHER, and the |abort_cause_time| is within a sufficiently close 193 // ABORT_OTHER, and the |abort_cause_time| is within a sufficiently close
194 // delta to when it was aborted. Note that only provisional loads can be 194 // delta to when it was aborted. Note that only provisional loads can be
195 // aborted with ABORT_OTHER. While this heuristic is coarse, it works better 195 // aborted with ABORT_OTHER. While this heuristic is coarse, it works better
196 // and is simpler than other feasible methods. See https://goo.gl/WKRG98. 196 // and is simpler than other feasible methods. See https://goo.gl/WKRG98.
197 bool IsLikelyProvisionalAbort(base::TimeTicks abort_cause_time) const; 197 bool IsLikelyProvisionalAbort(base::TimeTicks abort_cause_time) const;
198 198
199 bool MatchesOriginalNavigation(content::NavigationHandle* navigation_handle); 199 bool MatchesOriginalNavigation(content::NavigationHandle* navigation_handle);
200 200
201 // Only valid to call post-commit. 201 bool did_commit() const { return did_commit_; }
202 const GURL& committed_url() const { 202 const GURL& url() const { return url_; }
203 DCHECK(!committed_url_.is_empty()); 203 const GURL& start_url() const {
jkarlin 2017/02/15 19:55:36 With suggestion in .cc file this function can be r
Bryan McQuade 2017/02/15 20:27:10 Thanks! Removed.
204 return committed_url_; 204 return start_url_.is_empty() ? url_ : start_url_;
205 } 205 }
206 206
207 base::TimeTicks navigation_start() const { return navigation_start_; } 207 base::TimeTicks navigation_start() const { return navigation_start_; }
208 208
209 PageLoadExtraInfo ComputePageLoadExtraInfo(); 209 PageLoadExtraInfo ComputePageLoadExtraInfo();
210 210
211 ui::PageTransition page_transition() const { return page_transition_; } 211 ui::PageTransition page_transition() const { return page_transition_; }
212 212
213 UserInitiatedInfo user_initiated_info() const { return user_initiated_info_; } 213 UserInitiatedInfo user_initiated_info() const { return user_initiated_info_; }
214 214
(...skipping 19 matching lines...) Expand all
234 void UpdateAbortInternal(UserAbortType abort_type, 234 void UpdateAbortInternal(UserAbortType abort_type,
235 UserInitiatedInfo user_initiated_info, 235 UserInitiatedInfo user_initiated_info,
236 base::TimeTicks timestamp, 236 base::TimeTicks timestamp,
237 bool is_certainly_browser_timestamp); 237 bool is_certainly_browser_timestamp);
238 238
239 // If |final_navigation| is null, then this is an "unparented" abort chain, 239 // If |final_navigation| is null, then this is an "unparented" abort chain,
240 // and represents a sequence of provisional aborts that never ends with a 240 // and represents a sequence of provisional aborts that never ends with a
241 // committed load. 241 // committed load.
242 void LogAbortChainHistograms(content::NavigationHandle* final_navigation); 242 void LogAbortChainHistograms(content::NavigationHandle* final_navigation);
243 243
244 void MaybeUpdateURL(content::NavigationHandle* navigation_handle);
245
244 UserInputTracker input_tracker_; 246 UserInputTracker input_tracker_;
245 247
246 // Whether we stopped tracking this navigation after it was initiated. We may 248 // Whether we stopped tracking this navigation after it was initiated. We may
247 // stop tracking a navigation if it doesn't meet the criteria for tracking 249 // stop tracking a navigation if it doesn't meet the criteria for tracking
248 // metrics in DidFinishNavigation. 250 // metrics in DidFinishNavigation.
249 bool did_stop_tracking_; 251 bool did_stop_tracking_;
250 252
251 // Whether the application went into the background when this PageLoadTracker 253 // Whether the application went into the background when this PageLoadTracker
252 // was active. This is a temporary boolean for UMA tracking. 254 // was active. This is a temporary boolean for UMA tracking.
253 bool app_entered_background_; 255 bool app_entered_background_;
254 256
255 // The navigation start in TimeTicks, not the wall time reported by Blink. 257 // The navigation start in TimeTicks, not the wall time reported by Blink.
256 const base::TimeTicks navigation_start_; 258 const base::TimeTicks navigation_start_;
257 259
258 // The committed URL of this page load. 260 // The most recent URL of this page load. Updated at navigation start, upon
259 GURL committed_url_; 261 // redirection, and at commit time.
262 GURL url_;
260 263
261 // The start URL for this page load (before redirects). 264 // The start URL for this page load (before redirects), if different from
265 // |url_|.
262 GURL start_url_; 266 GURL start_url_;
263 267
268 // Whether this page load committed.
269 bool did_commit_;
270
264 std::unique_ptr<FailedProvisionalLoadInfo> failed_provisional_load_info_; 271 std::unique_ptr<FailedProvisionalLoadInfo> failed_provisional_load_info_;
265 272
266 // Will be ABORT_NONE if we have not aborted this load yet. Otherwise will 273 // Will be ABORT_NONE if we have not aborted this load yet. Otherwise will
267 // be the first abort action the user performed. 274 // be the first abort action the user performed.
268 UserAbortType abort_type_; 275 UserAbortType abort_type_;
269 276
270 // Whether the abort for this page load was user initiated. For example, if 277 // Whether the abort for this page load was user initiated. For example, if
271 // this page load was aborted by a new navigation, this field tracks whether 278 // this page load was aborted by a new navigation, this field tracks whether
272 // that new navigation was user-initiated. This field is only useful if this 279 // that new navigation was user-initiated. This field is only useful if this
273 // page load's abort type is a value other than ABORT_NONE. Note that this 280 // page load's abort type is a value other than ABORT_NONE. Note that this
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 PageLoadMetricsEmbedderInterface* const embedder_interface_; 319 PageLoadMetricsEmbedderInterface* const embedder_interface_;
313 320
314 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; 321 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_;
315 322
316 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); 323 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker);
317 }; 324 };
318 325
319 } // namespace page_load_metrics 326 } // namespace page_load_metrics
320 327
321 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 328 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698