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

Side by Side Diff: chrome/browser/net/predictor.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/net/predictor.h" 5 #include "chrome/browser/net/predictor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 #include <sstream> 10 #include <sstream>
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 it != referrers_.end(); ++it) 1063 it != referrers_.end(); ++it)
1064 urls_being_trimmed_.push_back(it->first); 1064 urls_being_trimmed_.push_back(it->first);
1065 UMA_HISTOGRAM_COUNTS("Net.PredictionTrimSize", urls_being_trimmed_.size()); 1065 UMA_HISTOGRAM_COUNTS("Net.PredictionTrimSize", urls_being_trimmed_.size());
1066 } 1066 }
1067 1067
1068 void Predictor::PostIncrementalTrimTask() { 1068 void Predictor::PostIncrementalTrimTask() {
1069 if (urls_being_trimmed_.empty()) 1069 if (urls_being_trimmed_.empty())
1070 return; 1070 return;
1071 const TimeDelta kDurationBetweenTrimmingIncrements = 1071 const TimeDelta kDurationBetweenTrimmingIncrements =
1072 TimeDelta::FromSeconds(kDurationBetweenTrimmingIncrementsSeconds); 1072 TimeDelta::FromSeconds(kDurationBetweenTrimmingIncrementsSeconds);
1073 MessageLoop::current()->PostDelayedTask( 1073 base::MessageLoop::current()->PostDelayedTask(
1074 FROM_HERE, 1074 FROM_HERE,
1075 base::Bind(&Predictor::IncrementalTrimReferrers, 1075 base::Bind(&Predictor::IncrementalTrimReferrers,
1076 weak_factory_->GetWeakPtr(), false), 1076 weak_factory_->GetWeakPtr(), false),
1077 kDurationBetweenTrimmingIncrements); 1077 kDurationBetweenTrimmingIncrements);
1078 } 1078 }
1079 1079
1080 void Predictor::IncrementalTrimReferrers(bool trim_all_now) { 1080 void Predictor::IncrementalTrimReferrers(bool trim_all_now) {
1081 size_t trim_count = urls_being_trimmed_.size(); 1081 size_t trim_count = urls_being_trimmed_.size();
1082 if (!trim_all_now) 1082 if (!trim_all_now)
1083 trim_count = std::min(trim_count, kUrlsTrimmedPerIncrement); 1083 trim_count = std::min(trim_count, kUrlsTrimmedPerIncrement);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 IOThread* io_thread, 1224 IOThread* io_thread,
1225 net::URLRequestContextGetter* getter) { 1225 net::URLRequestContextGetter* getter) {
1226 // Empty function for unittests. 1226 // Empty function for unittests.
1227 } 1227 }
1228 1228
1229 void SimplePredictor::ShutdownOnUIThread(PrefService* user_prefs) { 1229 void SimplePredictor::ShutdownOnUIThread(PrefService* user_prefs) {
1230 SetShutdown(true); 1230 SetShutdown(true);
1231 } 1231 }
1232 1232
1233 } // namespace chrome_browser_net 1233 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/network_time_tracker_unittest.cc ('k') | chrome/browser/net/predictor_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698