Commit f3eda25d authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Update some callbacks to Once/Repeating in //remoting/protocol.

Bug: 1007826
Change-Id: I5f12d7453fd7a5f8c3ea7bb756a6f735ec7759aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2225789
Commit-Queue: Joe Downing <joedow@chromium.org>
Reviewed-by: default avatarJoe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776105}
parent 87d12ea8
...@@ -17,7 +17,7 @@ namespace protocol { ...@@ -17,7 +17,7 @@ namespace protocol {
class AudioSource { class AudioSource {
public: public:
typedef base::Callback<void(std::unique_ptr<AudioPacket> packet)> typedef base::RepeatingCallback<void(std::unique_ptr<AudioPacket> packet)>
PacketCapturedCallback; PacketCapturedCallback;
virtual ~AudioSource() {} virtual ~AudioSource() {}
......
...@@ -83,7 +83,7 @@ class Authenticator { ...@@ -83,7 +83,7 @@ class Authenticator {
// Callback used for layered Authenticator implementations, particularly // Callback used for layered Authenticator implementations, particularly
// third-party and pairing authenticators. They use this callback to create // third-party and pairing authenticators. They use this callback to create
// base SPAKE2 authenticators. // base SPAKE2 authenticators.
typedef base::Callback<std::unique_ptr<Authenticator>( typedef base::RepeatingCallback<std::unique_ptr<Authenticator>(
const std::string& shared_secret, const std::string& shared_secret,
Authenticator::State initial_state)> Authenticator::State initial_state)>
CreateBaseAuthenticatorCallback; CreateBaseAuthenticatorCallback;
......
...@@ -20,7 +20,7 @@ class P2PStreamSocket; ...@@ -20,7 +20,7 @@ class P2PStreamSocket;
// should be used only once for one channel. // should be used only once for one channel.
class ChannelAuthenticator { class ChannelAuthenticator {
public: public:
typedef base::Callback<void(int error, std::unique_ptr<P2PStreamSocket>)> typedef base::OnceCallback<void(int error, std::unique_ptr<P2PStreamSocket>)>
DoneCallback; DoneCallback;
virtual ~ChannelAuthenticator() {} virtual ~ChannelAuthenticator() {}
...@@ -29,7 +29,7 @@ class ChannelAuthenticator { ...@@ -29,7 +29,7 @@ class ChannelAuthenticator {
// authentication is finished. Callback may be invoked before this method // authentication is finished. Callback may be invoked before this method
// returns, and may delete the calling authenticator. // returns, and may delete the calling authenticator.
virtual void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket, virtual void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket,
const DoneCallback& done_callback) = 0; DoneCallback done_callback) = 0;
}; };
} // namespace protocol } // namespace protocol
......
...@@ -12,18 +12,20 @@ ...@@ -12,18 +12,20 @@
namespace remoting { namespace remoting {
namespace protocol { namespace protocol {
typedef base::Callback<void(const std::string& secret)> SecretFetchedCallback; typedef base::RepeatingCallback<void(const std::string& secret)>
typedef base::Callback<void( SecretFetchedCallback;
typedef base::RepeatingCallback<void(
bool pairing_supported, bool pairing_supported,
const SecretFetchedCallback& secret_fetched_callback)> FetchSecretCallback; const SecretFetchedCallback& secret_fetched_callback)>
FetchSecretCallback;
// Callback passed to |FetchTokenCallback|, and called once the client // Callback passed to |FetchTokenCallback|, and called once the client
// authentication finishes. |token| is an opaque string that should be sent // authentication finishes. |token| is an opaque string that should be sent
// directly to the host. |shared_secret| should be used by the client to // directly to the host. |shared_secret| should be used by the client to
// create a V2Authenticator. In case of failure, the callback is called with // create a V2Authenticator. In case of failure, the callback is called with
// an empty |token| and |shared_secret|. // an empty |token| and |shared_secret|.
typedef base::Callback<void(const std::string& token, typedef base::RepeatingCallback<void(const std::string& token,
const std::string& shared_secret)> const std::string& shared_secret)>
ThirdPartyTokenFetchedCallback; ThirdPartyTokenFetchedCallback;
// Fetches a third party token from |token_url|. |host_public_key| is sent to // Fetches a third party token from |token_url|. |host_public_key| is sent to
...@@ -32,7 +34,7 @@ typedef base::Callback<void(const std::string& token, ...@@ -32,7 +34,7 @@ typedef base::Callback<void(const std::string& token,
// "hostjid:abc@example.com/123 clientjid:def@example.org/456". // "hostjid:abc@example.com/123 clientjid:def@example.org/456".
// |token_fetched_callback| is called when the client authentication ends, on // |token_fetched_callback| is called when the client authentication ends, on
// the same thread on which FetchThirdPartyTokenCallback was originally called. // the same thread on which FetchThirdPartyTokenCallback was originally called.
typedef base::Callback<void( typedef base::RepeatingCallback<void(
const std::string& token_url, const std::string& token_url,
const std::string& scope, const std::string& scope,
const ThirdPartyTokenFetchedCallback& token_fetched_callback)> const ThirdPartyTokenFetchedCallback& token_fetched_callback)>
......
...@@ -20,9 +20,9 @@ class MessagePipe; ...@@ -20,9 +20,9 @@ class MessagePipe;
// register a function to handle data from a named data channel. // register a function to handle data from a named data channel.
class DataChannelManager final { class DataChannelManager final {
public: public:
using CreateHandlerCallback = base::Callback<void( using CreateHandlerCallback =
const std::string& name, base::RepeatingCallback<void(const std::string& name,
std::unique_ptr<MessagePipe> pipe)>; std::unique_ptr<MessagePipe> pipe)>;
DataChannelManager(); DataChannelManager();
~DataChannelManager(); ~DataChannelManager();
......
...@@ -29,10 +29,10 @@ FakeChannelAuthenticator::~FakeChannelAuthenticator() = default; ...@@ -29,10 +29,10 @@ FakeChannelAuthenticator::~FakeChannelAuthenticator() = default;
void FakeChannelAuthenticator::SecureAndAuthenticate( void FakeChannelAuthenticator::SecureAndAuthenticate(
std::unique_ptr<P2PStreamSocket> socket, std::unique_ptr<P2PStreamSocket> socket,
const DoneCallback& done_callback) { DoneCallback done_callback) {
socket_ = std::move(socket); socket_ = std::move(socket);
done_callback_ = done_callback; done_callback_ = std::move(done_callback);
if (async_) { if (async_) {
if (result_ != net::OK) { if (result_ != net::OK) {
......
...@@ -21,7 +21,7 @@ class FakeChannelAuthenticator : public ChannelAuthenticator { ...@@ -21,7 +21,7 @@ class FakeChannelAuthenticator : public ChannelAuthenticator {
// ChannelAuthenticator interface. // ChannelAuthenticator interface.
void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket, void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket,
const DoneCallback& done_callback) override; DoneCallback done_callback) override;
private: private:
void OnAuthBytesWritten(int result); void OnAuthBytesWritten(int result);
......
...@@ -54,7 +54,7 @@ class MockChannelCreatedCallback { ...@@ -54,7 +54,7 @@ class MockChannelCreatedCallback {
class TestTransportEventHandler : public IceTransport::EventHandler { class TestTransportEventHandler : public IceTransport::EventHandler {
public: public:
typedef base::Callback<void(ErrorCode error)> ErrorCallback; typedef base::RepeatingCallback<void(ErrorCode error)> ErrorCallback;
TestTransportEventHandler() = default; TestTransportEventHandler() = default;
~TestTransportEventHandler() = default; ~TestTransportEventHandler() = default;
......
...@@ -47,7 +47,8 @@ class JingleSession : public Session { ...@@ -47,7 +47,8 @@ class JingleSession : public Session {
private: private:
friend class JingleSessionManager; friend class JingleSessionManager;
typedef base::Callback<void(JingleMessageReply::ErrorType)> ReplyCallback; typedef base::RepeatingCallback<void(JingleMessageReply::ErrorType)>
ReplyCallback;
explicit JingleSession(JingleSessionManager* session_manager); explicit JingleSession(JingleSessionManager* session_manager);
......
...@@ -36,9 +36,9 @@ class P2PStreamSocket; ...@@ -36,9 +36,9 @@ class P2PStreamSocket;
// e.g. when we the sender sends multiple messages in one TCP packet. // e.g. when we the sender sends multiple messages in one TCP packet.
class MessageReader { class MessageReader {
public: public:
typedef base::Callback<void(std::unique_ptr<CompoundBuffer> message)> typedef base::RepeatingCallback<void(std::unique_ptr<CompoundBuffer> message)>
MessageReceivedCallback; MessageReceivedCallback;
typedef base::Callback<void(int)> ReadFailedCallback; typedef base::RepeatingCallback<void(int)> ReadFailedCallback;
MessageReader(); MessageReader();
virtual ~MessageReader(); virtual ~MessageReader();
......
...@@ -30,7 +30,7 @@ class MonitoredVideoStub : public VideoStub { ...@@ -30,7 +30,7 @@ class MonitoredVideoStub : public VideoStub {
public: public:
// Callback to be called when channel state changes. The Callback should not // Callback to be called when channel state changes. The Callback should not
// destroy the MonitoredVideoStub object. // destroy the MonitoredVideoStub object.
typedef base::Callback<void(bool connected)> ChannelStateCallback; typedef base::RepeatingCallback<void(bool connected)> ChannelStateCallback;
static const int kConnectivityCheckDelaySeconds = 2; static const int kConnectivityCheckDelaySeconds = 2;
......
...@@ -245,10 +245,10 @@ SslHmacChannelAuthenticator::~SslHmacChannelAuthenticator() { ...@@ -245,10 +245,10 @@ SslHmacChannelAuthenticator::~SslHmacChannelAuthenticator() {
void SslHmacChannelAuthenticator::SecureAndAuthenticate( void SslHmacChannelAuthenticator::SecureAndAuthenticate(
std::unique_ptr<P2PStreamSocket> socket, std::unique_ptr<P2PStreamSocket> socket,
const DoneCallback& done_callback) { DoneCallback done_callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
done_callback_ = done_callback; done_callback_ = std::move(done_callback);
int result; int result;
if (is_ssl_server()) { if (is_ssl_server()) {
......
...@@ -64,7 +64,7 @@ class SslHmacChannelAuthenticator : public ChannelAuthenticator { ...@@ -64,7 +64,7 @@ class SslHmacChannelAuthenticator : public ChannelAuthenticator {
// ChannelAuthenticator interface. // ChannelAuthenticator interface.
void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket, void SecureAndAuthenticate(std::unique_ptr<P2PStreamSocket> socket,
const DoneCallback& done_callback) override; DoneCallback done_callback) override;
private: private:
class P2PStreamSocketAdapter; class P2PStreamSocketAdapter;
......
...@@ -21,8 +21,8 @@ namespace protocol { ...@@ -21,8 +21,8 @@ namespace protocol {
StreamMessagePipeAdapter::StreamMessagePipeAdapter( StreamMessagePipeAdapter::StreamMessagePipeAdapter(
std::unique_ptr<P2PStreamSocket> socket, std::unique_ptr<P2PStreamSocket> socket,
const ErrorCallback& error_callback) ErrorCallback error_callback)
: socket_(std::move(socket)), error_callback_(error_callback) { : socket_(std::move(socket)), error_callback_(std::move(error_callback)) {
DCHECK(socket_); DCHECK(socket_);
DCHECK(error_callback_); DCHECK(error_callback_);
} }
......
...@@ -22,10 +22,10 @@ class StreamChannelFactory; ...@@ -22,10 +22,10 @@ class StreamChannelFactory;
// P2PStreamSocket. // P2PStreamSocket.
class StreamMessagePipeAdapter : public MessagePipe { class StreamMessagePipeAdapter : public MessagePipe {
public: public:
typedef base::Callback<void(int)> ErrorCallback; typedef base::OnceCallback<void(int)> ErrorCallback;
StreamMessagePipeAdapter(std::unique_ptr<P2PStreamSocket> socket, StreamMessagePipeAdapter(std::unique_ptr<P2PStreamSocket> socket,
const ErrorCallback& error_callback); ErrorCallback error_callback);
~StreamMessagePipeAdapter() override; ~StreamMessagePipeAdapter() override;
// MessagePipe interface. // MessagePipe interface.
...@@ -49,7 +49,7 @@ class StreamMessagePipeAdapter : public MessagePipe { ...@@ -49,7 +49,7 @@ class StreamMessagePipeAdapter : public MessagePipe {
class StreamMessageChannelFactoryAdapter : public MessageChannelFactory { class StreamMessageChannelFactoryAdapter : public MessageChannelFactory {
public: public:
typedef base::Callback<void(int)> ErrorCallback; typedef base::RepeatingCallback<void(int)> ErrorCallback;
StreamMessageChannelFactoryAdapter( StreamMessageChannelFactoryAdapter(
StreamChannelFactory* stream_channel_factory, StreamChannelFactory* stream_channel_factory,
......
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