| OLD | NEW |
| 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 Loading... |
| 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()); | |
| 204 return committed_url_; | |
| 205 } | |
| 206 | 203 |
| 207 base::TimeTicks navigation_start() const { return navigation_start_; } | 204 base::TimeTicks navigation_start() const { return navigation_start_; } |
| 208 | 205 |
| 209 PageLoadExtraInfo ComputePageLoadExtraInfo(); | 206 PageLoadExtraInfo ComputePageLoadExtraInfo(); |
| 210 | 207 |
| 211 ui::PageTransition page_transition() const { return page_transition_; } | 208 ui::PageTransition page_transition() const { return page_transition_; } |
| 212 | 209 |
| 213 UserInitiatedInfo user_initiated_info() const { return user_initiated_info_; } | 210 UserInitiatedInfo user_initiated_info() const { return user_initiated_info_; } |
| 214 | 211 |
| 215 UserInputTracker* input_tracker() { return &input_tracker_; } | 212 UserInputTracker* input_tracker() { return &input_tracker_; } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 234 void UpdateAbortInternal(UserAbortType abort_type, | 231 void UpdateAbortInternal(UserAbortType abort_type, |
| 235 UserInitiatedInfo user_initiated_info, | 232 UserInitiatedInfo user_initiated_info, |
| 236 base::TimeTicks timestamp, | 233 base::TimeTicks timestamp, |
| 237 bool is_certainly_browser_timestamp); | 234 bool is_certainly_browser_timestamp); |
| 238 | 235 |
| 239 // If |final_navigation| is null, then this is an "unparented" abort chain, | 236 // 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 | 237 // and represents a sequence of provisional aborts that never ends with a |
| 241 // committed load. | 238 // committed load. |
| 242 void LogAbortChainHistograms(content::NavigationHandle* final_navigation); | 239 void LogAbortChainHistograms(content::NavigationHandle* final_navigation); |
| 243 | 240 |
| 241 void MaybeUpdateURL(content::NavigationHandle* navigation_handle); |
| 242 |
| 244 UserInputTracker input_tracker_; | 243 UserInputTracker input_tracker_; |
| 245 | 244 |
| 246 // Whether we stopped tracking this navigation after it was initiated. We may | 245 // 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 | 246 // stop tracking a navigation if it doesn't meet the criteria for tracking |
| 248 // metrics in DidFinishNavigation. | 247 // metrics in DidFinishNavigation. |
| 249 bool did_stop_tracking_; | 248 bool did_stop_tracking_; |
| 250 | 249 |
| 251 // Whether the application went into the background when this PageLoadTracker | 250 // Whether the application went into the background when this PageLoadTracker |
| 252 // was active. This is a temporary boolean for UMA tracking. | 251 // was active. This is a temporary boolean for UMA tracking. |
| 253 bool app_entered_background_; | 252 bool app_entered_background_; |
| 254 | 253 |
| 255 // The navigation start in TimeTicks, not the wall time reported by Blink. | 254 // The navigation start in TimeTicks, not the wall time reported by Blink. |
| 256 const base::TimeTicks navigation_start_; | 255 const base::TimeTicks navigation_start_; |
| 257 | 256 |
| 258 // The committed URL of this page load. | 257 // The most recent URL of this page load. Updated at navigation start, upon |
| 259 GURL committed_url_; | 258 // redirection, and at commit time. |
| 259 GURL url_; |
| 260 | 260 |
| 261 // The start URL for this page load (before redirects). | 261 // The start URL for this page load (before redirects). |
| 262 GURL start_url_; | 262 GURL start_url_; |
| 263 | 263 |
| 264 // Whether this page load committed. |
| 265 bool did_commit_; |
| 266 |
| 264 std::unique_ptr<FailedProvisionalLoadInfo> failed_provisional_load_info_; | 267 std::unique_ptr<FailedProvisionalLoadInfo> failed_provisional_load_info_; |
| 265 | 268 |
| 266 // Will be ABORT_NONE if we have not aborted this load yet. Otherwise will | 269 // Will be ABORT_NONE if we have not aborted this load yet. Otherwise will |
| 267 // be the first abort action the user performed. | 270 // be the first abort action the user performed. |
| 268 UserAbortType abort_type_; | 271 UserAbortType abort_type_; |
| 269 | 272 |
| 270 // Whether the abort for this page load was user initiated. For example, if | 273 // 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 | 274 // 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 | 275 // 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 | 276 // 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 Loading... |
| 312 PageLoadMetricsEmbedderInterface* const embedder_interface_; | 315 PageLoadMetricsEmbedderInterface* const embedder_interface_; |
| 313 | 316 |
| 314 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; | 317 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; |
| 315 | 318 |
| 316 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 319 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
| 317 }; | 320 }; |
| 318 | 321 |
| 319 } // namespace page_load_metrics | 322 } // namespace page_load_metrics |
| 320 | 323 |
| 321 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ | 324 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ |
| OLD | NEW |