| 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 #include "chrome/renderer/media/cast_ipc_dispatcher.h" | 5 #include "chrome/renderer/media/cast_ipc_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "chrome/common/cast_messages.h" | 8 #include "chrome/common/cast_messages.h" |
| 9 #include "chrome/renderer/media/cast_transport_ipc.h" | 9 #include "chrome/renderer/media/cast_transport_ipc.h" |
| 10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 IPC_MESSAGE_HANDLER(CastMsg_RawEvents, OnRawEvents) | 53 IPC_MESSAGE_HANDLER(CastMsg_RawEvents, OnRawEvents) |
| 54 IPC_MESSAGE_HANDLER(CastMsg_Rtt, OnRtt) | 54 IPC_MESSAGE_HANDLER(CastMsg_Rtt, OnRtt) |
| 55 IPC_MESSAGE_HANDLER(CastMsg_RtcpCastMessage, OnRtcpCastMessage) | 55 IPC_MESSAGE_HANDLER(CastMsg_RtcpCastMessage, OnRtcpCastMessage) |
| 56 IPC_MESSAGE_HANDLER(CastMsg_Pli, OnReceivedPli); | 56 IPC_MESSAGE_HANDLER(CastMsg_Pli, OnReceivedPli); |
| 57 IPC_MESSAGE_HANDLER(CastMsg_ReceivedPacket, OnReceivedPacket) | 57 IPC_MESSAGE_HANDLER(CastMsg_ReceivedPacket, OnReceivedPacket) |
| 58 IPC_MESSAGE_UNHANDLED(handled = false) | 58 IPC_MESSAGE_UNHANDLED(handled = false) |
| 59 IPC_END_MESSAGE_MAP() | 59 IPC_END_MESSAGE_MAP() |
| 60 return handled; | 60 return handled; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void CastIPCDispatcher::OnFilterAdded(IPC::Sender* sender) { | 63 void CastIPCDispatcher::OnFilterAdded(IPC::Channel* channel) { |
| 64 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 64 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 65 DCHECK(!global_instance_); | 65 DCHECK(!global_instance_); |
| 66 global_instance_ = this; | 66 global_instance_ = this; |
| 67 sender_ = sender; | 67 sender_ = channel; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void CastIPCDispatcher::OnFilterRemoved() { | 70 void CastIPCDispatcher::OnFilterRemoved() { |
| 71 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 71 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 72 DCHECK_EQ(this, global_instance_); | 72 DCHECK_EQ(this, global_instance_); |
| 73 global_instance_ = NULL; | 73 global_instance_ = NULL; |
| 74 sender_ = NULL; | 74 sender_ = NULL; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void CastIPCDispatcher::OnChannelClosing() { | 77 void CastIPCDispatcher::OnChannelClosing() { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 void CastIPCDispatcher::OnReceivedPacket(int32_t channel_id, | 139 void CastIPCDispatcher::OnReceivedPacket(int32_t channel_id, |
| 140 const media::cast::Packet& packet) { | 140 const media::cast::Packet& packet) { |
| 141 CastTransportIPC* sender = id_map_.Lookup(channel_id); | 141 CastTransportIPC* sender = id_map_.Lookup(channel_id); |
| 142 if (sender) { | 142 if (sender) { |
| 143 sender->OnReceivedPacket(packet); | 143 sender->OnReceivedPacket(packet); |
| 144 } else { | 144 } else { |
| 145 DVLOG(1) << "CastIPCDispatcher::OnReceievdPacket on non-existing channel."; | 145 DVLOG(1) << "CastIPCDispatcher::OnReceievdPacket on non-existing channel."; |
| 146 } | 146 } |
| 147 } | 147 } |
| OLD | NEW |