summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/fake_session.cc
diff options
context:
space:
mode:
authorsergeyu <sergeyu@chromium.org>2014-09-08 23:05:38 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-09 06:13:52 +0000
commita29e1639cc388bcb603b025abe28f43cc33bfd09 (patch)
tree04bd3bb128b67f0ab3b65ab64b6cf1662e953095 /remoting/protocol/fake_session.cc
parent63f76caebfb34a72608f8c8e12cf5e466ba9e0cb (diff)
downloadchromium_src-a29e1639cc388bcb603b025abe28f43cc33bfd09.zip
chromium_src-a29e1639cc388bcb603b025abe28f43cc33bfd09.tar.gz
chromium_src-a29e1639cc388bcb603b025abe28f43cc33bfd09.tar.bz2
Cleanup ChannelFactory interface
Removed CreateDatagramChannel() (it was never used) and renamed CreateStreamChannel() to CreateChannel() BUG=402993 Review URL: https://codereview.chromium.org/550383002 Cr-Commit-Position: refs/heads/master@{#293863}
Diffstat (limited to 'remoting/protocol/fake_session.cc')
-rw-r--r--remoting/protocol/fake_session.cc41
1 files changed, 7 insertions, 34 deletions
diff --git a/remoting/protocol/fake_session.cc b/remoting/protocol/fake_session.cc
index 213ae0b..7c62ed2 100644
--- a/remoting/protocol/fake_session.cc
+++ b/remoting/protocol/fake_session.cc
@@ -332,58 +332,31 @@ void FakeSession::Close() {
closed_ = true;
}
-void FakeSession::CreateStreamChannel(
- const std::string& name,
- const StreamChannelCallback& callback) {
+void FakeSession::CreateChannel(const std::string& name,
+ const ChannelCreatedCallback& callback) {
scoped_ptr<FakeSocket> channel;
// If we are in the error state then we put NULL in the channels list, so that
- // NotifyStreamChannelCallback() still calls the callback.
+ // NotifyChannelCreated() still calls the callback.
if (error_ == OK)
channel.reset(new FakeSocket());
stream_channels_[name] = channel.release();
if (async_creation_) {
message_loop_->PostTask(FROM_HERE, base::Bind(
- &FakeSession::NotifyStreamChannelCallback, weak_factory_.GetWeakPtr(),
+ &FakeSession::NotifyChannelCreated, weak_factory_.GetWeakPtr(),
name, callback));
} else {
- NotifyStreamChannelCallback(name, callback);
+ NotifyChannelCreated(name, callback);
}
}
-void FakeSession::NotifyStreamChannelCallback(
+void FakeSession::NotifyChannelCreated(
const std::string& name,
- const StreamChannelCallback& callback) {
+ const ChannelCreatedCallback& callback) {
if (stream_channels_.find(name) != stream_channels_.end())
callback.Run(scoped_ptr<net::StreamSocket>(stream_channels_[name]));
}
-void FakeSession::CreateDatagramChannel(
- const std::string& name,
- const DatagramChannelCallback& callback) {
- scoped_ptr<FakeUdpSocket> channel;
- // If we are in the error state then we put NULL in the channels list, so that
- // NotifyStreamChannelCallback() still calls the callback.
- if (error_ == OK)
- channel.reset(new FakeUdpSocket());
- datagram_channels_[name] = channel.release();
-
- if (async_creation_) {
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &FakeSession::NotifyDatagramChannelCallback, weak_factory_.GetWeakPtr(),
- name, callback));
- } else {
- NotifyDatagramChannelCallback(name, callback);
- }
-}
-
-void FakeSession::NotifyDatagramChannelCallback(
- const std::string& name,
- const DatagramChannelCallback& callback) {
- if (datagram_channels_.find(name) != datagram_channels_.end())
- callback.Run(scoped_ptr<net::Socket>(datagram_channels_[name]));
-}
-
void FakeSession::CancelChannelCreation(const std::string& name) {
stream_channels_.erase(name);
datagram_channels_.erase(name);