Chromium Code Reviews| 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/client/chromoting_client.h" | 5 #include "remoting/client/chromoting_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "remoting/client/chromoting_view.h" | 8 #include "remoting/client/chromoting_view.h" |
| 9 #include "remoting/client/client_context.h" | 9 #include "remoting/client/client_context.h" |
| 10 #include "remoting/client/input_handler.h" | 10 #include "remoting/client/input_handler.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ChromotingClient::Stop(const base::Closure& shutdown_task) { | 59 void ChromotingClient::Stop(const base::Closure& shutdown_task) { |
| 60 if (!message_loop()->BelongsToCurrentThread()) { | 60 if (!message_loop()->BelongsToCurrentThread()) { |
| 61 message_loop()->PostTask( | 61 message_loop()->PostTask( |
| 62 FROM_HERE, base::Bind(&ChromotingClient::Stop, | 62 FROM_HERE, base::Bind(&ChromotingClient::Stop, |
| 63 base::Unretained(this), shutdown_task)); | 63 base::Unretained(this), shutdown_task)); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Drop all pending packets. | |
| 68 while(!received_packets_.empty()) { | |
| 69 received_packets_.front().done.Run(); | |
| 70 received_packets_.pop_front(); | |
|
Wez
2011/11/09 02:32:22
This looks leaked from another CL?
Sergey Ulanov
2011/11/09 21:24:00
Yeah, it should be in a separate CL. I thought my
| |
| 71 } | |
| 72 | |
| 67 connection_->Disconnect(base::Bind(&ChromotingClient::OnDisconnected, | 73 connection_->Disconnect(base::Bind(&ChromotingClient::OnDisconnected, |
| 68 base::Unretained(this), shutdown_task)); | 74 base::Unretained(this), shutdown_task)); |
| 69 } | 75 } |
| 70 | 76 |
| 71 void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) { | 77 void ChromotingClient::OnDisconnected(const base::Closure& shutdown_task) { |
| 72 view_->TearDown(); | 78 view_->TearDown(); |
| 73 | 79 |
| 74 shutdown_task.Run(); | 80 shutdown_task.Run(); |
| 75 } | 81 } |
| 76 | 82 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 } | 204 } |
| 199 | 205 |
| 200 // Initialize the decoder. | 206 // Initialize the decoder. |
| 201 rectangle_decoder_->Initialize(connection_->config()); | 207 rectangle_decoder_->Initialize(connection_->config()); |
| 202 | 208 |
| 203 // Schedule the input handler to process the event queue. | 209 // Schedule the input handler to process the event queue. |
| 204 input_handler_->Initialize(); | 210 input_handler_->Initialize(); |
| 205 } | 211 } |
| 206 | 212 |
| 207 } // namespace remoting | 213 } // namespace remoting |
| OLD | NEW |