| 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_transport_sender_ipc.h" | 5 #include "chrome/renderer/media/cast_transport_sender_ipc.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "chrome/common/cast_messages.h" | 9 #include "chrome/common/cast_messages.h" |
| 10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" | 10 #include "chrome/renderer/media/cast_ipc_dispatcher.h" |
| 11 #include "ipc/ipc_channel_proxy.h" | 11 #include "ipc/ipc_channel_proxy.h" |
| 12 #include "media/cast/cast_sender.h" | 12 #include "media/cast/cast_sender.h" |
| 13 #include "media/cast/transport/cast_transport_sender.h" | 13 #include "media/cast/transport/cast_transport_sender.h" |
| 14 | 14 |
| 15 CastTransportSenderIPC::CastTransportSenderIPC( | 15 CastTransportSenderIPC::CastTransportSenderIPC( |
| 16 const net::IPEndPoint& remote_end_point, | 16 const net::IPEndPoint& remote_end_point, |
| 17 const media::cast::transport::CastTransportStatusCallback& status_cb, | 17 const media::cast::transport::CastTransportStatusCallback& status_cb, |
| 18 const media::cast::CastLoggingConfig& logging_config, | |
| 19 const media::cast::transport::BulkRawEventsCallback& raw_events_cb) | 18 const media::cast::transport::BulkRawEventsCallback& raw_events_cb) |
| 20 : status_callback_(status_cb), raw_events_callback_(raw_events_cb) { | 19 : status_callback_(status_cb), raw_events_callback_(raw_events_cb) { |
| 21 if (CastIPCDispatcher::Get()) { | 20 if (CastIPCDispatcher::Get()) { |
| 22 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); | 21 channel_id_ = CastIPCDispatcher::Get()->AddSender(this); |
| 23 } | 22 } |
| 24 Send(new CastHostMsg_New(channel_id_, remote_end_point, logging_config)); | 23 Send(new CastHostMsg_New(channel_id_, remote_end_point)); |
| 25 } | 24 } |
| 26 | 25 |
| 27 CastTransportSenderIPC::~CastTransportSenderIPC() { | 26 CastTransportSenderIPC::~CastTransportSenderIPC() { |
| 28 Send(new CastHostMsg_Delete(channel_id_)); | 27 Send(new CastHostMsg_Delete(channel_id_)); |
| 29 if (CastIPCDispatcher::Get()) { | 28 if (CastIPCDispatcher::Get()) { |
| 30 CastIPCDispatcher::Get()->RemoveSender(channel_id_); | 29 CastIPCDispatcher::Get()->RemoveSender(channel_id_); |
| 31 } | 30 } |
| 32 } | 31 } |
| 33 | 32 |
| 34 void CastTransportSenderIPC::SetPacketReceiver( | 33 void CastTransportSenderIPC::SetPacketReceiver( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 raw_events_callback_.Run(packet_events); | 131 raw_events_callback_.Run(packet_events); |
| 133 } | 132 } |
| 134 | 133 |
| 135 void CastTransportSenderIPC::Send(IPC::Message* message) { | 134 void CastTransportSenderIPC::Send(IPC::Message* message) { |
| 136 if (CastIPCDispatcher::Get()) { | 135 if (CastIPCDispatcher::Get()) { |
| 137 CastIPCDispatcher::Get()->Send(message); | 136 CastIPCDispatcher::Get()->Send(message); |
| 138 } else { | 137 } else { |
| 139 delete message; | 138 delete message; |
| 140 } | 139 } |
| 141 } | 140 } |
| OLD | NEW |