OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_ | 5 #ifndef CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_ |
6 #define CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_ | 6 #define CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
10 #include "ipc/ipc_channel_proxy.h" | 10 #include "ipc/ipc_channel_proxy.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 explicit CastIPCDispatcher( | 22 explicit CastIPCDispatcher( |
23 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); | 23 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); |
24 | 24 |
25 static CastIPCDispatcher* Get(); | 25 static CastIPCDispatcher* Get(); |
26 void Send(IPC::Message* message); | 26 void Send(IPC::Message* message); |
27 int32 AddSender(CastTransportSenderIPC* sender); | 27 int32 AddSender(CastTransportSenderIPC* sender); |
28 void RemoveSender(int32 channel_id); | 28 void RemoveSender(int32 channel_id); |
29 | 29 |
30 // IPC::MessageFilter implementation | 30 // IPC::MessageFilter implementation |
31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
32 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; | 32 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; |
33 virtual void OnFilterRemoved() OVERRIDE; | 33 virtual void OnFilterRemoved() OVERRIDE; |
34 virtual void OnChannelClosing() OVERRIDE; | 34 virtual void OnChannelClosing() OVERRIDE; |
35 | 35 |
36 protected: | 36 protected: |
37 virtual ~CastIPCDispatcher(); | 37 virtual ~CastIPCDispatcher(); |
38 | 38 |
39 private: | 39 private: |
40 void OnReceivedPacket(int32 channel_id, const media::cast::Packet& packet); | 40 void OnReceivedPacket(int32 channel_id, const media::cast::Packet& packet); |
41 void OnNotifyStatusChange( | 41 void OnNotifyStatusChange( |
42 int32 channel_id, | 42 int32 channel_id, |
43 media::cast::transport::CastTransportStatus status); | 43 media::cast::transport::CastTransportStatus status); |
44 void OnRtpStatistics( | 44 void OnRtpStatistics( |
45 int32 channel_id, | 45 int32 channel_id, |
46 bool audio, | 46 bool audio, |
47 const media::cast::transport::RtcpSenderInfo& sender_info, | 47 const media::cast::transport::RtcpSenderInfo& sender_info, |
48 base::TimeTicks time_sent, | 48 base::TimeTicks time_sent, |
49 uint32 rtp_timestamp); | 49 uint32 rtp_timestamp); |
50 void OnRawEvents(int32 channel_id, | 50 void OnRawEvents(int32 channel_id, |
51 const std::vector<media::cast::PacketEvent>& packet_events); | 51 const std::vector<media::cast::PacketEvent>& packet_events); |
52 | 52 |
53 static CastIPCDispatcher* global_instance_; | 53 static CastIPCDispatcher* global_instance_; |
54 | 54 |
55 // IPC channel for Send(); must only be accesed on |io_message_loop_|. | 55 // For IPC Send(); must only be accesed on |io_message_loop_|. |
56 IPC::Channel* channel_; | 56 IPC::Sender* sender_; |
57 | 57 |
58 // Message loop on which IPC calls are driven. | 58 // Message loop on which IPC calls are driven. |
59 const scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 59 const scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
60 | 60 |
61 // A map of stream ids to delegates; must only be accessed on | 61 // A map of stream ids to delegates; must only be accessed on |
62 // |io_message_loop_|. | 62 // |io_message_loop_|. |
63 IDMap<CastTransportSenderIPC> id_map_; | 63 IDMap<CastTransportSenderIPC> id_map_; |
64 DISALLOW_COPY_AND_ASSIGN(CastIPCDispatcher); | 64 DISALLOW_COPY_AND_ASSIGN(CastIPCDispatcher); |
65 }; | 65 }; |
66 | 66 |
67 #endif // CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_ | 67 #endif // CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_ |
OLD | NEW |