Index: media/base/key_systems.cc |
diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc |
index ef16ad65fbdc6bab3830ea998e7f9c7f5ec402ee..1bf65fa24adb4420659a0d3b5a97c475204c60a9 100644 |
--- a/media/base/key_systems.cc |
+++ b/media/base/key_systems.cc |
@@ -9,7 +9,6 @@ |
#include <memory> |
#include "base/containers/hash_tables.h" |
-#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "base/macros.h" |
#include "base/strings/string_util.h" |
@@ -230,8 +229,6 @@ class KeySystemsImpl : public KeySystems { |
bool IsValidMimeTypeCodecsCombination(const std::string& mime_type, |
SupportedCodecs codecs_mask) const; |
- friend struct base::DefaultLazyInstanceTraits<KeySystemsImpl>; |
- |
typedef base::hash_map<std::string, std::unique_ptr<KeySystemProperties>> |
KeySystemPropertiesMap; |
typedef base::hash_map<std::string, SupportedCodecs> MimeTypeCodecsMap; |
@@ -263,20 +260,17 @@ class KeySystemsImpl : public KeySystems { |
DISALLOW_COPY_AND_ASSIGN(KeySystemsImpl); |
}; |
-static base::LazyInstance<KeySystemsImpl>::Leaky g_key_systems = |
- LAZY_INSTANCE_INITIALIZER; |
- |
KeySystemsImpl* KeySystemsImpl::GetInstance() { |
- KeySystemsImpl* key_systems = g_key_systems.Pointer(); |
+ static KeySystemsImpl* key_systems = new KeySystemsImpl(); |
key_systems->UpdateIfNeeded(); |
scottmg
2017/01/31 21:10:34
Are multiple calls to UpdateIfNeeded() a problem?
DaleCurtis
2017/01/31 22:04:33
No, or it'd have been a problem before too. The If
|
return key_systems; |
} |
-// Because we use a LazyInstance, the key systems info must be populated when |
-// the instance is lazily initiated. |
-KeySystemsImpl::KeySystemsImpl() : |
- audio_codec_mask_(EME_CODEC_AUDIO_ALL), |
- video_codec_mask_(EME_CODEC_VIDEO_ALL) { |
+// Because we use a thread-safe static, the key systems info must be populated |
+// when the instance is constructed. |
+KeySystemsImpl::KeySystemsImpl() |
+ : audio_codec_mask_(EME_CODEC_AUDIO_ALL), |
+ video_codec_mask_(EME_CODEC_VIDEO_ALL) { |
for (size_t i = 0; i < arraysize(kCodecStrings); ++i) { |
const std::string& name = kCodecStrings[i].name; |
DCHECK(!codec_string_map_.count(name)); |