Chromium Code Reviews| Index: chrome/browser/predictors/glowplug_collector.h |
| diff --git a/chrome/browser/predictors/glowplug_collector.h b/chrome/browser/predictors/glowplug_collector.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f8710d9d25c53fda372b2010a194c0177d561036 |
| --- /dev/null |
| +++ b/chrome/browser/predictors/glowplug_collector.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_PREDICTORS_GLOWPLUG_COLLECTOR_H_ |
| +#define CHROME_BROWSER_PREDICTORS_GLOWPLUG_COLLECTOR_H_ |
| + |
| +#include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| +#include "content/public/common/resource_type.h" |
| + |
| +namespace net { |
| +class URLRequest; |
| +} |
| + |
| +namespace predictors { |
| + |
| +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.
|
| +using URLRequestSummary = |
| + predictors::ResourcePrefetchPredictor::URLRequestSummary; |
| + |
| +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.
|
| + public: |
| + GlowplugCollector(ResourcePrefetchPredictor* predictor); |
| + ~GlowplugCollector(); |
| + |
| + // Thread safe. |
| + static bool ShouldRecordRequest(net::URLRequest* request, |
| + content::ResourceType resource_type); |
| + static bool ShouldRecordResponse(net::URLRequest* response); |
| + static bool ShouldRecordRedirect(net::URLRequest* response); |
| + |
| + static void SetAllowPortInUrlsForTesting(bool state); |
| + |
| + // 'ResourcePrefetchPredictorObserver' calls the below functions to inform the |
| + // predictor of main frame and resource requests. Should only be called if the |
| + // corresponding Should* functions return true. |
| + void RecordURLRequest(const URLRequestSummary& request); |
| + void RecordURLResponse(const URLRequestSummary& response); |
| + void RecordURLRedirect(const URLRequestSummary& response); |
| + |
| + // Called when the main frame of a page completes loading. |
| + void RecordMainFrameLoadComplete(const NavigationID& navigation_id); |
| + |
| + // Called after the main frame's first contentful paint. |
| + void RecordFirstContentfulPaint( |
| + const NavigationID& navigation_id, |
| + const base::TimeTicks& first_contentful_paint); |
| + |
| + private: |
| + predictors::ResourcePrefetchPredictor* const predictor_; |
| +}; |
| + |
| +} // namespace predictors |
| + |
| +#endif // CHROME_BROWSER_PREDICTORS_GLOWPLUG_COLLECTOR_H_ |