diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-20 11:51:23 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-20 11:51:23 +0000 |
commit | b7779a46dbf7f0201498db0e430a4ecbdd8d2032 (patch) | |
tree | 36f16dfeb7b5e4c178c42b93a99a6d2aa2999dcf /chrome/browser/net/dns_master.cc | |
parent | 0d12ef12d81a4fffda677a1b683597aa8c77d44c (diff) | |
download | chromium_src-b7779a46dbf7f0201498db0e430a4ecbdd8d2032.zip chromium_src-b7779a46dbf7f0201498db0e430a4ecbdd8d2032.tar.gz chromium_src-b7779a46dbf7f0201498db0e430a4ecbdd8d2032.tar.bz2 |
Platform cleanup in chrome/browser/net.
Preparing for more complex changes.
Review URL: http://codereview.chromium.org/14919
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7344 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/dns_master.cc')
-rw-r--r-- | chrome/browser/net/dns_master.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/chrome/browser/net/dns_master.cc b/chrome/browser/net/dns_master.cc index 29bf139..4d477b0 100644 --- a/chrome/browser/net/dns_master.cc +++ b/chrome/browser/net/dns_master.cc @@ -20,12 +20,12 @@ using base::TimeDelta; namespace chrome_browser_net { DnsMaster::DnsMaster(TimeDelta shutdown_wait_time) - : slave_count_(0), - shutdown_(false), + : slaves_have_work_(&lock_), + slave_count_(0), running_slave_count_(0), - kShutdownWaitTime_(shutdown_wait_time), - slaves_have_work_(&lock_) { - for ( int i = 0; i < kSlaveCountMax; i++ ) { + shutdown_(false), + kShutdownWaitTime_(shutdown_wait_time) { + for (size_t i = 0; i < kSlaveCountMax; i++) { thread_ids_[i] = 0; thread_handles_[i] = 0; slaves_[i] = NULL; @@ -40,8 +40,7 @@ void DnsMaster::ResolveList(const NameList& hostnames, AutoLock auto_lock(lock_); if (shutdown_) return; if (slave_count_ < kSlaveCountMin) { - for (int target_count = std::min(static_cast<int>(hostnames.size()), - kSlaveCountMin); + for (int target_count = std::min(hostnames.size(), kSlaveCountMin); target_count > 0; target_count--) PreLockedCreateNewSlaveIfNeeded(); @@ -114,7 +113,7 @@ bool DnsMaster::AccruePrefetchBenefits(const GURL& referrer, // Remain under lock to push data. cache_hits_.push_back(*navigation_info); if (referrer_based_prefetch) { - std::string& motivating_referrer( + std::string motivating_referrer( prefetched_host_info.referring_hostname()); if (!motivating_referrer.empty()) { referrers_[motivating_referrer].AccrueValue( @@ -170,12 +169,6 @@ void DnsMaster::NavigatingTo(const std::string& host_name) { slaves_have_work_.Signal(); } -static char* PluralOptionalHostname(size_t count) { - if (count == 1) - return "hostname"; - return "hostnames"; -} - // Provide sort order so all .com's are together, etc. struct RightToLeftStringSorter { bool operator()(const std::string& left, const std::string& right) const { @@ -410,7 +403,7 @@ void DnsMaster::SetNoSuchNameState(const std::string hostname) { } bool DnsMaster::PreLockedCreateNewSlaveIfNeeded() { - // Don't create more then max. + // Don't create more than max. if (kSlaveCountMax <= slave_count_ || shutdown_) return false; |