| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 // TODO(bmcquade): delete this class in October 2016, as it is deprecated by the | |
| 6 // new PageLoad.* UMA histograms. | |
| 7 | |
| 8 #ifndef CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | |
| 9 #define CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "content/public/renderer/render_frame_observer.h" | |
| 13 #include "content/public/renderer/render_view_observer.h" | |
| 14 | |
| 15 namespace blink { | |
| 16 class WebDataSource; | |
| 17 } | |
| 18 | |
| 19 namespace content { | |
| 20 class DocumentState; | |
| 21 } | |
| 22 | |
| 23 class PageLoadHistograms : public content::RenderFrameObserver { | |
| 24 public: | |
| 25 explicit PageLoadHistograms(content::RenderFrame* render_frame); | |
| 26 ~PageLoadHistograms() override; | |
| 27 | |
| 28 private: | |
| 29 // RenderFrameObserver implementation. | |
| 30 void WillCommitProvisionalLoad() override; | |
| 31 void OnDestruct() override; | |
| 32 | |
| 33 // Dump all page load histograms appropriate for the associated frame. | |
| 34 // | |
| 35 // This method will only dump once-per-instance, so it is safe to call | |
| 36 // multiple times. | |
| 37 // | |
| 38 // The time points we keep are | |
| 39 // request: time document was requested by user | |
| 40 // start: time load of document started | |
| 41 // commit: time load of document started | |
| 42 // finish_document: main document loaded, before onload() | |
| 43 // finish_all_loads: after onload() and all resources are loaded | |
| 44 // first_paint: first paint performed | |
| 45 // first_paint_after_load: first paint performed after load is finished | |
| 46 // begin: request if it was user requested, start otherwise | |
| 47 // | |
| 48 // It's possible for the request time not to be set, if a client | |
| 49 // redirect had been done (the user never requested the page) | |
| 50 // Also, it's possible to load a page without ever laying it out | |
| 51 // so first_paint and first_paint_after_load can be 0. | |
| 52 void Dump(); | |
| 53 | |
| 54 void LogPageLoadTime(const content::DocumentState* load_times, | |
| 55 const blink::WebDataSource* ds) const; | |
| 56 | |
| 57 // PageLoadHistograms needs the ClosePage() notification, but it's problematic | |
| 58 // to inherit from both RVO and RFO. Embed the RVO in a small helper class | |
| 59 // instead. | |
| 60 class Helper : public content::RenderViewObserver { | |
| 61 public: | |
| 62 explicit Helper(PageLoadHistograms* histograms); | |
| 63 | |
| 64 // RenderViewObserver implementation. | |
| 65 void ClosePage() override; | |
| 66 void OnDestruct() override; | |
| 67 | |
| 68 private: | |
| 69 // The Helper is owned by PageLoadHistograms. | |
| 70 PageLoadHistograms* const histograms_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(Helper); | |
| 73 }; | |
| 74 | |
| 75 Helper helper_; | |
| 76 | |
| 77 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); | |
| 78 }; | |
| 79 | |
| 80 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | |
| OLD | NEW |