| 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_LOFI_PAGE_LOAD_METRICS_OBSERV
ER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_LOFI_PAGE_LOAD_METRICS_OBSERV
ER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_LOFI_PAGE_LOAD_METRICS_OBSERV
ER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_LOFI_PAGE_LOAD_METRICS_OBSERV
ER_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 namespace data_reduction_proxy { | 17 namespace data_reduction_proxy { |
| 23 | 18 |
| 24 namespace lofi_names { | 19 namespace lofi_names { |
| 25 | 20 |
| 26 extern const char kNavigationToLoadEvent[]; | 21 extern const char kNavigationToLoadEvent[]; |
| 27 extern const char kNavigationToFirstContentfulPaint[]; | 22 extern const char kNavigationToFirstContentfulPaint[]; |
| 28 extern const char kNavigationToFirstMeaningfulPaint[]; | 23 extern const char kNavigationToFirstMeaningfulPaint[]; |
| 29 extern const char kNavigationToFirstImagePaint[]; | 24 extern const char kNavigationToFirstImagePaint[]; |
| 30 extern const char kParseBlockedOnScriptLoad[]; | 25 extern const char kParseBlockedOnScriptLoad[]; |
| 31 extern const char kParseDuration[]; | 26 extern const char kParseDuration[]; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 : public page_load_metrics::PageLoadMetricsObserver { | 39 : public page_load_metrics::PageLoadMetricsObserver { |
| 45 public: | 40 public: |
| 46 LoFiPageLoadMetricsObserver(); | 41 LoFiPageLoadMetricsObserver(); |
| 47 ~LoFiPageLoadMetricsObserver() override; | 42 ~LoFiPageLoadMetricsObserver() override; |
| 48 | 43 |
| 49 // page_load_metrics::PageLoadMetricsObserver: | 44 // page_load_metrics::PageLoadMetricsObserver: |
| 50 ObservePolicy OnStart(content::NavigationHandle* navigation_handle, | 45 ObservePolicy OnStart(content::NavigationHandle* navigation_handle, |
| 51 const GURL& currently_committed_url, | 46 const GURL& currently_committed_url, |
| 52 bool started_in_foreground) override; | 47 bool started_in_foreground) override; |
| 53 ObservePolicy FlushMetricsOnAppEnterBackground( | 48 ObservePolicy FlushMetricsOnAppEnterBackground( |
| 54 const page_load_metrics::PageLoadTiming& timing, | 49 const page_load_metrics::mojom::PageLoadTiming& timing, |
| 55 const page_load_metrics::PageLoadExtraInfo& info) override; | 50 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 56 void OnComplete(const page_load_metrics::PageLoadTiming& timing, | 51 void OnComplete(const page_load_metrics::mojom::PageLoadTiming& timing, |
| 57 const page_load_metrics::PageLoadExtraInfo& info) override; | 52 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 58 void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& | 53 void OnLoadedResource(const page_load_metrics::ExtraRequestCompleteInfo& |
| 59 extra_request_complete_info) override; | 54 extra_request_complete_info) override; |
| 60 | 55 |
| 61 private: | 56 private: |
| 62 void RecordTimingMetrics(const page_load_metrics::PageLoadTiming& timing, | 57 void RecordTimingMetrics( |
| 63 const page_load_metrics::PageLoadExtraInfo& info); | 58 const page_load_metrics::mojom::PageLoadTiming& timing, |
| 59 const page_load_metrics::PageLoadExtraInfo& info); |
| 64 | 60 |
| 65 // Records UMA of page size when the observer is about to be deleted. | 61 // Records UMA of page size when the observer is about to be deleted. |
| 66 void RecordPageSizeUMA() const; | 62 void RecordPageSizeUMA() const; |
| 67 | 63 |
| 68 int64_t num_network_resources_; | 64 int64_t num_network_resources_; |
| 69 int64_t num_network_lofi_resources_; | 65 int64_t num_network_lofi_resources_; |
| 70 int64_t original_network_bytes_; | 66 int64_t original_network_bytes_; |
| 71 int64_t network_bytes_; | 67 int64_t network_bytes_; |
| 72 int64_t lofi_network_bytes_; | 68 int64_t lofi_network_bytes_; |
| 73 | 69 |
| 74 DISALLOW_COPY_AND_ASSIGN(LoFiPageLoadMetricsObserver); | 70 DISALLOW_COPY_AND_ASSIGN(LoFiPageLoadMetricsObserver); |
| 75 }; | 71 }; |
| 76 | 72 |
| 77 } // namespace data_reduction_proxy | 73 } // namespace data_reduction_proxy |
| 78 | 74 |
| 79 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_LOFI_PAGE_LOAD_METRICS_OBS
ERVER_H_ | 75 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_LOFI_PAGE_LOAD_METRICS_OBS
ERVER_H_ |
| OLD | NEW |