OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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. | |
4 | |
5 #include "chrome/browser/page_load_metrics/observers/webui_page_load_metrics_obs erver.h" | |
6 | |
7 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" | |
8 #include "chrome/common/url_constants.h" | |
9 #include "content/public/browser/navigation_handle.h" | |
10 | |
11 namespace internal { | |
12 | |
13 const char kHistogramExtensionsParseDuration[] = | |
14 "PageLoad.Clients.WebUI.Extensions.ParseTiming." | |
15 "ParseDuration"; | |
16 | |
17 } // namespace internal | |
18 WebUIPageLoadMetricsObserver::WebUIPageLoadMetricsObserver() {} | |
19 | |
20 page_load_metrics::TrackingPolicy WebUIPageLoadMetricsObserver::ShouldTrackLoad( | |
21 content::NavigationHandle* navigation_handle) { | |
22 const GURL& url = navigation_handle->GetURL(); | |
23 if (url.SchemeIs("chrome")) { | |
Devlin
2016/09/20 22:59:15
kChromeUIScheme
| |
24 if (url.path_piece().find(chrome::kChromeUIExtensionsHost) == 1) { | |
Devlin
2016/09/20 22:59:15
more information than you ever wanted:
In the curr
Charlie Harrison
2016/09/21 00:32:48
Hmm this is tricky with the current architecture,
Devlin
2016/09/21 00:47:22
This would still be useful for MD extensions, then
Charlie Harrison
2016/09/26 20:05:57
I did an experiment and it still seems like (most
Devlin
2016/09/26 20:39:54
If this turns out to be very complicated, could we
Charlie Harrison
2016/09/26 21:38:19
SG. I will amend the patch to only log for MD.
| |
25 tracked_page_ = EXTENSIONS; | |
26 } | |
27 } | |
28 return tracked_page_ == NONE ? page_load_metrics::IGNORE | |
29 : page_load_metrics::TRACK; | |
30 } | |
31 | |
32 void WebUIPageLoadMetricsObserver::OnParseStop( | |
33 const page_load_metrics::PageLoadTiming& timing, | |
34 const page_load_metrics::PageLoadExtraInfo& info) { | |
35 if (!WasStartedInForegroundOptionalEventInForeground(timing.parse_stop, | |
36 info)) { | |
37 return; | |
38 } | |
39 | |
40 switch (tracked_page_) { | |
41 case EXTENSIONS: | |
42 PAGE_LOAD_HISTOGRAM( | |
43 internal::kHistogramExtensionsParseDuration, | |
Devlin
2016/09/20 22:59:15
It would be useful to have this broken apart by MD
Charlie Harrison
2016/09/21 00:32:48
ACK. This is a good idea.
| |
44 timing.parse_stop.value() - timing.parse_start.value()); | |
45 break; | |
46 case NONE: | |
47 NOTREACHED(); | |
48 break; | |
49 } | |
50 } | |
51 | |
52 void WebUIPageLoadMetricsObserver::OnFirstContentfulPaint( | |
53 const page_load_metrics::PageLoadTiming& timing, | |
54 const page_load_metrics::PageLoadExtraInfo& info) { | |
55 if (!WasStartedInForegroundOptionalEventInForeground( | |
56 timing.first_contentful_paint, info)) { | |
57 return; | |
58 } | |
59 | |
60 switch (tracked_page_) { | |
61 case EXTENSIONS: | |
62 PAGE_LOAD_HISTOGRAM( | |
63 "PageLoad.Clients.WebUI.Extensions.PaintTiming." | |
64 "NavigationToFirstContentfulPaint", | |
65 timing.first_contentful_paint.value()); | |
66 break; | |
67 case NONE: | |
68 NOTREACHED(); | |
69 break; | |
70 } | |
71 } | |
OLD | NEW |