OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 #ifndef CHROME_BROWSER_PREDICTORS_GLOWPLUG_COLLECTOR_H_ | |
6 #define CHROME_BROWSER_PREDICTORS_GLOWPLUG_COLLECTOR_H_ | |
7 | |
8 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | |
9 #include "content/public/common/resource_type.h" | |
10 | |
11 namespace net { | |
12 class URLRequest; | |
13 } | |
14 | |
15 namespace predictors { | |
16 | |
17 // Records navigation events as reported by various observers to the database | |
pasko
2017/05/23 12:24:59
Does this say that the observers of the database r
trevordixon
2017/06/13 11:40:02
I'll refactor the sentence to make the meaning cle
| |
18 // and stats collection classes. All the non-static methods of this class need | |
19 // to be called on the UI thread. | |
20 class GlowplugCollector : public base::SupportsWeakPtr<GlowplugCollector> { | |
pasko
2017/05/23 12:24:59
please try to avoid base::SupportsWeakPtr. See a d
trevordixon
2017/06/13 11:40:02
Sorry for missing this comment! Thankfully Alex to
| |
21 public: | |
22 explicit GlowplugCollector(predictors::ResourcePrefetchPredictor* predictor); | |
alexilin
2017/05/23 08:24:37
nit:
Sorry that I didn't notice it the first time,
trevordixon
2017/06/13 11:40:02
Sorry for missing this comment. I'll fix this in a
| |
23 ~GlowplugCollector(); | |
24 | |
25 // Thread safe. | |
26 static bool ShouldRecordRequest(net::URLRequest* request, | |
27 content::ResourceType resource_type); | |
28 static bool ShouldRecordResponse(net::URLRequest* response); | |
29 static bool ShouldRecordRedirect(net::URLRequest* response); | |
30 | |
31 // 'ResourcePrefetchPredictorObserver' calls the below functions to inform the | |
32 // predictor of main frame and resource requests. Should only be called if the | |
33 // corresponding Should* functions return true. | |
34 void RecordURLRequest( | |
35 const predictors::ResourcePrefetchPredictor::URLRequestSummary& request); | |
36 void RecordURLResponse( | |
37 const predictors::ResourcePrefetchPredictor::URLRequestSummary& response); | |
38 void RecordURLRedirect( | |
39 const predictors::ResourcePrefetchPredictor::URLRequestSummary& response); | |
40 | |
41 // Called when the main frame of a page completes loading. | |
42 void RecordMainFrameLoadComplete(const NavigationID& navigation_id); | |
43 | |
44 // Called after the main frame's first contentful paint. | |
45 void RecordFirstContentfulPaint( | |
46 const NavigationID& navigation_id, | |
47 const base::TimeTicks& first_contentful_paint); | |
48 | |
49 private: | |
50 predictors::ResourcePrefetchPredictor* const predictor_; | |
51 }; | |
52 | |
53 } // namespace predictors | |
54 | |
55 #endif // CHROME_BROWSER_PREDICTORS_GLOWPLUG_COLLECTOR_H_ | |
OLD | NEW |