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
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_
6 #define CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_
8 #include "base/basictypes.h"
9 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
10 #include "content/public/renderer/render_view_observer.h"
16 class PageLoadHistograms
: public content::RenderViewObserver
{
18 explicit PageLoadHistograms(content::RenderView
* render_view
);
21 // RenderViewObserver implementation.
22 void FrameWillClose(blink::WebFrame
* frame
) override
;
23 void ClosePage() override
;
25 // Dump all page load histograms appropriate for the given frame.
27 // This method will only dump once-per-instance, so it is safe to call
30 // The time points we keep are
31 // request: time document was requested by user
32 // start: time load of document started
33 // commit: time load of document started
34 // finish_document: main document loaded, before onload()
35 // finish_all_loads: after onload() and all resources are loaded
36 // first_paint: first paint performed
37 // first_paint_after_load: first paint performed after load is finished
38 // begin: request if it was user requested, start otherwise
40 // It's possible for the request time not to be set, if a client
41 // redirect had been done (the user never requested the page)
42 // Also, it's possible to load a page without ever laying it out
43 // so first_paint and first_paint_after_load can be 0.
44 void Dump(blink::WebFrame
* frame
);
46 void LogPageLoadTime(const content::DocumentState
* load_times
,
47 const blink::WebDataSource
* ds
) const;
49 data_reduction_proxy::DataReductionProxyParams data_reduction_proxy_params_
;
51 DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms
);
54 #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_