| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_OBSERVERS_TAB_RESTORE_PAGE_LOAD_METRICS
_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_TAB_RESTORE_PAGE_LOAD_METRICS
_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_TAB_RESTORE_PAGE_LOAD_METRICS
_OBSERVER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_TAB_RESTORE_PAGE_LOAD_METRICS
_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" | 11 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class NavigationHandle; | 14 class NavigationHandle; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace page_load_metrics { | |
| 18 struct PageLoadExtraInfo; | |
| 19 struct PageLoadTiming; | |
| 20 } | |
| 21 | |
| 22 // Observer responsible for recording core page load metrics relevant to | 17 // Observer responsible for recording core page load metrics relevant to |
| 23 // restored tabs. | 18 // restored tabs. |
| 24 class TabRestorePageLoadMetricsObserver | 19 class TabRestorePageLoadMetricsObserver |
| 25 : public page_load_metrics::PageLoadMetricsObserver { | 20 : public page_load_metrics::PageLoadMetricsObserver { |
| 26 public: | 21 public: |
| 27 TabRestorePageLoadMetricsObserver(); | 22 TabRestorePageLoadMetricsObserver(); |
| 28 ~TabRestorePageLoadMetricsObserver() override; | 23 ~TabRestorePageLoadMetricsObserver() override; |
| 29 | 24 |
| 30 // page_load_metrics::PageLoadMetricsObserver: | 25 // page_load_metrics::PageLoadMetricsObserver: |
| 31 void OnComplete(const page_load_metrics::PageLoadTiming& timing, | 26 void OnComplete(const page_load_metrics::mojom::PageLoadTiming& timing, |
| 32 const page_load_metrics::PageLoadExtraInfo& info) override; | 27 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 33 page_load_metrics::PageLoadMetricsObserver::ObservePolicy OnStart( | 28 page_load_metrics::PageLoadMetricsObserver::ObservePolicy OnStart( |
| 34 content::NavigationHandle* navigation_handle, | 29 content::NavigationHandle* navigation_handle, |
| 35 const GURL& currently_committed_url, | 30 const GURL& currently_committed_url, |
| 36 bool started_in_foreground) override; | 31 bool started_in_foreground) override; |
| 37 void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& | 32 void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& |
| 38 extra_request_complete_info) override; | 33 extra_request_complete_info) override; |
| 39 page_load_metrics::PageLoadMetricsObserver::ObservePolicy | 34 page_load_metrics::PageLoadMetricsObserver::ObservePolicy |
| 40 FlushMetricsOnAppEnterBackground( | 35 FlushMetricsOnAppEnterBackground( |
| 41 const page_load_metrics::PageLoadTiming& timing, | 36 const page_load_metrics::mojom::PageLoadTiming& timing, |
| 42 const page_load_metrics::PageLoadExtraInfo& info) override; | 37 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 43 | 38 |
| 44 protected: | 39 protected: |
| 45 // Whether the navigation handle is a tab restore. | 40 // Whether the navigation handle is a tab restore. |
| 46 // Overridden in testing. | 41 // Overridden in testing. |
| 47 virtual bool IsTabRestore(content::NavigationHandle* navigation_handle); | 42 virtual bool IsTabRestore(content::NavigationHandle* navigation_handle); |
| 48 | 43 |
| 49 private: | 44 private: |
| 50 // Records histograms for byte information. | 45 // Records histograms for byte information. |
| 51 void RecordByteHistograms(); | 46 void RecordByteHistograms(); |
| 52 | 47 |
| 53 // The number of body (not header) prefilter bytes consumed by requests for | 48 // The number of body (not header) prefilter bytes consumed by requests for |
| 54 // the page. | 49 // the page. |
| 55 int64_t cache_bytes_; | 50 int64_t cache_bytes_; |
| 56 int64_t network_bytes_; | 51 int64_t network_bytes_; |
| 57 | 52 |
| 58 DISALLOW_COPY_AND_ASSIGN(TabRestorePageLoadMetricsObserver); | 53 DISALLOW_COPY_AND_ASSIGN(TabRestorePageLoadMetricsObserver); |
| 59 }; | 54 }; |
| 60 | 55 |
| 61 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_TAB_RESTORE_PAGE_LOAD_METR
ICS_OBSERVER_H_ | 56 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_TAB_RESTORE_PAGE_LOAD_METR
ICS_OBSERVER_H_ |
| OLD | NEW |