Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/renderer/page_load_histograms.h

Issue 2379293002: Rename RFO::FrameWillClose() to reflect its actual purpose. (Closed)
Patch Set: Fix silly typo Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_frame_observer.h"
12 #include "content/public/renderer/render_view_observer.h" 13 #include "content/public/renderer/render_view_observer.h"
13 14
14 namespace blink { 15 namespace blink {
15 class WebDataSource; 16 class WebDataSource;
16 } 17 }
17 18
18 namespace content { 19 namespace content {
19 class DocumentState; 20 class DocumentState;
20 } 21 }
21 22
22 class PageLoadHistograms : public content::RenderViewObserver { 23 class PageLoadHistograms : public content::RenderFrameObserver {
23 public: 24 public:
24 explicit PageLoadHistograms(content::RenderView* render_view); 25 explicit PageLoadHistograms(content::RenderFrame* render_frame);
25 ~PageLoadHistograms() override; 26 ~PageLoadHistograms() override;
26 27
27 private: 28 private:
28 // RenderViewObserver implementation. 29 // RenderFrameObserver implementation.
29 void FrameWillClose(blink::WebFrame* frame) override; 30 void WillCommitProvisionalLoad() override;
30 void ClosePage() override;
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 // 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
57 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); 77 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms);
58 }; 78 };
59 79
60 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ 80 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/page_load_histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698