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

Unified Diff: content/renderer/media/audio_output_ipc_factory.h

Issue 2289543003: IPC->mojo of audio_renderer_host (Closed)
Patch Set: It builds \o/. Created 4 years, 3 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: content/renderer/media/audio_output_ipc_factory.h
diff --git a/content/renderer/media/audio_output_ipc_factory.h b/content/renderer/media/audio_output_ipc_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..0ce8da28173c29e7f2cb20da441b5582ee369303
--- /dev/null
+++ b/content/renderer/media/audio_output_ipc_factory.h
@@ -0,0 +1,87 @@
+// 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_RENDERER_MEDIA_AUDIO_OUTPUT_IPC_FACTORY_H_
+#define CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_IPC_FACTORY_H_
+
+#include <map>
+#include <memory>
+
+#include "base/id_map.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/synchronization/lock.h"
+#include "content/common/content_export.h"
+#include "media/audio/audio_output_ipc.h"
+#include "media/mojo/interfaces/audio_output.mojom.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace media {
+class AudioParameters;
+}
+
+namespace shell {
+class InterfaceProvider;
+}
+
+namespace content {
+
+// AudioOutputIPCFactory creates AudioOutputIPC objects that proxy calls to
Henrik Grunell 2016/09/01 15:09:07 It seems like the main purpose for AudioOutputIPC
Max Morin 2016/09/02 10:27:07 I haven't looked into this class much yet. Hopeful
+// the corresponding AudioOutput mojo service. This class is intended to replace
+// AudioMessageFilter.
+class CONTENT_EXPORT AudioOutputIPCFactory
+ : public base::RefCountedThreadSafe<AudioOutputIPCFactory> {
+ public:
+ // All non-constructor, non-static calls must be made on the io thread.
+ explicit AudioOutputIPCFactory(
+ const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
+ shell::InterfaceProvider* interface_provider);
+
+ // AudioOutputIPCFactory is accessed from multiple threads, resulting in the
+ // need
+ // for this static getter. Threads that don't access AudioOutputIPCFactory on
+ // the
o1ka 2016/09/02 07:31:46 nit: please fix the formatting.
+ // main render thread do not have access to the RenderThreadImpl getter.
+ static const scoped_refptr<AudioOutputIPCFactory> Get();
+
+ // Creates an AudioOutputStreamClient that will lazily bind itself to an
+ // AudioOutputStreamService when used. All calls must be made on the io
+ // thread provided by io_task_runner();
+ std::unique_ptr<media::AudioOutputIPC> CreateAudioOutputIPC(
+ int render_frame_id);
+
+ // The task runner associated with the AudioOutputIPCFactory.
+ base::SingleThreadTaskRunner* io_task_runner() const {
+ return io_task_runner_.get();
+ }
+
+ protected:
+ virtual ~AudioOutputIPCFactory();
+
+ private:
+ friend class base::RefCountedThreadSafe<AudioOutputIPCFactory>;
+
+ // Implementation of media::AudioOutputIPC which directly communicates
+ // with an AudioOutputStreamService in the Browser process.
+ class MojoAudioOutputIPC;
+
+ // Handles connection errors with the AudioOutputService.
+ void OnConnectionError();
+ void NotifyConnectionClose();
+
+ const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
+ media::mojom::AudioOutputPtr output_service_;
+
+ IDMap<media::AudioOutputIPCDelegate> delegates_;
+ static AudioOutputIPCFactory* g_audio_output_ipc_factory;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioOutputIPCFactory);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_IPC_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698