| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ice_connection_to_host.h" | 5 #include "remoting/protocol/ice_connection_to_host.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "remoting/protocol/clipboard_stub.h" | 21 #include "remoting/protocol/clipboard_stub.h" |
| 22 #include "remoting/protocol/errors.h" | 22 #include "remoting/protocol/errors.h" |
| 23 #include "remoting/protocol/ice_transport.h" | 23 #include "remoting/protocol/ice_transport.h" |
| 24 #include "remoting/protocol/transport_context.h" | 24 #include "remoting/protocol/transport_context.h" |
| 25 #include "remoting/protocol/video_renderer.h" | 25 #include "remoting/protocol/video_renderer.h" |
| 26 | 26 |
| 27 namespace remoting { | 27 namespace remoting { |
| 28 namespace protocol { | 28 namespace protocol { |
| 29 | 29 |
| 30 IceConnectionToHost::IceConnectionToHost() {} | 30 IceConnectionToHost::IceConnectionToHost() {} |
| 31 IceConnectionToHost::~IceConnectionToHost() {} | 31 IceConnectionToHost::~IceConnectionToHost() { |
| 32 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 33 } |
| 32 | 34 |
| 33 void IceConnectionToHost::Connect( | 35 void IceConnectionToHost::Connect( |
| 34 std::unique_ptr<Session> session, | 36 std::unique_ptr<Session> session, |
| 35 scoped_refptr<TransportContext> transport_context, | 37 scoped_refptr<TransportContext> transport_context, |
| 36 HostEventCallback* event_callback) { | 38 HostEventCallback* event_callback) { |
| 37 DCHECK(client_stub_); | 39 DCHECK(client_stub_); |
| 38 DCHECK(clipboard_stub_); | 40 DCHECK(clipboard_stub_); |
| 39 DCHECK(video_renderer_); | 41 DCHECK(video_renderer_); |
| 40 | 42 |
| 41 transport_.reset(new IceTransport(transport_context, this)); | 43 transport_.reset(new IceTransport(transport_context, this)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 83 } |
| 82 | 84 |
| 83 void IceConnectionToHost::InitializeAudio( | 85 void IceConnectionToHost::InitializeAudio( |
| 84 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, | 86 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, |
| 85 base::WeakPtr<AudioStub> audio_stub) { | 87 base::WeakPtr<AudioStub> audio_stub) { |
| 86 audio_decode_scheduler_.reset( | 88 audio_decode_scheduler_.reset( |
| 87 new AudioDecodeScheduler(audio_decode_task_runner, audio_stub)); | 89 new AudioDecodeScheduler(audio_decode_task_runner, audio_stub)); |
| 88 } | 90 } |
| 89 | 91 |
| 90 void IceConnectionToHost::OnSessionStateChange(Session::State state) { | 92 void IceConnectionToHost::OnSessionStateChange(Session::State state) { |
| 91 DCHECK(CalledOnValidThread()); | 93 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 92 DCHECK(event_callback_); | 94 DCHECK(event_callback_); |
| 93 | 95 |
| 94 switch (state) { | 96 switch (state) { |
| 95 case Session::INITIALIZING: | 97 case Session::INITIALIZING: |
| 96 case Session::CONNECTING: | 98 case Session::CONNECTING: |
| 97 case Session::ACCEPTING: | 99 case Session::ACCEPTING: |
| 98 case Session::ACCEPTED: | 100 case Session::ACCEPTED: |
| 99 case Session::AUTHENTICATING: | 101 case Session::AUTHENTICATING: |
| 100 // Don't care about these events. | 102 // Don't care about these events. |
| 101 break; | 103 break; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 void IceConnectionToHost::CloseChannels() { | 211 void IceConnectionToHost::CloseChannels() { |
| 210 control_dispatcher_.reset(); | 212 control_dispatcher_.reset(); |
| 211 event_dispatcher_.reset(); | 213 event_dispatcher_.reset(); |
| 212 clipboard_forwarder_.set_clipboard_stub(nullptr); | 214 clipboard_forwarder_.set_clipboard_stub(nullptr); |
| 213 event_forwarder_.set_input_stub(nullptr); | 215 event_forwarder_.set_input_stub(nullptr); |
| 214 video_dispatcher_.reset(); | 216 video_dispatcher_.reset(); |
| 215 audio_reader_.reset(); | 217 audio_reader_.reset(); |
| 216 } | 218 } |
| 217 | 219 |
| 218 void IceConnectionToHost::SetState(State state, ErrorCode error) { | 220 void IceConnectionToHost::SetState(State state, ErrorCode error) { |
| 219 DCHECK(CalledOnValidThread()); | 221 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 220 // |error| should be specified only when |state| is set to FAILED. | 222 // |error| should be specified only when |state| is set to FAILED. |
| 221 DCHECK(state == FAILED || error == OK); | 223 DCHECK(state == FAILED || error == OK); |
| 222 | 224 |
| 223 if (state != state_) { | 225 if (state != state_) { |
| 224 state_ = state; | 226 state_ = state; |
| 225 error_ = error; | 227 error_ = error; |
| 226 event_callback_->OnConnectionState(state_, error_); | 228 event_callback_->OnConnectionState(state_, error_); |
| 227 } | 229 } |
| 228 } | 230 } |
| 229 | 231 |
| 230 } // namespace protocol | 232 } // namespace protocol |
| 231 } // namespace remoting | 233 } // namespace remoting |
| OLD | NEW |