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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 // renderer process and the system clock has inter process time tick skew. | 100 // renderer process and the system clock has inter process time tick skew. |
101 ERR_INTER_PROCESS_TIME_TICK_SKEW, | 101 ERR_INTER_PROCESS_TIME_TICK_SKEW, |
102 | 102 |
103 // At the time a PageLoadTracker was destroyed, we had received neither a | 103 // At the time a PageLoadTracker was destroyed, we had received neither a |
104 // commit nor a failed provisional load. | 104 // commit nor a failed provisional load. |
105 ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD, | 105 ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD, |
106 | 106 |
107 // No page load end time was recorded for this page load. | 107 // No page load end time was recorded for this page load. |
108 ERR_NO_PAGE_LOAD_END_TIME, | 108 ERR_NO_PAGE_LOAD_END_TIME, |
109 | 109 |
110 // Received a timing update from a subframe. | |
111 ERR_TIMING_IPC_FROM_SUBFRAME, | |
112 | |
110 // Add values before this final count. | 113 // Add values before this final count. |
111 ERR_LAST_ENTRY, | 114 ERR_LAST_ENTRY, |
112 }; | 115 }; |
113 | 116 |
114 // NOTE: these functions are shared by page_load_tracker.cc and | 117 // NOTE: these functions are shared by page_load_tracker.cc and |
115 // metrics_web_contents_observer.cc. They are declared here to allow both files | 118 // metrics_web_contents_observer.cc. They are declared here to allow both files |
116 // to access them. | 119 // to access them. |
117 void RecordInternalError(InternalErrorLoadEvent event); | 120 void RecordInternalError(InternalErrorLoadEvent event); |
118 PageEndReason EndReasonForPageTransition(ui::PageTransition transition); | 121 PageEndReason EndReasonForPageTransition(ui::PageTransition transition); |
119 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url); | 122 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 // killed at any time after this method is invoked without further | 156 // killed at any time after this method is invoked without further |
154 // notification. | 157 // notification. |
155 void FlushMetricsOnAppEnterBackground(); | 158 void FlushMetricsOnAppEnterBackground(); |
156 | 159 |
157 void NotifyClientRedirectTo(const PageLoadTracker& destination); | 160 void NotifyClientRedirectTo(const PageLoadTracker& destination); |
158 | 161 |
159 // Returns true if the timing was successfully updated. | 162 // Returns true if the timing was successfully updated. |
160 bool UpdateTiming(const PageLoadTiming& timing, | 163 bool UpdateTiming(const PageLoadTiming& timing, |
161 const PageLoadMetadata& metadata); | 164 const PageLoadMetadata& metadata); |
162 | 165 |
166 void UpdateChildMetadata(const PageLoadMetadata& child_metadata); | |
Charlie Harrison
2017/03/09 16:21:29
I think it deserves a comment for why this is sepa
Bryan McQuade
2017/03/09 17:36:32
good idea, done
| |
167 | |
163 void OnLoadedResource(const ExtraRequestInfo& extra_request_info); | 168 void OnLoadedResource(const ExtraRequestInfo& extra_request_info); |
164 | 169 |
165 // Signals that we should stop tracking metrics for the associated page load. | 170 // Signals that we should stop tracking metrics for the associated page load. |
166 // We may stop tracking a page load if it doesn't meet the criteria for | 171 // We may stop tracking a page load if it doesn't meet the criteria for |
167 // tracking metrics in DidFinishNavigation. | 172 // tracking metrics in DidFinishNavigation. |
168 void StopTracking(); | 173 void StopTracking(); |
169 | 174 |
170 int aborted_chain_size() const { return aborted_chain_size_; } | 175 int aborted_chain_size() const { return aborted_chain_size_; } |
171 int aborted_chain_size_same_url() const { | 176 int aborted_chain_size_same_url() const { |
172 return aborted_chain_size_same_url_; | 177 return aborted_chain_size_same_url_; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
287 base::TimeTicks page_end_time_; | 292 base::TimeTicks page_end_time_; |
288 | 293 |
289 // We record separate metrics for events that occur after a background, | 294 // We record separate metrics for events that occur after a background, |
290 // because metrics like layout/paint are delayed artificially | 295 // because metrics like layout/paint are delayed artificially |
291 // when they occur in the background. | 296 // when they occur in the background. |
292 base::TimeTicks background_time_; | 297 base::TimeTicks background_time_; |
293 base::TimeTicks foreground_time_; | 298 base::TimeTicks foreground_time_; |
294 bool started_in_foreground_; | 299 bool started_in_foreground_; |
295 | 300 |
296 PageLoadTiming timing_; | 301 PageLoadTiming timing_; |
297 PageLoadMetadata metadata_; | 302 PageLoadMetadata main_frame_metadata_; |
303 PageLoadMetadata child_frame_metadata_; | |
298 | 304 |
299 ui::PageTransition page_transition_; | 305 ui::PageTransition page_transition_; |
300 | 306 |
301 base::Optional<content::GlobalRequestID> navigation_request_id_; | 307 base::Optional<content::GlobalRequestID> navigation_request_id_; |
302 | 308 |
303 // Whether this page load was user initiated. | 309 // Whether this page load was user initiated. |
304 UserInitiatedInfo user_initiated_info_; | 310 UserInitiatedInfo user_initiated_info_; |
305 | 311 |
306 // This is a subtle member. If a provisional load A gets aborted by | 312 // This is a subtle member. If a provisional load A gets aborted by |
307 // provisional load B, which gets aborted by C that eventually commits, then | 313 // provisional load B, which gets aborted by C that eventually commits, then |
(...skipping 11 matching lines...) Expand all Loading... | |
319 PageLoadMetricsEmbedderInterface* const embedder_interface_; | 325 PageLoadMetricsEmbedderInterface* const embedder_interface_; |
320 | 326 |
321 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; | 327 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; |
322 | 328 |
323 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 329 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
324 }; | 330 }; |
325 | 331 |
326 } // namespace page_load_metrics | 332 } // namespace page_load_metrics |
327 | 333 |
328 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ | 334 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ |
OLD | NEW |