OLD | NEW |
(Empty) | |
| 1 #include "media/base/android/media_task_runner.h" |
| 2 |
| 3 #include "base/command_line.h" |
| 4 #include "base/lazy_instance.h" |
| 5 #include "base/metrics/field_trial.h" |
| 6 #include "base/strings/string_util.h" |
| 7 #include "base/threading/thread.h" |
| 8 #include "media/base/media_switches.h" |
| 9 |
| 10 namespace media { |
| 11 |
| 12 class MediaThread : public base::Thread { |
| 13 public: |
| 14 MediaThread() : base::Thread("BrowserMediaThread") { |
| 15 Start(); |
| 16 } |
| 17 }; |
| 18 |
| 19 // Create media thread |
| 20 base::LazyInstance<MediaThread>::Leaky g_media_thread = |
| 21 LAZY_INSTANCE_INITIALIZER; |
| 22 |
| 23 scoped_refptr<base::SingleThreadTaskRunner> GetMediaTaskRunner() { |
| 24 return g_media_thread.Pointer()->task_runner(); |
| 25 } |
| 26 |
| 27 bool UseMediaThreadForMediaPlayback() { |
| 28 const std::string group_name = |
| 29 base::FieldTrialList::FindFullName("EnableMediaThreadForMediaPlayback"); |
| 30 |
| 31 if (base::CommandLine::ForCurrentProcess()-> |
| 32 HasSwitch(switches::kEnableMediaThreadForMediaPlayback)) { |
| 33 return true; |
| 34 } |
| 35 |
| 36 return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); |
| 37 } |
| 38 |
| 39 } // namespace media |
OLD | NEW |