Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: media/base/mime_util.cc

Issue 2668813002: Remove LazyInstance usage from media/ (Closed)
Patch Set: Fix presubmit comments. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/media.cc ('k') | media/base/win/mf_initializer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/mime_util.h" 5 #include "media/base/mime_util.h"
6 6
7 #include "base/lazy_instance.h"
8 #include "media/base/mime_util_internal.h" 7 #include "media/base/mime_util_internal.h"
9 8
10 namespace media { 9 namespace media {
11 10
12 // This variable is Leaky because it is accessed from WorkerPool threads. 11 // This variable is Leaky because it is accessed from WorkerPool threads.
13 static base::LazyInstance<internal::MimeUtil>::Leaky g_media_mime_util = 12 static internal::MimeUtil* GetMimeUtil() {
14 LAZY_INSTANCE_INITIALIZER; 13 static internal::MimeUtil* mime_util = new internal::MimeUtil();
14 return mime_util;
15 }
15 16
16 bool IsSupportedMediaMimeType(const std::string& mime_type) { 17 bool IsSupportedMediaMimeType(const std::string& mime_type) {
17 return g_media_mime_util.Pointer()->IsSupportedMediaMimeType(mime_type); 18 return GetMimeUtil()->IsSupportedMediaMimeType(mime_type);
18 } 19 }
19 20
20 SupportsType IsSupportedMediaFormat(const std::string& mime_type, 21 SupportsType IsSupportedMediaFormat(const std::string& mime_type,
21 const std::vector<std::string>& codecs) { 22 const std::vector<std::string>& codecs) {
22 return g_media_mime_util.Pointer()->IsSupportedMediaFormat(mime_type, codecs, 23 return GetMimeUtil()->IsSupportedMediaFormat(mime_type, codecs, false);
23 false);
24 } 24 }
25 25
26 SupportsType IsSupportedEncryptedMediaFormat( 26 SupportsType IsSupportedEncryptedMediaFormat(
27 const std::string& mime_type, 27 const std::string& mime_type,
28 const std::vector<std::string>& codecs) { 28 const std::vector<std::string>& codecs) {
29 return g_media_mime_util.Pointer()->IsSupportedMediaFormat(mime_type, codecs, 29 return GetMimeUtil()->IsSupportedMediaFormat(mime_type, codecs, true);
30 true);
31 } 30 }
32 31
33 void ParseCodecString(const std::string& codecs, 32 void ParseCodecString(const std::string& codecs,
34 std::vector<std::string>* codecs_out, 33 std::vector<std::string>* codecs_out,
35 bool strip) { 34 bool strip) {
36 g_media_mime_util.Pointer()->ParseCodecString(codecs, codecs_out, strip); 35 GetMimeUtil()->ParseCodecString(codecs, codecs_out, strip);
37 } 36 }
38 37
39 void RemoveProprietaryMediaTypesAndCodecsForTests() { 38 void RemoveProprietaryMediaTypesAndCodecsForTests() {
40 g_media_mime_util.Pointer()->RemoveProprietaryMediaTypesAndCodecs(); 39 GetMimeUtil()->RemoveProprietaryMediaTypesAndCodecs();
41 } 40 }
42 41
43 } // namespace media 42 } // namespace media
OLDNEW
« no previous file with comments | « media/base/media.cc ('k') | media/base/win/mf_initializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698