diff options
author | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-28 18:01:34 +0000 |
---|---|---|
committer | jar@google.com <jar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-28 18:01:34 +0000 |
commit | cf5a15c8c36a965d09829263477713aadd1dff06 (patch) | |
tree | 171241b0a30b2fb95de405c44c37b5222cf58bf0 /chrome | |
parent | 5906670f5fc160cb0953159395dd85941abbcece (diff) | |
download | chromium_src-cf5a15c8c36a965d09829263477713aadd1dff06.zip chromium_src-cf5a15c8c36a965d09829263477713aadd1dff06.tar.gz chromium_src-cf5a15c8c36a965d09829263477713aadd1dff06.tar.bz2 |
Avoid using of interlocked increment to facilitate porting.
The code did not end up needing the use of interlocked operations.
All the initialization is called on one thread (the main thread).
bug=1311434
r=deanm
Review URL: http://codereview.chromium.org/4076
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/net/dns_global.cc | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc index 46160c8..e19e0b6 100644 --- a/chrome/browser/net/dns_global.cc +++ b/chrome/browser/net/dns_global.cc @@ -346,25 +346,20 @@ void InitDnsPrefetch(PrefService* user_prefs) { const TimeDelta kAllowableShutdownTime(TimeDelta::FromSeconds(10)); DCHECK(NULL == dns_master); if (!dns_master) { - DnsMaster* new_master = new DnsMaster(kAllowableShutdownTime); - if (InterlockedCompareExchangePointer( - reinterpret_cast<PVOID*>(&dns_master), new_master, NULL)) { - delete new_master; - } else { - // We did the initialization, so we should prime the pump, and set up - // the DNS resolution system to run. - off_the_record_observer.Register(); - - if (user_prefs) { - bool enabled = user_prefs->GetBoolean(prefs::kDnsPrefetchingEnabled); - EnableDnsPrefetch(enabled); - } + dns_master = new DnsMaster(kAllowableShutdownTime); + // We did the initialization, so we should prime the pump, and set up + // the DNS resolution system to run. + off_the_record_observer.Register(); + + if (user_prefs) { + bool enabled = user_prefs->GetBoolean(prefs::kDnsPrefetchingEnabled); + EnableDnsPrefetch(enabled); + } - DLOG(INFO) << "DNS Prefetch service started"; + DLOG(INFO) << "DNS Prefetch service started"; - // Start observing real HTTP stack resolutions. - net::AddDnsResolutionObserver(&dns_resolution_observer); - } + // Start observing real HTTP stack resolutions. + net::AddDnsResolutionObserver(&dns_resolution_observer); } } |