diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 19:32:32 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 19:32:32 +0000 |
commit | 94dc228a413c368b639847d8b046e8a07883d7fa (patch) | |
tree | b88f6e07e8906dafd017110b99b37dc8aa8bf858 /chrome/browser/net | |
parent | f0d86dd99f60dce920826d0662163002ded7b133 (diff) | |
download | chromium_src-94dc228a413c368b639847d8b046e8a07883d7fa.zip chromium_src-94dc228a413c368b639847d8b046e8a07883d7fa.tar.gz chromium_src-94dc228a413c368b639847d8b046e8a07883d7fa.tar.bz2 |
Make OffTheRecordObserver a Singleton.
BUG=12560
Review URL: http://codereview.chromium.org/115785
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16887 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r-- | chrome/browser/net/dns_global.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc index 61e7ec1..de6c7f8 100644 --- a/chrome/browser/net/dns_global.cc +++ b/chrome/browser/net/dns_global.cc @@ -7,6 +7,7 @@ #include <map> #include <string> +#include "base/singleton.h" #include "base/stats_counters.h" #include "base/string_util.h" #include "base/values.h" @@ -281,10 +282,6 @@ Results* PrefetchObserver::first_resolutions = NULL; class OffTheRecordObserver : public NotificationObserver { public: - OffTheRecordObserver() : lock_(), count_off_the_record_windows_(0) { } - - ~OffTheRecordObserver() { } - void Register() { // TODO(pkasting): This test should not be necessary. See crbug.com/12475. if (registrar_.IsEmpty()) { @@ -328,6 +325,10 @@ class OffTheRecordObserver : public NotificationObserver { } private: + friend struct DefaultSingletonTraits<OffTheRecordObserver>; + OffTheRecordObserver() : lock_(), count_off_the_record_windows_(0) { } + ~OffTheRecordObserver() { } + NotificationRegistrar registrar_; Lock lock_; int count_off_the_record_windows_; @@ -335,9 +336,6 @@ class OffTheRecordObserver : public NotificationObserver { DISALLOW_COPY_AND_ASSIGN(OffTheRecordObserver); }; -// TODO(pkasting): Should this be a Singleton or something? -static OffTheRecordObserver off_the_record_observer; - //------------------------------------------------------------------------------ // This section supports the about:dns page. //------------------------------------------------------------------------------ @@ -381,7 +379,7 @@ void InitDnsPrefetch(PrefService* user_prefs) { dns_master = new DnsMaster(); // We did the initialization, so we should prime the pump, and set up // the DNS resolution system to run. - off_the_record_observer.Register(); + Singleton<OffTheRecordObserver>::get()->Register(); if (user_prefs) { bool enabled = user_prefs->GetBoolean(prefs::kDnsPrefetchingEnabled); |