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

Unified Diff: chrome/browser/net/dns_master.cc

Issue 14919: Platform cleanup in chrome/browser/net. (Closed)
Patch Set: Created 12 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/dns_master.h ('k') | chrome/browser/net/dns_master_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/dns_master.cc
diff --git a/chrome/browser/net/dns_master.cc b/chrome/browser/net/dns_master.cc
index 29bf13996d7436cb0197b90a3ae5fcc5e844e924..4d477b054fb39cc09743d257836f92bf3d7c354c 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;
« no previous file with comments | « chrome/browser/net/dns_master.h ('k') | chrome/browser/net/dns_master_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698