Chromium Code Reviews| 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 "base/memory/weak_ptr.h" | |
| 10 #include "content/public/renderer/render_view_observer.h" | 9 #include "content/public/renderer/render_view_observer.h" |
| 11 | 10 |
| 12 namespace blink { | 11 namespace blink { |
| 13 class WebDataSource; | 12 class WebDataSource; |
| 14 } | 13 } |
| 15 | 14 |
| 16 namespace content { | 15 namespace content { |
| 17 class DocumentState; | 16 class DocumentState; |
| 18 } | 17 } |
| 19 | 18 |
| 20 class PageLoadHistograms : public content::RenderViewObserver { | 19 class PageLoadHistograms : public content::RenderViewObserver { |
| 21 public: | 20 public: |
| 22 explicit PageLoadHistograms(content::RenderView* render_view); | 21 explicit PageLoadHistograms(content::RenderView* render_view); |
| 23 ~PageLoadHistograms() override; | |
|
jochen (gone - plz use gerrit)
2016/03/09 15:07:26
why?
Bryan McQuade
2016/03/09 20:29:49
The destructor was added as part of the CL https:/
| |
| 24 | 22 |
| 25 private: | 23 private: |
| 26 // RenderViewObserver implementation. | 24 // RenderViewObserver implementation. |
| 27 void FrameWillClose(blink::WebFrame* frame) override; | 25 void FrameWillClose(blink::WebFrame* frame) override; |
| 28 void ClosePage() override; | 26 void ClosePage() override; |
| 29 void DidUpdateLayout() override; | |
| 30 | 27 |
| 31 // Dump all page load histograms appropriate for the given frame. | 28 // Dump all page load histograms appropriate for the given frame. |
| 32 // | 29 // |
| 33 // This method will only dump once-per-instance, so it is safe to call | 30 // This method will only dump once-per-instance, so it is safe to call |
| 34 // multiple times. | 31 // multiple times. |
| 35 // | 32 // |
| 36 // The time points we keep are | 33 // The time points we keep are |
| 37 // request: time document was requested by user | 34 // request: time document was requested by user |
| 38 // start: time load of document started | 35 // start: time load of document started |
| 39 // commit: time load of document started | 36 // commit: time load of document started |
| 40 // finish_document: main document loaded, before onload() | 37 // finish_document: main document loaded, before onload() |
| 41 // finish_all_loads: after onload() and all resources are loaded | 38 // finish_all_loads: after onload() and all resources are loaded |
| 42 // first_paint: first paint performed | 39 // first_paint: first paint performed |
| 43 // first_paint_after_load: first paint performed after load is finished | 40 // first_paint_after_load: first paint performed after load is finished |
| 44 // begin: request if it was user requested, start otherwise | 41 // begin: request if it was user requested, start otherwise |
| 45 // | 42 // |
| 46 // It's possible for the request time not to be set, if a client | 43 // It's possible for the request time not to be set, if a client |
| 47 // redirect had been done (the user never requested the page) | 44 // redirect had been done (the user never requested the page) |
| 48 // Also, it's possible to load a page without ever laying it out | 45 // Also, it's possible to load a page without ever laying it out |
| 49 // so first_paint and first_paint_after_load can be 0. | 46 // so first_paint and first_paint_after_load can be 0. |
| 50 void Dump(blink::WebFrame* frame); | 47 void Dump(blink::WebFrame* frame); |
| 51 | 48 |
| 52 bool ShouldDump(blink::WebFrame* frame); | |
| 53 void MaybeDumpFirstLayoutHistograms(); | |
| 54 void LogPageLoadTime(const content::DocumentState* load_times, | 49 void LogPageLoadTime(const content::DocumentState* load_times, |
| 55 const blink::WebDataSource* ds) const; | 50 const blink::WebDataSource* ds) const; |
| 56 | 51 |
| 57 bool dumped_first_layout_histograms_; | |
| 58 base::WeakPtrFactory<PageLoadHistograms> weak_factory_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); | 52 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); |
| 61 }; | 53 }; |
| 62 | 54 |
| 63 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | 55 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ |
| OLD | NEW |