From cf5a15c8c36a965d09829263477713aadd1dff06 Mon Sep 17 00:00:00 2001 From: "jar@google.com" Date: Sun, 28 Sep 2008 18:01:34 +0000 Subject: 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 --- chrome/browser/net/dns_global.cc | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'chrome/browser/net') 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(&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); } } -- cgit v1.1