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

Side by Side Diff: content/renderer/media/audio_output_ipc_factory.h

Issue 2289543003: IPC->mojo of audio_renderer_host (Closed)
Patch Set: New interface. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_IPC_FACTORY_H_
6 #define CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_IPC_FACTORY_H_
7
8 #include <map>
9 #include <memory>
10
11 #include "base/id_map.h"
12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/synchronization/lock.h"
15 #include "content/common/content_export.h"
16 #include "media/audio/audio_output_ipc.h"
17 #include "media/mojo/interfaces/audio_output.mojom.h"
18 /*
19 namespace base {
20 class SingleThreadTaskRunner;
21 }
22
23 namespace media {
24 class AudioParameters;
25 }
26
27 namespace shell {
28 class InterfaceProvider;
29 }
30
31 namespace content {
32
33 // AudioOutputIPCFactory creates AudioOutputIPC objects that proxy calls to the
34 // corresponding AudioOutput mojo service. This class is intended to replace
35 // AudioMessageFilter.
36 class CONTENT_EXPORT AudioOutputIPCFactory
37 : public base::RefCountedThreadSafe<AudioOutputIPCFactory> {
38 public:
39 // All non-constructor, non-static calls must be made on the io thread.
40 explicit AudioOutputIPCFactory(
41 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
42 shell::InterfaceProvider* interface_provider);
43
44 // AudioOutputIPCFactory is accessed from multiple threads, resulting in the
45 // need for this static getter. Threads that don't access
46 // AudioOutputIPCFactory on the main render thread do not have access to the
47 // RenderThreadImpl getter.
48 static const scoped_refptr<AudioOutputIPCFactory> Get();
49
50 // Creates an AudioOutputStreamClient that will lazily bind itself to an
51 // AudioOutputStreamService when used. All calls must be made on the io thread
52 // provided by io_task_runner();
53 std::unique_ptr<media::AudioOutputIPC> CreateAudioOutputIPC(
54 int render_frame_id);
55
56 // The task runner associated with the AudioOutputIPCFactory.
57 base::SingleThreadTaskRunner* io_task_runner() const {
58 return io_task_runner_.get();
59 }
60
61 protected:
62 virtual ~AudioOutputIPCFactory();
63
64 private:
65 friend class base::RefCountedThreadSafe<AudioOutputIPCFactory>;
66
67 // Implementation of media::AudioOutputIPC which directly communicates with an
68 // AudioOutputStreamService in the Browser process.
69 class MojoAudioOutputIPC;
70
71 // Handles connection errors with the AudioOutputService.
72 void OnConnectionError();
73 void NotifyConnectionClose();
74
75 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
76 media::mojom::AudioOutputPtr output_service_;
77
78 IDMap<media::AudioOutputIPCDelegate> delegates_;
79 static AudioOutputIPCFactory* g_audio_output_ipc_factory;
80
81 DISALLOW_COPY_AND_ASSIGN(AudioOutputIPCFactory);
82 };
83
84 } // namespace content
85 */
86 #endif // CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_IPC_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698