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 // TODO(bmcquade): delete this class in October 2016, as it is deprecated by the | 5 // TODO(bmcquade): delete this class in October 2016, as it is deprecated by the |
6 // new PageLoad.* UMA histograms. | 6 // new PageLoad.* UMA histograms. |
7 | 7 |
8 #ifndef CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | 8 #ifndef CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ |
9 #define CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | 9 #define CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_frame_observer.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 class WebDataSource; | 15 class WebDataSource; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class DocumentState; | 19 class DocumentState; |
20 } | 20 } |
21 | 21 |
22 class PageLoadHistograms : public content::RenderViewObserver { | 22 class PageLoadHistograms : public content::RenderFrameObserver { |
23 public: | 23 public: |
24 explicit PageLoadHistograms(content::RenderView* render_view); | 24 explicit PageLoadHistograms(content::RenderFrame* render_frame); |
25 ~PageLoadHistograms() override; | 25 ~PageLoadHistograms() override; |
26 | 26 |
27 private: | 27 private: |
28 // RenderViewObserver implementation. | 28 // RenderFrameObserver implementation. |
29 void FrameWillClose(blink::WebFrame* frame) override; | 29 void WillCommitProvisionalLoad() override; |
30 void ClosePage() override; | 30 void FrameDetached() override; |
dcheng
2016/09/30 06:20:42
Frame detached should be called before a WebView i
| |
31 void OnDestruct() override; | 31 void OnDestruct() override; |
32 | 32 |
33 // Dump all page load histograms appropriate for the given frame. | 33 // Dump all page load histograms appropriate for the associated frame. |
34 // | 34 // |
35 // This method will only dump once-per-instance, so it is safe to call | 35 // This method will only dump once-per-instance, so it is safe to call |
36 // multiple times. | 36 // multiple times. |
37 // | 37 // |
38 // The time points we keep are | 38 // The time points we keep are |
39 // request: time document was requested by user | 39 // request: time document was requested by user |
40 // start: time load of document started | 40 // start: time load of document started |
41 // commit: time load of document started | 41 // commit: time load of document started |
42 // finish_document: main document loaded, before onload() | 42 // finish_document: main document loaded, before onload() |
43 // finish_all_loads: after onload() and all resources are loaded | 43 // finish_all_loads: after onload() and all resources are loaded |
44 // first_paint: first paint performed | 44 // first_paint: first paint performed |
45 // first_paint_after_load: first paint performed after load is finished | 45 // first_paint_after_load: first paint performed after load is finished |
46 // begin: request if it was user requested, start otherwise | 46 // begin: request if it was user requested, start otherwise |
47 // | 47 // |
48 // It's possible for the request time not to be set, if a client | 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) | 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 | 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. | 51 // so first_paint and first_paint_after_load can be 0. |
52 void Dump(blink::WebFrame* frame); | 52 void Dump(); |
53 | 53 |
54 void LogPageLoadTime(const content::DocumentState* load_times, | 54 void LogPageLoadTime(const content::DocumentState* load_times, |
55 const blink::WebDataSource* ds) const; | 55 const blink::WebDataSource* ds) const; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); | 57 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); |
58 }; | 58 }; |
59 | 59 |
60 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | 60 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ |
OLD | NEW |