diff options
-rw-r--r-- | net/base/dns_resolution_observer.cc | 6 | ||||
-rw-r--r-- | net/base/ev_root_ca_metadata.cc | 12 | ||||
-rw-r--r-- | net/base/ev_root_ca_metadata.h | 7 |
3 files changed, 10 insertions, 15 deletions
diff --git a/net/base/dns_resolution_observer.cc b/net/base/dns_resolution_observer.cc index c9c9933..10c9650 100644 --- a/net/base/dns_resolution_observer.cc +++ b/net/base/dns_resolution_observer.cc @@ -30,11 +30,11 @@ // This file supports network stack independent notification of progress // towards resolving a hostname. -#include "net/base/dns_resolution_observer.h" - +#include <windows.h> #include <string> -#include "base/atomic.h" +#include "net/base/dns_resolution_observer.h" + #include "base/logging.h" namespace net { diff --git a/net/base/ev_root_ca_metadata.cc b/net/base/ev_root_ca_metadata.cc index 062e29e..30c37bb 100644 --- a/net/base/ev_root_ca_metadata.cc +++ b/net/base/ev_root_ca_metadata.cc @@ -27,6 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include "base/singleton.h" #include "net/base/ev_root_ca_metadata.h" namespace net { @@ -165,17 +166,8 @@ static const EVMetadata ev_root_ca_metadata[] = { }; // static -EVRootCAMetadata* EVRootCAMetadata::instance_; - -// static EVRootCAMetadata* EVRootCAMetadata::GetInstance() { - if (!instance_) { - EVRootCAMetadata* new_instance = new EVRootCAMetadata; - if (InterlockedCompareExchangePointer( - reinterpret_cast<PVOID*>(&instance_), new_instance, NULL)) - delete new_instance; - } - return instance_; + return Singleton<EVRootCAMetadata>::get(); } bool EVRootCAMetadata::GetPolicyOID( diff --git a/net/base/ev_root_ca_metadata.h b/net/base/ev_root_ca_metadata.h index a849a92..373d09d 100644 --- a/net/base/ev_root_ca_metadata.h +++ b/net/base/ev_root_ca_metadata.h @@ -34,6 +34,9 @@ #include "net/base/x509_certificate.h" +template <typename T> +struct DefaultSingletonTraits; + namespace net { // A singleton. This class stores the meta data of the root CAs that issue @@ -54,7 +57,7 @@ class EVRootCAMetadata { EVRootCAMetadata(); ~EVRootCAMetadata() { } - static EVRootCAMetadata* instance_; + friend DefaultSingletonTraits<EVRootCAMetadata>; typedef std::map<X509Certificate::Fingerprint, std::string, X509Certificate::FingerprintLessThan> StringMap; @@ -73,4 +76,4 @@ class EVRootCAMetadata { } // namespace net -#endif // NET_BASE_EV_ROOT_CA_METADATA_H__
\ No newline at end of file +#endif // NET_BASE_EV_ROOT_CA_METADATA_H__ |