OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "remoting/protocol/connection_to_client.h" | 5 #include "remoting/protocol/connection_to_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "google/protobuf/message.h" | 10 #include "google/protobuf/message.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 protocol::Session* ConnectionToClient::session() { | 53 protocol::Session* ConnectionToClient::session() { |
54 return session_.get(); | 54 return session_.get(); |
55 } | 55 } |
56 | 56 |
57 void ConnectionToClient::Disconnect() { | 57 void ConnectionToClient::Disconnect() { |
58 // This method can be called from main thread so perform threading switching. | 58 // This method can be called from main thread so perform threading switching. |
59 if (!message_loop_->BelongsToCurrentThread()) { | 59 if (!message_loop_->BelongsToCurrentThread()) { |
60 message_loop_->PostTask( | 60 message_loop_->PostTask( |
61 FROM_HERE, | 61 FROM_HERE, base::Bind(&ConnectionToClient::Disconnect, this)); |
62 NewRunnableMethod(this, &ConnectionToClient::Disconnect)); | |
63 return; | 62 return; |
64 } | 63 } |
65 | 64 |
66 CloseChannels(); | 65 CloseChannels(); |
67 | 66 |
68 // If there is a session then release it, causing it to close. | 67 // If there is a session then release it, causing it to close. |
69 if (session_.get()) | 68 if (session_.get()) |
70 session_.reset(); | 69 session_.reset(); |
71 } | 70 } |
72 | 71 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 156 |
158 void ConnectionToClient::CloseChannels() { | 157 void ConnectionToClient::CloseChannels() { |
159 if (video_writer_.get()) | 158 if (video_writer_.get()) |
160 video_writer_->Close(); | 159 video_writer_->Close(); |
161 if (client_control_sender_.get()) | 160 if (client_control_sender_.get()) |
162 client_control_sender_->Close(); | 161 client_control_sender_->Close(); |
163 } | 162 } |
164 | 163 |
165 } // namespace protocol | 164 } // namespace protocol |
166 } // namespace remoting | 165 } // namespace remoting |
OLD | NEW |