Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 #ifndef CONTENT_BROWSER_AUDIO_DEVICE_THREAD_H_ | |
| 5 #define CONTENT_BROWSER_AUDIO_DEVICE_THREAD_H_ | |
| 6 | |
| 7 #include "base/threading/thread.h" | |
|
DaleCurtis
2016/12/02 18:20:13
#include build/build_config.h for OS_###
| |
| 8 #include "base/threading/thread_task_runner_handle.h" | |
| 9 #include "content/common/content_export.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 // This class encapulates the logic for the thread and task runners that the | |
| 14 // AudioManager and related classes run on. audio_task_runner and | |
| 15 // worker_task_runner should be called on the same thread as the | |
| 16 // AudioDeviceThread was constructed on. | |
| 17 class CONTENT_EXPORT AudioDeviceThread { | |
| 18 public: | |
| 19 // Constructs and starts the thread. | |
| 20 AudioDeviceThread(); | |
| 21 | |
|
DaleCurtis
2016/12/02 18:20:13
I thought complex classes were required to have ou
| |
| 22 scoped_refptr<base::SingleThreadTaskRunner> task_runner() { | |
| 23 #if defined(OS_MACOSX) | |
| 24 // On Mac audio task runner must belong to the main thread. | |
| 25 // See http://crbug.com/158170. | |
| 26 return base::ThreadTaskRunnerHandle::Get(); | |
|
DaleCurtis
2016/12/02 18:20:13
Probably should be stored instead if we're using h
| |
| 27 #else | |
| 28 return thread_.task_runner(); | |
| 29 #endif // defined(OS_MACOSX) | |
| 30 } | |
| 31 | |
| 32 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner() { | |
| 33 return thread_.task_runner(); | |
| 34 } | |
| 35 | |
| 36 private: | |
| 37 base::Thread thread_; | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread); | |
| 40 }; | |
| 41 | |
| 42 } // namespace content | |
| 43 | |
| 44 #endif // CONTENT_BROWSER_AUDIO_DEVICE_THREAD_H_ | |
| OLD | NEW |