[email protected] | 83ab4a28 | 2012-07-12 18:19:45 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | a5a65ac | 2010-11-05 18:14:36 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | ||||
6 | #define CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ | ||||
7 | |||||
8 | #include "base/basictypes.h" | ||||
[email protected] | 3a034ebb | 2011-10-03 19:19:44 | [diff] [blame] | 9 | #include "content/public/renderer/render_view_observer.h" |
[email protected] | a5a65ac | 2010-11-05 18:14:36 | [diff] [blame] | 10 | |
[email protected] | 82ddba1c | 2011-10-04 00:15:32 | [diff] [blame] | 11 | namespace content { |
[email protected] | 007733c | 2011-11-17 00:34:07 | [diff] [blame] | 12 | class DocumentState; |
[email protected] | 82ddba1c | 2011-10-04 00:15:32 | [diff] [blame] | 13 | } |
14 | |||||
[email protected] | 3a034ebb | 2011-10-03 19:19:44 | [diff] [blame] | 15 | class PageLoadHistograms : public content::RenderViewObserver { |
[email protected] | a5a65ac | 2010-11-05 18:14:36 | [diff] [blame] | 16 | public: |
[email protected] | 83ab4a28 | 2012-07-12 18:19:45 | [diff] [blame] | 17 | explicit PageLoadHistograms(content::RenderView* render_view); |
[email protected] | 6cf19311f | 2011-04-14 23:06:02 | [diff] [blame] | 18 | |
19 | private: | ||||
20 | // RenderViewObserver implementation. | ||||
[email protected] | 77fc9b9 | 2011-10-15 16:20:37 | [diff] [blame] | 21 | virtual void FrameWillClose(WebKit::WebFrame* frame) OVERRIDE; |
22 | virtual void ClosePage() OVERRIDE; | ||||
[email protected] | a5a65ac | 2010-11-05 18:14:36 | [diff] [blame] | 23 | |
24 | // Dump all page load histograms appropriate for the given frame. | ||||
25 | // | ||||
26 | // This method will only dump once-per-instance, so it is safe to call | ||||
27 | // multiple times. | ||||
28 | // | ||||
29 | // The time points we keep are | ||||
30 | // request: time document was requested by user | ||||
31 | // start: time load of document started | ||||
32 | // commit: time load of document started | ||||
33 | // finish_document: main document loaded, before onload() | ||||
34 | // finish_all_loads: after onload() and all resources are loaded | ||||
35 | // first_paint: first paint performed | ||||
36 | // first_paint_after_load: first paint performed after load is finished | ||||
37 | // begin: request if it was user requested, start otherwise | ||||
38 | // | ||||
39 | // It's possible for the request time not to be set, if a client | ||||
40 | // redirect had been done (the user never requested the page) | ||||
41 | // Also, it's possible to load a page without ever laying it out | ||||
42 | // so first_paint and first_paint_after_load can be 0. | ||||
43 | void Dump(WebKit::WebFrame* frame); | ||||
44 | |||||
[email protected] | a5a65ac | 2010-11-05 18:14:36 | [diff] [blame] | 45 | void ResetCrossFramePropertyAccess(); |
46 | |||||
[email protected] | 007733c | 2011-11-17 00:34:07 | [diff] [blame] | 47 | void LogPageLoadTime(const content::DocumentState* load_times, |
[email protected] | a5a65ac | 2010-11-05 18:14:36 | [diff] [blame] | 48 | const WebKit::WebDataSource* ds) const; |
49 | |||||
[email protected] | a5a65ac | 2010-11-05 18:14:36 | [diff] [blame] | 50 | // Site isolation metric counts. |
51 | // These are per-page-load counts, reset to 0 after they are dumped. | ||||
52 | int cross_origin_access_count_; | ||||
53 | int same_origin_access_count_; | ||||
54 | |||||
[email protected] | a5a65ac | 2010-11-05 18:14:36 | [diff] [blame] | 55 | DISALLOW_COPY_AND_ASSIGN(PageLoadHistograms); |
56 | }; | ||||
57 | |||||
58 | #endif // CHROME_RENDERER_PAGE_LOAD_HISTOGRAMS_H_ |