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

Unified Diff: remoting/protocol/connection_to_client.cc

Issue 7218061: Close all writers before JingleSession is destroyed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 6 months 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
Index: remoting/protocol/connection_to_client.cc
diff --git a/remoting/protocol/connection_to_client.cc b/remoting/protocol/connection_to_client.cc
index ee2131a20dbc3d171cdb0f453cea45a719d7ae33..9482791c7bae25dc0f587693ed121cf73789917d 100644
--- a/remoting/protocol/connection_to_client.cc
+++ b/remoting/protocol/connection_to_client.cc
@@ -57,6 +57,11 @@ void ConnectionToClient::Disconnect() {
return;
}
+ if (video_writer_.get())
+ video_writer_->Close();
+ if (client_control_sender_.get())
+ client_control_sender_->Close();
Wez 2011/06/30 18:27:31 We Close() these in Disconnect(), but we created t
Sergey Ulanov 2011/06/30 20:55:24 Done.
+
// If there is a channel then close it and release the reference.
if (session_) {
session_->Close(NewRunnableMethod(this, &ConnectionToClient::OnClosed));
@@ -74,7 +79,7 @@ VideoStub* ConnectionToClient::video_stub() {
// Return pointer to ClientStub.
ClientStub* ConnectionToClient::client_stub() {
- return client_stub_.get();
+ return client_control_sender_.get();
}
void ConnectionToClient::set_host_stub(protocol::HostStub* host_stub) {
@@ -86,26 +91,6 @@ void ConnectionToClient::set_input_stub(protocol::InputStub* input_stub) {
}
void ConnectionToClient::OnSessionStateChange(protocol::Session::State state) {
- if (state == protocol::Session::CONNECTED) {
- client_stub_.reset(new ClientControlSender(session_->control_channel()));
- video_writer_.reset(VideoWriter::Create(session_->config()));
- video_writer_->Init(session_);
-
- dispatcher_.reset(new HostMessageDispatcher());
- dispatcher_->Initialize(this, host_stub_, input_stub_);
- }
-
- // This method can be called from main thread so perform threading switching.
- if (MessageLoop::current() != loop_) {
- loop_->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &ConnectionToClient::StateChangeTask, state));
- } else {
- StateChangeTask(state);
- }
-}
-
-void ConnectionToClient::StateChangeTask(protocol::Session::State state) {
DCHECK_EQ(loop_, MessageLoop::current());
DCHECK(handler_);
@@ -114,6 +99,14 @@ void ConnectionToClient::StateChangeTask(protocol::Session::State state) {
break;
// Don't care about this message.
case protocol::Session::CONNECTED:
+ client_control_sender_.reset(
+ new ClientControlSender(session_->control_channel()));
+ video_writer_.reset(VideoWriter::Create(session_->config()));
+ video_writer_->Init(session_);
+
+ dispatcher_.reset(new HostMessageDispatcher());
+ dispatcher_->Initialize(this, host_stub_, input_stub_);
+
handler_->OnConnectionOpened(this);
break;
case protocol::Session::CLOSED:

Powered by Google App Engine
This is Rietveld 408576698