Index: content/browser/media/audio_debug_controller.h |
diff --git a/content/browser/media/audio_debug_controller.h b/content/browser/media/audio_debug_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..06e9be94c75a7dbfba2ad4215131a42ea6ecce30 |
--- /dev/null |
+++ b/content/browser/media/audio_debug_controller.h |
@@ -0,0 +1,74 @@ |
+// Copyright 2015 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_MEDIA_AUDIO_DEBUG_CONTROLLER_H_ |
+#define CONTENT_BROWSER_MEDIA_AUDIO_DEBUG_CONTROLLER_H_ |
+ |
+#include <set> |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/threading/thread_checker.h" |
+#include "content/common/media/audio_debug_recording.mojom.h" |
+ |
+namespace base { |
+ |
+template <typename T> |
+struct DefaultSingletonTraits; |
+ |
+class FilePath; |
+ |
+} // namespace base |
+ |
+namespace content { |
+ |
+class AudioDebugRecordingImpl; |
+class AudioInputRendererHost; |
+ |
+// Singleton factory used to create and manage new AudioDebugRecording service |
+// instances for renderers. |
+// |
+// All functions must be called on the same thread. |
+class AudioDebugController { |
+ public: |
+ static AudioDebugController* GetInstance(); |
+ |
+ // Factory method to create a new AudioDebugRecording service instance. |
+ static void CreateService( |
+ int render_host_id, |
+ const scoped_refptr<AudioInputRendererHost>& audio_input_renderer_host, |
+ mojo::InterfaceRequest<AudioDebugRecording> request); |
+ |
+ // Enable/disable audio debug recordings for all renderers. |
+ void EnableAudioDebugRecording(const base::FilePath& file); |
+ void DisableAudioDebugRecording(); |
+ |
+ // Enable/disable audio debug recordings for a specific renderer. |
+ void EnableAudioDebugRecordingForHost(int render_host_id, |
+ const base::FilePath& file); |
+ void DisableAudioDebugRecordingForHost(int render_host_id); |
+ |
+ private: |
+ AudioDebugController(); |
+ ~AudioDebugController(); |
+ friend struct base::DefaultSingletonTraits<AudioDebugController>; |
+ |
+ void CreateServiceInternal( |
+ int render_host_id, |
+ const scoped_refptr<AudioInputRendererHost>& audio_input_renderer_host, |
+ mojo::InterfaceRequest<AudioDebugRecording> request); |
+ |
+ // Service disconnection callback. |
+ void OnDisconnect(AudioDebugRecordingImpl* impl); |
+ |
+ // Owns AudioDebugRecordingImpl. |
+ std::set<AudioDebugRecordingImpl*> registered_impls_; |
+ base::ThreadChecker thread_checker_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AudioDebugController); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_MEDIA_AUDIO_DEBUG_CONTROLLER_H_ |