Chromium Code Reviews| Index: media/audio/audio_thread.h |
| diff --git a/media/audio/audio_thread.h b/media/audio/audio_thread.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..856a39299d54902242bc50e0edc3d8322e2e8640 |
| --- /dev/null |
| +++ b/media/audio/audio_thread.h |
| @@ -0,0 +1,38 @@ |
| +// Copyright 2017 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 MEDIA_AUDIO_AUDIO_THREAD_H_ |
| +#define MEDIA_AUDIO_AUDIO_THREAD_H_ |
| + |
| +#include "media/base/media_export.h" |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} // namespace base |
| + |
| +namespace media { |
| + |
| +// This class encapulates the logic for the thread and task runners that the |
| +// AudioManager and related classes run on. |
| +class MEDIA_EXPORT AudioThread { |
| + public: |
| + virtual ~AudioThread() {} |
| + |
| + // Synchronously stops all underlying threads. |
| + // Both - GetTaskRunner and GetWorkerTaskRunner - will return null after this |
|
o1ka
2017/04/28 13:24:20
Should AudioManager check for null?
alokp
2017/05/09 19:06:15
Removed comment. Now we continue to return a task
|
| + // function is called. |
| + virtual void Stop() = 0; |
| + |
| + // Returns the task runner used for audio IO. |
| + virtual base::SingleThreadTaskRunner* GetTaskRunner() = 0; |
| + |
| + // Heavyweight tasks should use GetWorkerTaskRunner() instead of |
| + // GetTaskRunner(). On most platforms they are the same, but some share the |
| + // UI loop with the audio IO loop. |
| + virtual base::SingleThreadTaskRunner* GetWorkerTaskRunner() = 0; |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_AUDIO_AUDIO_THREAD_H_ |