OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/base/android/media_task_runner.h" |
| 6 |
| 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" |
| 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/strings/string_util.h" |
| 11 #include "base/threading/thread.h" |
| 12 #include "media/base/media_switches.h" |
| 13 |
| 14 namespace media { |
| 15 |
| 16 class MediaThread : public base::Thread { |
| 17 public: |
| 18 MediaThread() : base::Thread("BrowserMediaThread") { |
| 19 Start(); |
| 20 } |
| 21 }; |
| 22 |
| 23 // Create media thread |
| 24 base::LazyInstance<MediaThread>::Leaky g_media_thread = |
| 25 LAZY_INSTANCE_INITIALIZER; |
| 26 |
| 27 scoped_refptr<base::SingleThreadTaskRunner> GetMediaTaskRunner() { |
| 28 return g_media_thread.Pointer()->task_runner(); |
| 29 } |
| 30 |
| 31 bool UseMediaThreadForMediaPlayback() { |
| 32 const std::string group_name = |
| 33 base::FieldTrialList::FindFullName("EnableMediaThreadForMediaPlayback"); |
| 34 |
| 35 if (base::CommandLine::ForCurrentProcess()-> |
| 36 HasSwitch(switches::kEnableMediaThreadForMediaPlayback)) { |
| 37 return true; |
| 38 } |
| 39 |
| 40 return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); |
| 41 } |
| 42 |
| 43 } // namespace media |
OLD | NEW |