Chromium Code Reviews| Index: chrome/browser/predictors/resource_prefetch_predictor.cc |
| diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc |
| index dd33e10874d8259c5ec52ab6f7995777dbac7b91..083b0697110520c6a30217bb5bb37ae5432a8ac9 100644 |
| --- a/chrome/browser/predictors/resource_prefetch_predictor.cc |
| +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc |
| @@ -578,6 +578,18 @@ void ResourcePrefetchPredictor::RecordMainFrameLoadComplete( |
| } |
| } |
| +void ResourcePrefetchPredictor::RecordFirstContentfulPaint( |
| + const NavigationID navigation_id) { |
| + NavigationMap::iterator nav_it = |
| + inflight_navigations_.find(navigation_id); |
| + if (nav_it == inflight_navigations_.end()) return; |
|
alexilin
2017/03/17 14:46:46
nit:
Return statement should occupy a separate lin
trevordixon
2017/03/27 12:30:08
Done.
|
| + |
| + for (auto& request_summary : nav_it->second->subresource_requests) { |
| + request_summary.before_first_contentful_paint = true; |
|
alexilin
2017/03/17 14:46:46
You can't assume that Observer gets an event at th
trevordixon
2017/03/27 12:30:08
Maybe fixed. How likely is it that OnFirstContentf
alexilin
2017/03/27 15:31:59
Well, it's definitely not rare for "fast" pages fo
|
| + } |
| +} |
| + |
| + |
| void ResourcePrefetchPredictor::StartPrefetching(const GURL& url, |
| PrefetchOrigin origin) { |
| TRACE_EVENT1("browser", "ResourcePrefetchPredictor::StartPrefetching", "url", |
| @@ -1146,6 +1158,8 @@ void ResourcePrefetchPredictor::LearnNavigation( |
| continue; |
| ResourceData* resource_to_add = data.add_resources(); |
| + resource_to_add->set_before_first_contentful_paint( |
| + summary.before_first_contentful_paint); |
| resource_to_add->set_resource_url(summary.resource_url.spec()); |
| resource_to_add->set_resource_type( |
| static_cast<ResourceData::ResourceType>(summary.resource_type)); |