Commit e422e422 authored by Jose Lopes's avatar Jose Lopes Committed by Commit Bot

media: Migrate CastTransportStatusCallback to repeating callback.

This is a repeating callback because it is run as part of an event
handler, which can be fired repeatedly:
* https://cs.chromium.org/chromium/src/chrome/renderer/media/cast_transport_ipc.cc?rcl=5703e03dce1a4499c9885d2a42342acfe831c36c&l=118

The event handler is called from an IPC handler:
* https://cs.chromium.org/chromium/src/chrome/renderer/media/cast_ipc_dispatcher.cc?rcl=5703e03dce1a4499c9885d2a42342acfe831c36c&l=82

registered in:
* https://cs.chromium.org/chromium/src/chrome/renderer/media/cast_ipc_dispatcher.cc?rcl=5703e03dce1a4499c9885d2a42342acfe831c36c&l=52

This is part of the base::Callback migration.

Context: https://cs.chromium.org/chromium/src/docs/callback.md?rcl=9fcc3764aea8f97e9f6de4a9ee61d554e67edcda&l=40

Bug: 714018
Change-Id: I7986567aa2191c1566d82b55df7d74a89699786a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2073879
Commit-Queue: Jose Lopes <jabolopes@google.com>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745396}
parent a20746ba
...@@ -78,8 +78,8 @@ void CastSessionDelegateBase::StartUDP( ...@@ -78,8 +78,8 @@ void CastSessionDelegateBase::StartUDP(
local_endpoint, remote_endpoint, std::move(options), local_endpoint, remote_endpoint, std::move(options),
base::Bind(&CastSessionDelegateBase::ReceivePacket, base::Bind(&CastSessionDelegateBase::ReceivePacket,
base::Unretained(this)), base::Unretained(this)),
base::Bind(&CastSessionDelegateBase::StatusNotificationCB, base::BindRepeating(&CastSessionDelegateBase::StatusNotificationCB,
base::Unretained(this), error_callback), base::Unretained(this), error_callback),
base::BindRepeating( base::BindRepeating(
&media::cast::LogEventDispatcher::DispatchBatchOfEvents, &media::cast::LogEventDispatcher::DispatchBatchOfEvents,
base::Unretained(cast_environment_->logger()))); base::Unretained(cast_environment_->logger())));
......
...@@ -19,11 +19,11 @@ CastTransportIPC::CastTransportIPC( ...@@ -19,11 +19,11 @@ CastTransportIPC::CastTransportIPC(
const net::IPEndPoint& remote_end_point, const net::IPEndPoint& remote_end_point,
std::unique_ptr<base::DictionaryValue> options, std::unique_ptr<base::DictionaryValue> options,
const media::cast::PacketReceiverCallback& packet_callback, const media::cast::PacketReceiverCallback& packet_callback,
const media::cast::CastTransportStatusCallback& status_cb, media::cast::CastTransportStatusCallback status_callback,
BulkRawEventsCallback raw_events_cb) BulkRawEventsCallback raw_events_cb)
: channel_id_(-1), : channel_id_(-1),
packet_callback_(packet_callback), packet_callback_(packet_callback),
status_callback_(status_cb), status_callback_(std::move(status_callback)),
raw_events_callback_(std::move(raw_events_cb)) { raw_events_callback_(std::move(raw_events_cb)) {
if (CastIPCDispatcher::Get()) { if (CastIPCDispatcher::Get()) {
// TODO(miu): CastIPCDispatcher should be provided as a ctor argument. // TODO(miu): CastIPCDispatcher should be provided as a ctor argument.
......
...@@ -31,7 +31,7 @@ class CastTransportIPC : public media::cast::CastTransport { ...@@ -31,7 +31,7 @@ class CastTransportIPC : public media::cast::CastTransport {
const net::IPEndPoint& remote_end_point, const net::IPEndPoint& remote_end_point,
std::unique_ptr<base::DictionaryValue> options, std::unique_ptr<base::DictionaryValue> options,
const media::cast::PacketReceiverCallback& packet_callback, const media::cast::PacketReceiverCallback& packet_callback,
const media::cast::CastTransportStatusCallback& status_cb, media::cast::CastTransportStatusCallback status_callback,
BulkRawEventsCallback raw_events_cb); BulkRawEventsCallback raw_events_cb);
~CastTransportIPC() override; ~CastTransportIPC() override;
......
...@@ -45,7 +45,7 @@ struct RtcpTimeData; ...@@ -45,7 +45,7 @@ struct RtcpTimeData;
// Following the initialization of either audio or video an initialization // Following the initialization of either audio or video an initialization
// status will be sent via this callback. // status will be sent via this callback.
using CastTransportStatusCallback = using CastTransportStatusCallback =
base::Callback<void(CastTransportStatus status)>; base::RepeatingCallback<void(CastTransportStatus status)>;
// Interface to handle received RTCP messages on RTP sender. // Interface to handle received RTCP messages on RTP sender.
class RtcpObserver { class RtcpObserver {
......
...@@ -54,7 +54,7 @@ UdpTransportImpl::UdpTransportImpl( ...@@ -54,7 +54,7 @@ UdpTransportImpl::UdpTransportImpl(
const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy,
const net::IPEndPoint& local_end_point, const net::IPEndPoint& local_end_point,
const net::IPEndPoint& remote_end_point, const net::IPEndPoint& remote_end_point,
const CastTransportStatusCallback& status_callback) CastTransportStatusCallback status_callback)
: io_thread_proxy_(io_thread_proxy), : io_thread_proxy_(io_thread_proxy),
local_addr_(local_end_point), local_addr_(local_end_point),
remote_addr_(remote_end_point), remote_addr_(remote_end_point),
...@@ -67,7 +67,7 @@ UdpTransportImpl::UdpTransportImpl( ...@@ -67,7 +67,7 @@ UdpTransportImpl::UdpTransportImpl(
next_dscp_value_(net::DSCP_NO_CHANGE), next_dscp_value_(net::DSCP_NO_CHANGE),
send_buffer_size_(media::cast::kMaxBurstSize * send_buffer_size_(media::cast::kMaxBurstSize *
media::cast::kMaxIpPacketSize), media::cast::kMaxIpPacketSize),
status_callback_(status_callback), status_callback_(std::move(status_callback)),
bytes_sent_(0) { bytes_sent_(0) {
DCHECK(!IsEmpty(local_end_point) || !IsEmpty(remote_end_point)); DCHECK(!IsEmpty(local_end_point) || !IsEmpty(remote_end_point));
} }
......
...@@ -45,7 +45,7 @@ class UdpTransportImpl final : public PacketTransport, public UdpTransport { ...@@ -45,7 +45,7 @@ class UdpTransportImpl final : public PacketTransport, public UdpTransport {
const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy, const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_proxy,
const net::IPEndPoint& local_end_point, const net::IPEndPoint& local_end_point,
const net::IPEndPoint& remote_end_point, const net::IPEndPoint& remote_end_point,
const CastTransportStatusCallback& status_callback); CastTransportStatusCallback status_callback);
~UdpTransportImpl() final; ~UdpTransportImpl() final;
// PacketTransport implementations. // PacketTransport implementations.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment