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

Side by Side Diff: chrome/browser/predictors/loading_predictor.cc

Issue 2937623007: predictors: Move more methods from ResourcePrefetchPredictor into LoadingDataCollector. (Closed)
Patch Set: Combine RecordMainFrameLoadComplete and OnNavigationComplete. Created 3 years, 6 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/predictors/loading_predictor.h" 5 #include "chrome/browser/predictors/loading_predictor.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "chrome/browser/predictors/loading_data_collector.h" 9 #include "chrome/browser/predictors/loading_data_collector.h"
10 #include "chrome/browser/predictors/loading_stats_collector.h" 10 #include "chrome/browser/predictors/loading_stats_collector.h"
11 #include "chrome/browser/predictors/resource_prefetch_common.h" 11 #include "chrome/browser/predictors/resource_prefetch_common.h"
12 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 12 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
13 13
14 namespace predictors { 14 namespace predictors {
15 15
16 using URLRequestSummary = ResourcePrefetchPredictor::URLRequestSummary;
17
18 LoadingPredictor::LoadingPredictor(const LoadingPredictorConfig& config, 16 LoadingPredictor::LoadingPredictor(const LoadingPredictorConfig& config,
19 Profile* profile) 17 Profile* profile)
20 : config_(config), 18 : config_(config),
21 profile_(profile), 19 profile_(profile),
22 resource_prefetch_predictor_( 20 resource_prefetch_predictor_(
23 base::MakeUnique<ResourcePrefetchPredictor>(config, profile)), 21 base::MakeUnique<ResourcePrefetchPredictor>(config, profile)),
24 stats_collector_(base::MakeUnique<LoadingStatsCollector>( 22 stats_collector_(base::MakeUnique<LoadingStatsCollector>(
25 resource_prefetch_predictor_.get(), 23 resource_prefetch_predictor_.get(),
26 config)), 24 config)),
27 loading_data_collector_(base::MakeUnique<LoadingDataCollector>( 25 loading_data_collector_(base::MakeUnique<LoadingDataCollector>(
28 resource_prefetch_predictor())) { 26 resource_prefetch_predictor_.get(),
27 stats_collector_.get(),
28 config)) {
29 resource_prefetch_predictor_->SetStatsCollector(stats_collector_.get()); 29 resource_prefetch_predictor_->SetStatsCollector(stats_collector_.get());
30 } 30 }
31 31
32 LoadingPredictor::~LoadingPredictor() = default; 32 LoadingPredictor::~LoadingPredictor() = default;
33 33
34 void LoadingPredictor::PrepareForPageLoad(const GURL& url, HintOrigin origin) { 34 void LoadingPredictor::PrepareForPageLoad(const GURL& url, HintOrigin origin) {
35 if (active_hints_.find(url) != active_hints_.end()) 35 if (active_hints_.find(url) != active_hints_.end())
36 return; 36 return;
37 ResourcePrefetchPredictor::Prediction prediction; 37 ResourcePrefetchPredictor::Prediction prediction;
38 if (!resource_prefetch_predictor_->GetPrefetchData(url, &prediction)) 38 if (!resource_prefetch_predictor_->GetPrefetchData(url, &prediction))
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 const GURL& initial_url = it->second; 142 const GURL& initial_url = it->second;
143 CancelActiveHint(active_hints_.find(initial_url)); 143 CancelActiveHint(active_hints_.find(initial_url));
144 it = active_navigations_.erase(it); 144 it = active_navigations_.erase(it);
145 } else { 145 } else {
146 ++it; 146 ++it;
147 } 147 }
148 } 148 }
149 } 149 }
150 150
151 } // namespace predictors 151 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698