| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | 5 #ifndef CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ |
| 6 #define CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | 6 #define CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "content/public/renderer/render_view_observer.h" | 9 #include "content/public/renderer/render_view_observer.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 class WebDataSource; | 12 class WebDataSource; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 class DocumentState; | 16 class DocumentState; |
| 17 } | 17 } |
| 18 | 18 |
| 19 class PageLoadHistograms : public content::RenderViewObserver { | 19 class PageLoadHistograms : public content::RenderViewObserver { |
| 20 public: | 20 public: |
| 21 explicit PageLoadHistograms(content::RenderView* render_view); | 21 explicit PageLoadHistograms(content::RenderView* render_view); |
| 22 ~PageLoadHistograms() override; | 22 ~PageLoadHistograms() override; |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 // RenderViewObserver implementation. | 25 // RenderViewObserver implementation. |
| 26 void FrameWillClose(blink::WebFrame* frame) override; | 26 void FrameWillClose(blink::WebFrame* frame) override; |
| 27 void ClosePage() override; | 27 void ClosePage() override; |
| 28 void OnDestruct() override; |
| 28 | 29 |
| 29 // Dump all page load histograms appropriate for the given frame. | 30 // Dump all page load histograms appropriate for the given frame. |
| 30 // | 31 // |
| 31 // This method will only dump once-per-instance, so it is safe to call | 32 // This method will only dump once-per-instance, so it is safe to call |
| 32 // multiple times. | 33 // multiple times. |
| 33 // | 34 // |
| 34 // The time points we keep are | 35 // The time points we keep are |
| 35 // request: time document was requested by user | 36 // request: time document was requested by user |
| 36 // start: time load of document started | 37 // start: time load of document started |
| 37 // commit: time load of document started | 38 // commit: time load of document started |
| 38 // finish_document: main document loaded, before onload() | 39 // finish_document: main document loaded, before onload() |
| 39 // finish_all_loads: after onload() and all resources are loaded | 40 // finish_all_loads: after onload() and all resources are loaded |
| 40 // first_paint: first paint performed | 41 // first_paint: first paint performed |
| 41 // first_paint_after_load: first paint performed after load is finished | 42 // first_paint_after_load: first paint performed after load is finished |
| 42 // begin: request if it was user requested, start otherwise | 43 // begin: request if it was user requested, start otherwise |
| 43 // | 44 // |
| 44 // It's possible for the request time not to be set, if a client | 45 // It's possible for the request time not to be set, if a client |
| 45 // redirect had been done (the user never requested the page) | 46 // redirect had been done (the user never requested the page) |
| 46 // Also, it's possible to load a page without ever laying it out | 47 // Also, it's possible to load a page without ever laying it out |
| 47 // so first_paint and first_paint_after_load can be 0. | 48 // so first_paint and first_paint_after_load can be 0. |
| 48 void Dump(blink::WebFrame* frame); | 49 void Dump(blink::WebFrame* frame); |
| 49 | 50 |
| 50 void LogPageLoadTime(const content::DocumentState* load_times, | 51 void LogPageLoadTime(const content::DocumentState* load_times, |
| 51 const blink::WebDataSource* ds) const; | 52 const blink::WebDataSource* ds) const; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); | 54 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | 57 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ |
| OLD | NEW |