Index: content/browser/audio_device_thread.h |
diff --git a/content/browser/audio_device_thread.h b/content/browser/audio_device_thread.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c057576704e06bee9410b2c4ea8ded5c97dac601 |
--- /dev/null |
+++ b/content/browser/audio_device_thread.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+#ifndef CONTENT_BROWSER_AUDIO_DEVICE_THREAD_H_ |
+#define CONTENT_BROWSER_AUDIO_DEVICE_THREAD_H_ |
+ |
+#include "base/threading/thread.h" |
DaleCurtis
2016/12/02 18:20:13
#include build/build_config.h for OS_###
|
+#include "base/threading/thread_task_runner_handle.h" |
+#include "content/common/content_export.h" |
+ |
+namespace content { |
+ |
+// This class encapulates the logic for the thread and task runners that the |
+// AudioManager and related classes run on. audio_task_runner and |
+// worker_task_runner should be called on the same thread as the |
+// AudioDeviceThread was constructed on. |
+class CONTENT_EXPORT AudioDeviceThread { |
+ public: |
+ // Constructs and starts the thread. |
+ AudioDeviceThread(); |
+ |
DaleCurtis
2016/12/02 18:20:13
I thought complex classes were required to have ou
|
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner() { |
+#if defined(OS_MACOSX) |
+ // On Mac audio task runner must belong to the main thread. |
+ // See http://crbug.com/158170. |
+ return base::ThreadTaskRunnerHandle::Get(); |
DaleCurtis
2016/12/02 18:20:13
Probably should be stored instead if we're using h
|
+#else |
+ return thread_.task_runner(); |
+#endif // defined(OS_MACOSX) |
+ } |
+ |
+ scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner() { |
+ return thread_.task_runner(); |
+ } |
+ |
+ private: |
+ base::Thread thread_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AudioDeviceThread); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_AUDIO_DEVICE_THREAD_H_ |