| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // These errors are internal to the page_load_metrics subsystem and do not | 48 // These errors are internal to the page_load_metrics subsystem and do not |
| 49 // reflect actual errors that occur during a page load. | 49 // reflect actual errors that occur during a page load. |
| 50 // | 50 // |
| 51 // If you add elements to this enum, make sure you update the enum | 51 // If you add elements to this enum, make sure you update the enum |
| 52 // value in histograms.xml. Only add elements to the end to prevent | 52 // value in histograms.xml. Only add elements to the end to prevent |
| 53 // inconsistencies between versions. | 53 // inconsistencies between versions. |
| 54 enum InternalErrorLoadEvent { | 54 enum InternalErrorLoadEvent { |
| 55 // A timing IPC was sent from the renderer that did not line up with previous | 55 // A timing IPC was sent from the renderer that did not line up with previous |
| 56 // data we've received (i.e. navigation start is different or the timing | 56 // data we've received (i.e. navigation start is different or the timing |
| 57 // struct is somehow invalid). This error can only occur once the IPC is | 57 // struct is somehow invalid). This error can only occur once the IPC is |
| 58 // vetted in other ways (see other errors). | 58 // vetted in other ways (see other errors). This error is deprecated as it has |
| 59 ERR_BAD_TIMING_IPC, | 59 // been replaced by the more detailed ERR_BAD_TIMING_IPC_* error codes. |
| 60 DEPRECATED_ERR_BAD_TIMING_IPC, |
| 60 | 61 |
| 61 // The following IPCs are not mutually exclusive. | 62 // The following IPCs are not mutually exclusive. |
| 62 // | 63 // |
| 63 // We received an IPC when we weren't tracking a committed load. This will | 64 // We received an IPC when we weren't tracking a committed load. This will |
| 64 // often happen if we get an IPC from a bad URL scheme (that is, the renderer | 65 // often happen if we get an IPC from a bad URL scheme (that is, the renderer |
| 65 // sent us an IPC from a navigation we don't care about). | 66 // sent us an IPC from a navigation we don't care about). |
| 66 ERR_IPC_WITH_NO_RELEVANT_LOAD, | 67 ERR_IPC_WITH_NO_RELEVANT_LOAD, |
| 67 | 68 |
| 68 // Received a notification from a frame that has been navigated away from. | 69 // Received a notification from a frame that has been navigated away from. |
| 69 ERR_IPC_FROM_WRONG_FRAME, | 70 ERR_IPC_FROM_WRONG_FRAME, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // At the time a PageLoadTracker was destroyed, we had received neither a | 105 // At the time a PageLoadTracker was destroyed, we had received neither a |
| 105 // commit nor a failed provisional load. | 106 // commit nor a failed provisional load. |
| 106 ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD, | 107 ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD, |
| 107 | 108 |
| 108 // No page load end time was recorded for this page load. | 109 // No page load end time was recorded for this page load. |
| 109 ERR_NO_PAGE_LOAD_END_TIME, | 110 ERR_NO_PAGE_LOAD_END_TIME, |
| 110 | 111 |
| 111 // Received a timing update from a subframe. | 112 // Received a timing update from a subframe. |
| 112 ERR_TIMING_IPC_FROM_SUBFRAME, | 113 ERR_TIMING_IPC_FROM_SUBFRAME, |
| 113 | 114 |
| 115 // A timing IPC was sent from the renderer that contained timing data which |
| 116 // was inconsistent with our timing data for the currently committed load. |
| 117 ERR_BAD_TIMING_IPC_INVALID_TIMING_DESCENDENT, |
| 118 |
| 119 // A timing IPC was sent from the renderer that contained loading behavior |
| 120 // data which was inconsistent with our loading behavior data for the |
| 121 // currently committed load. |
| 122 ERR_BAD_TIMING_IPC_INVALID_BEHAVIOR_DESCENDENT, |
| 123 |
| 124 // A timing IPC was sent from the renderer that contained invalid timing data |
| 125 // (e.g. out of order timings, or other issues). |
| 126 ERR_BAD_TIMING_IPC_INVALID_TIMING, |
| 127 |
| 114 // Add values before this final count. | 128 // Add values before this final count. |
| 115 ERR_LAST_ENTRY, | 129 ERR_LAST_ENTRY, |
| 116 }; | 130 }; |
| 117 | 131 |
| 118 // NOTE: these functions are shared by page_load_tracker.cc and | 132 // NOTE: these functions are shared by page_load_tracker.cc and |
| 119 // metrics_web_contents_observer.cc. They are declared here to allow both files | 133 // metrics_web_contents_observer.cc. They are declared here to allow both files |
| 120 // to access them. | 134 // to access them. |
| 121 void RecordInternalError(InternalErrorLoadEvent event); | 135 void RecordInternalError(InternalErrorLoadEvent event); |
| 122 PageEndReason EndReasonForPageTransition(ui::PageTransition transition); | 136 PageEndReason EndReasonForPageTransition(ui::PageTransition transition); |
| 123 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url); | 137 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 153 void OnInputEvent(const blink::WebInputEvent& event); | 167 void OnInputEvent(const blink::WebInputEvent& event); |
| 154 | 168 |
| 155 // Flush any buffered metrics, as part of the metrics subsystem persisting | 169 // Flush any buffered metrics, as part of the metrics subsystem persisting |
| 156 // metrics as the application goes into the background. The application may be | 170 // metrics as the application goes into the background. The application may be |
| 157 // killed at any time after this method is invoked without further | 171 // killed at any time after this method is invoked without further |
| 158 // notification. | 172 // notification. |
| 159 void FlushMetricsOnAppEnterBackground(); | 173 void FlushMetricsOnAppEnterBackground(); |
| 160 | 174 |
| 161 void NotifyClientRedirectTo(const PageLoadTracker& destination); | 175 void NotifyClientRedirectTo(const PageLoadTracker& destination); |
| 162 | 176 |
| 163 // Returns true if the timing was successfully updated. | 177 void UpdateTiming(const PageLoadTiming& timing, |
| 164 bool UpdateTiming(const PageLoadTiming& timing, | |
| 165 const PageLoadMetadata& metadata); | 178 const PageLoadMetadata& metadata); |
| 166 | 179 |
| 167 // Update metadata for child frames. Updates for child frames arrive | 180 // Update metadata for child frames. Updates for child frames arrive |
| 168 // separately from updates for the main frame, so aren't included in | 181 // separately from updates for the main frame, so aren't included in |
| 169 // UpdateTiming. | 182 // UpdateTiming. |
| 170 void UpdateChildFrameMetadata(const PageLoadMetadata& child_metadata); | 183 void UpdateChildFrameMetadata(const PageLoadMetadata& child_metadata); |
| 171 | 184 |
| 172 void OnLoadedResource(const ExtraRequestInfo& extra_request_info); | 185 void OnLoadedResource(const ExtraRequestInfo& extra_request_info); |
| 173 | 186 |
| 174 // Signals that we should stop tracking metrics for the associated page load. | 187 // Signals that we should stop tracking metrics for the associated page load. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 PageLoadMetricsEmbedderInterface* const embedder_interface_; | 347 PageLoadMetricsEmbedderInterface* const embedder_interface_; |
| 335 | 348 |
| 336 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; | 349 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; |
| 337 | 350 |
| 338 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 351 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
| 339 }; | 352 }; |
| 340 | 353 |
| 341 } // namespace page_load_metrics | 354 } // namespace page_load_metrics |
| 342 | 355 |
| 343 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ | 356 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ |
| OLD | NEW |