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_ | |
Avi (use Gerrit)
2016/12/02 15:27:49
blank line above
| |
5 #define CONTENT_BROWSER_AUDIO_DEVICE_THREAD_H_ | |
6 | |
7 #include "base/threading/thread.h" | |
8 #include "content/common/content_export.h" | |
9 | |
10 namespace content { | |
11 | |
12 // This class encapulates the logic for the thread and task runners that the | |
13 // AudioManager and related classes run on. audio_task_runner and | |
14 // worker_task_runner should be called on the same thread as the | |
15 // AudioDeviceThread was constructed on. | |
16 class CONTENT_EXPORT AudioDeviceThread { | |
17 public: | |
18 // Constructs and starts the thread. | |
19 AudioDeviceThread(); | |
20 | |
21 scoped_refptr<base::SingleThreadTaskRunner> task_runner() { | |
22 #if defined(OS_MACOSX) | |
23 // On Mac audio task runner must belong to the main thread. | |
24 // See http://crbug.com/158170. | |
25 return base::ThreadTaskRunnerHandle::Get(); | |
26 #else | |
27 return thread_.task_runner(); | |
28 #endif // defined(OS_MACOSX) | |
29 } | |
30 | |
31 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner() { | |
32 return thread_.task_runner(); | |
33 } | |
34 | |
35 private: | |
36 base::Thread thread_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread); | |
39 }; | |
40 | |
41 } // namespace content | |
42 #endif // CONTENT_BROWSER_AUDIO_DEVICE_THREAD_H_ | |
OLD | NEW |