| Index: chrome/browser/prerender/prerender_manager.h
|
| diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h
|
| index ee4bf7f2ff1fb9cb782c31ddd4a59ef4c8c6da70..3bd28deae260ce7f60eafd4cf0512f71210f7b1d 100644
|
| --- a/chrome/browser/prerender/prerender_manager.h
|
| +++ b/chrome/browser/prerender/prerender_manager.h
|
| @@ -72,6 +72,13 @@ class PrerenderHandle;
|
| class PrerenderHistory;
|
| class PrerenderLocalPredictor;
|
|
|
| +// Observer interface for PrerenderManager events.
|
| +class PrerenderManagerObserver {
|
| + public:
|
| + // Called from the UI thread.
|
| + virtual void OnFirstContentfulPaint() = 0;
|
| +};
|
| +
|
| // PrerenderManager is responsible for initiating and keeping prerendered
|
| // views of web pages. All methods must be called on the UI thread unless
|
| // indicated otherwise.
|
| @@ -219,13 +226,21 @@ class PrerenderManager : public content::NotificationObserver,
|
| bool is_main_resource,
|
| int redirect_count);
|
|
|
| - // Records the time to first contentful paint.
|
| - // Must not be called for prefetch loads (which are never rendered anyway).
|
| - // |is_no_store| must be true if the main resource has a "no-store" cache
|
| - // control HTTP header.
|
| - void RecordFirstContentfulPaint(const GURL& url,
|
| - bool is_no_store,
|
| - base::TimeDelta time);
|
| + // Records the time to first contentful paint for loads that previously had a
|
| + // no state prefetch load. Must not be called for prefetch loads themselves
|
| + // (which are never rendered anyway). |is_no_store| must be true if the main
|
| + // resource has a "no-store" cache control HTTP header.
|
| + void RecordNoStateFirstContentfulPaint(const GURL& url,
|
| + bool is_no_store,
|
| + base::TimeDelta time);
|
| +
|
| + // Records the perceived first contentful paint time for a prerendered page,
|
| + // analogous to |RecordPerceivedPageLoadTime|. The FCP ticks is in absolute
|
| + // time; this has the disadvantage that the histogram will mix browser and
|
| + // renderer ticks, but there seems to be no way around that.
|
| + void RecordPerceivedFirstContentfulPaint(content::WebContents* web_contents,
|
| + base::TimeTicks ticks,
|
| + bool was_hidden);
|
|
|
| static PrerenderManagerMode GetMode();
|
| static void SetMode(PrerenderManagerMode mode);
|
| @@ -329,6 +344,16 @@ class PrerenderManager : public content::NotificationObserver,
|
| void SetTickClockForTesting(
|
| std::unique_ptr<base::SimpleTestTickClock> tick_clock);
|
|
|
| + void DisablePageLoadMetricsObserverForTesting() {
|
| + page_load_metric_observer_disabled_ = true;
|
| + }
|
| +
|
| + bool PageLoadMetricsObserverDisabledForTesting() const {
|
| + return page_load_metric_observer_disabled_;
|
| + }
|
| +
|
| + void AddObserver(std::unique_ptr<PrerenderManagerObserver> observer);
|
| +
|
| // Notification that a prerender has completed and its bytes should be
|
| // recorded.
|
| void RecordNetworkBytes(Origin origin, bool used, int64_t prerender_bytes);
|
| @@ -610,6 +635,10 @@ class PrerenderManager : public content::NotificationObserver,
|
| std::unique_ptr<base::Clock> clock_;
|
| std::unique_ptr<base::TickClock> tick_clock_;
|
|
|
| + bool page_load_metric_observer_disabled_;
|
| +
|
| + std::vector<std::unique_ptr<PrerenderManagerObserver>> observers_;
|
| +
|
| base::WeakPtrFactory<PrerenderManager> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
|
|
|