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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 ConnectionToClient::~ConnectionToClient() { | 40 ConnectionToClient::~ConnectionToClient() { |
41 // TODO(hclam): When we shut down the viewer we may have to close the | 41 // TODO(hclam): When we shut down the viewer we may have to close the |
42 // connection. | 42 // connection. |
43 } | 43 } |
44 | 44 |
45 void ConnectionToClient::Init(protocol::Session* session) { | 45 void ConnectionToClient::Init(protocol::Session* session) { |
46 DCHECK(message_loop_->BelongsToCurrentThread()); | 46 DCHECK(message_loop_->BelongsToCurrentThread()); |
47 session_.reset(session); | 47 session_.reset(session); |
48 session_->SetStateChangeCallback( | 48 session_->SetStateChangeCallback( |
49 NewCallback(this, &ConnectionToClient::OnSessionStateChange)); | 49 base::Bind(&ConnectionToClient::OnSessionStateChange, |
| 50 base::Unretained(this))); |
50 } | 51 } |
51 | 52 |
52 protocol::Session* ConnectionToClient::session() { | 53 protocol::Session* ConnectionToClient::session() { |
53 return session_.get(); | 54 return session_.get(); |
54 } | 55 } |
55 | 56 |
56 void ConnectionToClient::Disconnect() { | 57 void ConnectionToClient::Disconnect() { |
57 // 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. |
58 if (!message_loop_->BelongsToCurrentThread()) { | 59 if (!message_loop_->BelongsToCurrentThread()) { |
59 message_loop_->PostTask( | 60 message_loop_->PostTask( |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 157 |
157 void ConnectionToClient::CloseChannels() { | 158 void ConnectionToClient::CloseChannels() { |
158 if (video_writer_.get()) | 159 if (video_writer_.get()) |
159 video_writer_->Close(); | 160 video_writer_->Close(); |
160 if (client_control_sender_.get()) | 161 if (client_control_sender_.get()) |
161 client_control_sender_->Close(); | 162 client_control_sender_->Close(); |
162 } | 163 } |
163 | 164 |
164 } // namespace protocol | 165 } // namespace protocol |
165 } // namespace remoting | 166 } // namespace remoting |
OLD | NEW |