Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_MEDIA_PAGE_LOAD_METRICS_OBSER VER_H_ | |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_MEDIA_PAGE_LOAD_METRICS_OBSER VER_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" | |
| 12 | |
| 13 namespace page_load_metrics { | |
| 14 struct PageLoadExtraInfo; | |
| 15 struct PageLoadTiming; | |
| 16 } | |
| 17 | |
| 18 // Observer responsible for recording metrics on pages that load at least one | |
| 19 // MEDIA request. | |
| 20 class MediaPageLoadMetricsObserver | |
| 21 : public page_load_metrics::PageLoadMetricsObserver { | |
| 22 public: | |
| 23 MediaPageLoadMetricsObserver(); | |
| 24 ~MediaPageLoadMetricsObserver() override; | |
| 25 | |
| 26 // page_load_metrics::PageLoadMetricsObserver: | |
| 27 void OnComplete(const page_load_metrics::PageLoadTiming& timing, | |
| 28 const page_load_metrics::PageLoadExtraInfo& info) override; | |
| 29 page_load_metrics::PageLoadMetricsObserver::ObservePolicy | |
| 30 FlushMetricsOnAppEnterBackground( | |
| 31 const page_load_metrics::PageLoadTiming& timing, | |
| 32 const page_load_metrics::PageLoadExtraInfo& info) override; | |
| 33 void OnLoadedResource( | |
| 34 const page_load_metrics::ExtraRequestInfo& extra_request_info) override; | |
| 35 void OnLoadingBehaviorObserved( | |
| 36 const page_load_metrics::PageLoadExtraInfo& info) override; | |
| 37 | |
| 38 private: | |
| 39 // Records histograms for byte information. | |
| 40 void RecordByteHistograms(); | |
| 41 | |
| 42 // Whether the page load played a media element. | |
| 43 bool played_media_; | |
|
Charlie Harrison
2017/03/08 14:33:58
nit: can you put the bool at the end to avoid padd
RyanSturm
2017/03/08 17:45:36
Done.
| |
| 44 | |
| 45 // The number of body (not header) prefilter bytes consumed by requests for | |
| 46 // the page. | |
| 47 int64_t cache_bytes_; | |
| 48 int64_t network_bytes_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(MediaPageLoadMetricsObserver); | |
| 51 }; | |
| 52 | |
| 53 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_MEDIA_PAGE_LOAD_METRICS_OB SERVER_H_ | |
| OLD | NEW |