Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: media/audio/audio_thread.h

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: addressed comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9fc46f9825bbca8ea84a74c35c4eaace20e8015a
--- /dev/null
+++ b/media/audio/audio_thread.h
@@ -0,0 +1,36 @@
+// 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.
+ virtual void Stop() = 0;
+
+ // Returns the task runner used for audio IO.
o1ka 2017/05/10 15:57:57 State that both methods should always return valid
alokp 2017/05/10 18:04:03 Done.
+ 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.
o1ka 2017/05/10 15:57:57 Move audio_manager.h l.49 comment here instead? I
alokp 2017/05/10 18:04:03 I do not see a difference in the comments. What ex
o1ka 2017/05/11 13:44:12 The other comment makes more sense, since there is
+ virtual base::SingleThreadTaskRunner* GetWorkerTaskRunner() = 0;
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_AUDIO_THREAD_H_

Powered by Google App Engine
This is Rietveld 408576698