Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1434)

Unified Diff: remoting/protocol/connection_to_host.cc

Issue 8587053: Remove event_channel() and control_channel() from Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/connection_to_host.h ('k') | remoting/protocol/fake_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/connection_to_host.cc
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
index 5eb438ae16a8cdd1a29c44e081dda49f224af57b..f3638adbd2d74584514ffa3ecc63bd3975f05dc0 100644
--- a/remoting/protocol/connection_to_host.cc
+++ b/remoting/protocol/connection_to_host.cc
@@ -35,17 +35,14 @@ ConnectionToHost::ConnectionToHost(
client_stub_(NULL),
video_stub_(NULL),
state_(CONNECTING),
- error_(OK),
- control_connected_(false),
- input_connected_(false),
- video_connected_(false) {
+ error_(OK) {
}
ConnectionToHost::~ConnectionToHost() {
}
InputStub* ConnectionToHost::input_stub() {
- return input_dispatcher_.get();
+ return event_dispatcher_.get();
}
HostStub* ConnectionToHost::host_stub() {
@@ -190,24 +187,19 @@ void ConnectionToHost::OnSessionStateChange(
break;
case Session::CONNECTED:
- video_reader_.reset(
- VideoReader::Create(message_loop_, session_->config()));
- video_reader_->Init(
- session_.get(), video_stub_,
- base::Bind(&ConnectionToHost::OnVideoChannelInitialized,
- base::Unretained(this)));
- break;
+ video_reader_.reset(VideoReader::Create(
+ message_loop_, session_->config()));
+ video_reader_->Init(session_.get(), video_stub_, base::Bind(
+ &ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
- case Session::CONNECTED_CHANNELS:
control_dispatcher_.reset(new ClientControlDispatcher());
- control_dispatcher_->Init(session_.get());
+ control_dispatcher_->Init(session_.get(), base::Bind(
+ &ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
control_dispatcher_->set_client_stub(client_stub_);
- input_dispatcher_.reset(new ClientEventDispatcher());
- input_dispatcher_->Init(session_.get());
- control_connected_ = true;
- input_connected_ = true;
- NotifyIfChannelsReady();
+ event_dispatcher_.reset(new ClientEventDispatcher());
+ event_dispatcher_->Init(session_.get(), base::Bind(
+ &ConnectionToHost::OnChannelInitialized, base::Unretained(this)));
break;
default:
@@ -216,19 +208,20 @@ void ConnectionToHost::OnSessionStateChange(
}
}
-void ConnectionToHost::OnVideoChannelInitialized(bool successful) {
+void ConnectionToHost::OnChannelInitialized(bool successful) {
if (!successful) {
LOG(ERROR) << "Failed to connect video channel";
CloseOnError(NETWORK_FAILURE);
return;
}
- video_connected_ = true;
NotifyIfChannelsReady();
}
void ConnectionToHost::NotifyIfChannelsReady() {
- if (control_connected_ && input_connected_ && video_connected_ &&
+ if (control_dispatcher_.get() && control_dispatcher_->is_connected() &&
+ event_dispatcher_.get() && event_dispatcher_->is_connected() &&
+ video_reader_.get() && video_reader_->is_connected() &&
state_ == CONNECTING) {
SetState(CONNECTED, OK);
SetState(AUTHENTICATED, OK);
@@ -242,7 +235,7 @@ void ConnectionToHost::CloseOnError(Error error) {
void ConnectionToHost::CloseChannels() {
control_dispatcher_.reset();
- input_dispatcher_.reset();
+ event_dispatcher_.reset();
video_reader_.reset();
}
« no previous file with comments | « remoting/protocol/connection_to_host.h ('k') | remoting/protocol/fake_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698