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

Side by Side Diff: chrome/renderer/media/cast_ipc_dispatcher.h

Issue 1123733002: [chrome/renderer/media] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding changes Created 5 years, 7 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
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 "base/thread_task_runner_handle.h"
10 #include "ipc/ipc_channel_proxy.h" 11 #include "ipc/ipc_channel_proxy.h"
11 #include "ipc/message_filter.h" 12 #include "ipc/message_filter.h"
12 #include "media/cast/cast_sender.h" 13 #include "media/cast/cast_sender.h"
13 #include "media/cast/logging/logging_defines.h" 14 #include "media/cast/logging/logging_defines.h"
14 #include "media/cast/net/cast_transport_sender.h" 15 #include "media/cast/net/cast_transport_sender.h"
15 16
16 class CastTransportSenderIPC; 17 class CastTransportSenderIPC;
17 18
18 // This dispatcher listens to incoming IPC messages and sends 19 // This dispatcher listens to incoming IPC messages and sends
19 // the call to the correct CastTransportSenderIPC instance. 20 // the call to the correct CastTransportSenderIPC instance.
20 class CastIPCDispatcher : public IPC::MessageFilter { 21 class CastIPCDispatcher : public IPC::MessageFilter {
21 public: 22 public:
22 explicit CastIPCDispatcher( 23 explicit CastIPCDispatcher(
23 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); 24 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
24 25
25 static CastIPCDispatcher* Get(); 26 static CastIPCDispatcher* Get();
26 void Send(IPC::Message* message); 27 void Send(IPC::Message* message);
27 int32 AddSender(CastTransportSenderIPC* sender); 28 int32 AddSender(CastTransportSenderIPC* sender);
28 void RemoveSender(int32 channel_id); 29 void RemoveSender(int32 channel_id);
29 30
30 // IPC::MessageFilter implementation 31 // IPC::MessageFilter implementation
31 bool OnMessageReceived(const IPC::Message& message) override; 32 bool OnMessageReceived(const IPC::Message& message) override;
32 void OnFilterAdded(IPC::Sender* sender) override; 33 void OnFilterAdded(IPC::Sender* sender) override;
33 void OnFilterRemoved() override; 34 void OnFilterRemoved() override;
(...skipping 19 matching lines...) Expand all
53 void OnRtcpCastMessage(int32 channel_id, 54 void OnRtcpCastMessage(int32 channel_id,
54 uint32 ssrc, 55 uint32 ssrc,
55 const media::cast::RtcpCastMessage& cast_message); 56 const media::cast::RtcpCastMessage& cast_message);
56 void OnReceivedPacket(int32 channel_id, const media::cast::Packet& packet); 57 void OnReceivedPacket(int32 channel_id, const media::cast::Packet& packet);
57 58
58 static CastIPCDispatcher* global_instance_; 59 static CastIPCDispatcher* global_instance_;
59 60
60 // For IPC Send(); must only be accesed on |io_message_loop_|. 61 // For IPC Send(); must only be accesed on |io_message_loop_|.
61 IPC::Sender* sender_; 62 IPC::Sender* sender_;
62 63
63 // Message loop on which IPC calls are driven. 64 // Message loop on which IPC calls are driven.
xhwang 2015/05/05 16:01:57 Update this comment as well.
anujsharma 2015/05/06 03:42:45 Done.
64 const scoped_refptr<base::MessageLoopProxy> io_message_loop_; 65 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
65 66
66 // A map of stream ids to delegates; must only be accessed on 67 // A map of stream ids to delegates; must only be accessed on
67 // |io_message_loop_|. 68 // |io_message_loop_|.
68 IDMap<CastTransportSenderIPC> id_map_; 69 IDMap<CastTransportSenderIPC> id_map_;
69 DISALLOW_COPY_AND_ASSIGN(CastIPCDispatcher); 70 DISALLOW_COPY_AND_ASSIGN(CastIPCDispatcher);
70 }; 71 };
71 72
72 #endif // CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_ 73 #endif // CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/media/cast_ipc_dispatcher.cc » ('j') | chrome/renderer/media/cast_session.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698