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

Unified Diff: remoting/protocol/connection_to_client.cc

Issue 8495024: Access ChromotingHost::clients_ only on network thread. (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
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) {

Powered by Google App Engine
This is Rietveld 408576698