Index: remoting/protocol/connection_to_client.cc |
diff --git a/remoting/protocol/connection_to_client.cc b/remoting/protocol/connection_to_client.cc |
index e1c10dfba1a2264d012bbbd7884c37dfed6094b5..b7e4e27b513ad021992f9f1edaa6a1d1f6cf6b93 100644 |
--- a/remoting/protocol/connection_to_client.cc |
+++ b/remoting/protocol/connection_to_client.cc |
@@ -41,8 +41,6 @@ ConnectionToClient::ConnectionToClient(base::MessageLoopProxy* message_loop, |
} |
ConnectionToClient::~ConnectionToClient() { |
- // TODO(hclam): When we shut down the viewer we may have to close the |
- // connection. |
} |
void ConnectionToClient::SetEventHandler(EventHandler* event_handler) { |
@@ -55,19 +53,16 @@ protocol::Session* ConnectionToClient::session() { |
} |
void ConnectionToClient::Disconnect() { |
- // This method can be called from main thread so perform threading switching. |
- if (!message_loop_->BelongsToCurrentThread()) { |
- message_loop_->PostTask( |
- FROM_HERE, |
- NewRunnableMethod(this, &ConnectionToClient::Disconnect)); |
- return; |
- } |
+ DCHECK(message_loop_->BelongsToCurrentThread()); |
CloseChannels(); |
// If there is a session then release it, causing it to close. |
- if (session_.get()) |
- session_.reset(); |
+ if (session_.get()) { |
+ session_->Close(); |
+ message_loop_->PostTask(FROM_HERE, base::Bind( |
+ &DeletePointer<protocol::Session>, session_.release())); |
Wez
2011/11/09 02:32:22
Like DeleteSoon()?
Sergey Ulanov
2011/11/09 21:24:00
Done.
|
+ } |
} |
void ConnectionToClient::UpdateSequenceNumber(int64 sequence_number) { |