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

Side by Side Diff: chrome/browser/predictors/glowplug_collector.h

Issue 2896713003: Create LoadingDataCollector class and have observers rely on it instead of ResourcePrefetchPredictor (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
(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 using predictors::ResourcePrefetchPredictor;
alexilin 2017/05/22 13:20:36 Please, remove aliases and use fully-qualified nam
trevordixon 2017/05/22 21:29:01 Done.
18 using URLRequestSummary =
19 predictors::ResourcePrefetchPredictor::URLRequestSummary;
20
21 class GlowplugCollector : public base::SupportsWeakPtr<GlowplugCollector> {
alexilin 2017/05/22 13:20:36 URLRequestSummary and other *Summary classes also
alexilin 2017/05/22 13:20:36 This class needs the detailed description in a com
trevordixon 2017/05/22 21:29:01 Done.
22 public:
23 GlowplugCollector(ResourcePrefetchPredictor* predictor);
24 ~GlowplugCollector();
25
26 // Thread safe.
27 static bool ShouldRecordRequest(net::URLRequest* request,
28 content::ResourceType resource_type);
29 static bool ShouldRecordResponse(net::URLRequest* response);
30 static bool ShouldRecordRedirect(net::URLRequest* response);
31
32 static void SetAllowPortInUrlsForTesting(bool state);
33
34 // 'ResourcePrefetchPredictorObserver' calls the below functions to inform the
35 // predictor of main frame and resource requests. Should only be called if the
36 // corresponding Should* functions return true.
37 void RecordURLRequest(const URLRequestSummary& request);
38 void RecordURLResponse(const URLRequestSummary& response);
39 void RecordURLRedirect(const 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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698