| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void ConnectionToClient::Disconnect() { | 43 void ConnectionToClient::Disconnect() { |
| 44 DCHECK(CalledOnValidThread()); | 44 DCHECK(CalledOnValidThread()); |
| 45 | 45 |
| 46 CloseChannels(); | 46 CloseChannels(); |
| 47 | 47 |
| 48 // This should trigger OnConnectionClosed() event and this object | 48 // This should trigger OnConnectionClosed() event and this object |
| 49 // may be destroyed as the result. | 49 // may be destroyed as the result. |
| 50 session_->Close(); | 50 session_->Close(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ConnectionToClient::UpdateSequenceNumber(int64 sequence_number) { | 53 void ConnectionToClient::OnEventTimestamp(int64 sequence_number) { |
| 54 DCHECK(CalledOnValidThread()); | 54 DCHECK(CalledOnValidThread()); |
| 55 handler_->OnSequenceNumberUpdated(this, sequence_number); | 55 handler_->OnEventTimestamp(this, sequence_number); |
| 56 } | 56 } |
| 57 | 57 |
| 58 VideoStub* ConnectionToClient::video_stub() { | 58 VideoStub* ConnectionToClient::video_stub() { |
| 59 DCHECK(CalledOnValidThread()); | 59 DCHECK(CalledOnValidThread()); |
| 60 return video_dispatcher_.get(); | 60 return video_dispatcher_.get(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 AudioStub* ConnectionToClient::audio_stub() { | 63 AudioStub* ConnectionToClient::audio_stub() { |
| 64 DCHECK(CalledOnValidThread()); | 64 DCHECK(CalledOnValidThread()); |
| 65 return audio_writer_.get(); | 65 return audio_writer_.get(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 base::Unretained(this))); | 125 base::Unretained(this))); |
| 126 control_dispatcher_->set_clipboard_stub(clipboard_stub_); | 126 control_dispatcher_->set_clipboard_stub(clipboard_stub_); |
| 127 control_dispatcher_->set_host_stub(host_stub_); | 127 control_dispatcher_->set_host_stub(host_stub_); |
| 128 | 128 |
| 129 event_dispatcher_.reset(new HostEventDispatcher()); | 129 event_dispatcher_.reset(new HostEventDispatcher()); |
| 130 event_dispatcher_->Init( | 130 event_dispatcher_->Init( |
| 131 session_.get(), session_->config().event_config(), | 131 session_.get(), session_->config().event_config(), |
| 132 base::Bind(&ConnectionToClient::OnChannelInitialized, | 132 base::Bind(&ConnectionToClient::OnChannelInitialized, |
| 133 base::Unretained(this))); | 133 base::Unretained(this))); |
| 134 event_dispatcher_->set_input_stub(input_stub_); | 134 event_dispatcher_->set_input_stub(input_stub_); |
| 135 event_dispatcher_->set_sequence_number_callback(base::Bind( | 135 event_dispatcher_->set_event_timestamp_callback(base::Bind( |
| 136 &ConnectionToClient::UpdateSequenceNumber, base::Unretained(this))); | 136 &ConnectionToClient::OnEventTimestamp, base::Unretained(this))); |
| 137 | 137 |
| 138 video_dispatcher_.reset(new HostVideoDispatcher()); | 138 video_dispatcher_.reset(new HostVideoDispatcher()); |
| 139 video_dispatcher_->Init( | 139 video_dispatcher_->Init( |
| 140 session_.get(), session_->config().video_config(), | 140 session_.get(), session_->config().video_config(), |
| 141 base::Bind(&ConnectionToClient::OnChannelInitialized, | 141 base::Bind(&ConnectionToClient::OnChannelInitialized, |
| 142 base::Unretained(this))); | 142 base::Unretained(this))); |
| 143 | 143 |
| 144 audio_writer_ = AudioWriter::Create(session_->config()); | 144 audio_writer_ = AudioWriter::Create(session_->config()); |
| 145 if (audio_writer_.get()) { | 145 if (audio_writer_.get()) { |
| 146 audio_writer_->Init( | 146 audio_writer_->Init( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 void ConnectionToClient::CloseChannels() { | 206 void ConnectionToClient::CloseChannels() { |
| 207 control_dispatcher_.reset(); | 207 control_dispatcher_.reset(); |
| 208 event_dispatcher_.reset(); | 208 event_dispatcher_.reset(); |
| 209 video_dispatcher_.reset(); | 209 video_dispatcher_.reset(); |
| 210 audio_writer_.reset(); | 210 audio_writer_.reset(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace protocol | 213 } // namespace protocol |
| 214 } // namespace remoting | 214 } // namespace remoting |
| OLD | NEW |