| Index: content/browser/media/audio_debug_recording_impl.h
|
| diff --git a/content/browser/media/audio_debug_recording_impl.h b/content/browser/media/audio_debug_recording_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9fa738397c72efcffcd76219d8120d540a54575e
|
| --- /dev/null
|
| +++ b/content/browser/media/audio_debug_recording_impl.h
|
| @@ -0,0 +1,88 @@
|
| +// 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_RECORDING_IMPL_H_
|
| +#define CONTENT_BROWSER_MEDIA_AUDIO_DEBUG_RECORDING_IMPL_H_
|
| +
|
| +#include <map>
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/threading/thread_checker.h"
|
| +#include "content/common/content_export.h"
|
| +#include "content/common/media/audio_debug_recording.mojom.h"
|
| +#include "mojo/public/cpp/bindings/binding.h"
|
| +
|
| +namespace base {
|
| +class FilePath;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +class AudioInputRendererHost;
|
| +
|
| +// Implementation of the AudioDebugRecording Mojo service, which is used by
|
| +// renderers to listen for notifications about enabling audio debug recordings.
|
| +// A renderer that wishes to listen for notifications will register an observer
|
| +// by calling RegisterObserver(). When it wishes to stop, it deletes its
|
| +// observer, which will automatically deregister it. There should be one
|
| +// AudioDebugRecordingImpl per renderer host, created the first time the
|
| +// renderer process tries to connect to the Mojo service.
|
| +//
|
| +// This class must always be accessed from the creation thread.
|
| +class CONTENT_EXPORT AudioDebugRecordingImpl
|
| + : NON_EXPORTED_BASE(public AudioDebugRecording) {
|
| + public:
|
| + using DisconnectCallback = base::Callback<void(AudioDebugRecordingImpl*)>;
|
| +
|
| + AudioDebugRecordingImpl(
|
| + int render_host_id,
|
| + const scoped_refptr<AudioInputRendererHost>& audio_input_renderer_host,
|
| + const DisconnectCallback& disconnect_cb,
|
| + mojo::InterfaceRequest<AudioDebugRecording> request);
|
| + ~AudioDebugRecordingImpl() override;
|
| +
|
| + // Enables/disables audio debug recordings.
|
| + void EnableAudioDebugRecording(const base::FilePath& file);
|
| + void DisableAudioDebugRecording();
|
| +
|
| + int render_host_id() const { return render_host_id_; }
|
| +
|
| + private:
|
| + friend class AudioDebugRecordingImplTest;
|
| +
|
| + class DumpObserver;
|
| +
|
| + // |AudioDebugRecording| implementaion.
|
| + void RegisterObserver(int32_t id,
|
| + AudioDebugRecordingObserverPtr observer) override;
|
| +
|
| + // Mojo connection error callback.
|
| + void OnConnectionError();
|
| +
|
| + void RemoveObserver(int32_t observer_id);
|
| +
|
| + // Render process host ID.
|
| + const int render_host_id_;
|
| +
|
| + const scoped_refptr<AudioInputRendererHost> audio_input_renderer_host_;
|
| +
|
| + // Callback for Mojo disconnections.
|
| + const DisconnectCallback disconnect_cb_;
|
| +
|
| + // Map of observer ID to connected dump observer.
|
| + std::map<int32_t, scoped_ptr<DumpObserver>> observers_;
|
| +
|
| + mojo::Binding<AudioDebugRecording> binding_;
|
| + base::ThreadChecker thread_checker_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AudioDebugRecordingImpl);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_MEDIA_AUDIO_DEBUG_RECORDING_IMPL_H_
|
|
|