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

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

Issue 1230513002: Record first layout time UMA metric in PageLoadHistograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move histograms.xml to separate change. Created 5 years, 5 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
« no previous file with comments | « no previous file | chrome/renderer/page_load_histograms.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
9 #include "content/public/renderer/render_view_observer.h" 10 #include "content/public/renderer/render_view_observer.h"
10 11
11 namespace blink { 12 namespace blink {
12 class WebDataSource; 13 class WebDataSource;
13 } 14 }
14 15
15 namespace content { 16 namespace content {
16 class DocumentState; 17 class DocumentState;
17 } 18 }
18 19
19 class PageLoadHistograms : public content::RenderViewObserver { 20 class PageLoadHistograms : public content::RenderViewObserver {
20 public: 21 public:
21 explicit PageLoadHistograms(content::RenderView* render_view); 22 explicit PageLoadHistograms(content::RenderView* render_view);
23 ~PageLoadHistograms() override;
22 24
23 private: 25 private:
24 // RenderViewObserver implementation. 26 // RenderViewObserver implementation.
25 void FrameWillClose(blink::WebFrame* frame) override; 27 void FrameWillClose(blink::WebFrame* frame) override;
26 void ClosePage() override; 28 void ClosePage() override;
29 void DidUpdateLayout() override;
27 30
28 // Dump all page load histograms appropriate for the given frame. 31 // Dump all page load histograms appropriate for the given frame.
29 // 32 //
30 // This method will only dump once-per-instance, so it is safe to call 33 // This method will only dump once-per-instance, so it is safe to call
31 // multiple times. 34 // multiple times.
32 // 35 //
33 // The time points we keep are 36 // The time points we keep are
34 // request: time document was requested by user 37 // request: time document was requested by user
35 // start: time load of document started 38 // start: time load of document started
36 // commit: time load of document started 39 // commit: time load of document started
37 // finish_document: main document loaded, before onload() 40 // finish_document: main document loaded, before onload()
38 // finish_all_loads: after onload() and all resources are loaded 41 // finish_all_loads: after onload() and all resources are loaded
39 // first_paint: first paint performed 42 // first_paint: first paint performed
40 // first_paint_after_load: first paint performed after load is finished 43 // first_paint_after_load: first paint performed after load is finished
41 // begin: request if it was user requested, start otherwise 44 // begin: request if it was user requested, start otherwise
42 // 45 //
43 // It's possible for the request time not to be set, if a client 46 // It's possible for the request time not to be set, if a client
44 // redirect had been done (the user never requested the page) 47 // redirect had been done (the user never requested the page)
45 // Also, it's possible to load a page without ever laying it out 48 // Also, it's possible to load a page without ever laying it out
46 // so first_paint and first_paint_after_load can be 0. 49 // so first_paint and first_paint_after_load can be 0.
47 void Dump(blink::WebFrame* frame); 50 void Dump(blink::WebFrame* frame);
48 51
52 bool ShouldDump(blink::WebFrame* frame);
53 void MaybeDumpFirstLayoutHistograms();
49 void LogPageLoadTime(const content::DocumentState* load_times, 54 void LogPageLoadTime(const content::DocumentState* load_times,
50 const blink::WebDataSource* ds) const; 55 const blink::WebDataSource* ds) const;
51 56
57 bool dumped_first_layout_histograms_;
58 base::WeakPtrFactory<PageLoadHistograms> weak_factory_;
59
52 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); 60 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms);
53 }; 61 };
54 62
55 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ 63 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/page_load_histograms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698