Chromium Code Reviews| 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/webrtc_transport.h" | 5 #include "remoting/protocol/webrtc_transport.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 explicit SetSessionDescriptionObserver(const ResultCallback& result_callback) | 128 explicit SetSessionDescriptionObserver(const ResultCallback& result_callback) |
| 129 : result_callback_(result_callback) {} | 129 : result_callback_(result_callback) {} |
| 130 ~SetSessionDescriptionObserver() override {} | 130 ~SetSessionDescriptionObserver() override {} |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 ResultCallback result_callback_; | 133 ResultCallback result_callback_; |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(SetSessionDescriptionObserver); | 135 DISALLOW_COPY_AND_ASSIGN(SetSessionDescriptionObserver); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 | |
| 139 } // namespace | 138 } // namespace |
| 140 | 139 |
| 141 WebrtcTransport::WebrtcTransport( | 140 WebrtcTransport::WebrtcTransport( |
| 142 rtc::Thread* worker_thread, | 141 rtc::Thread* worker_thread, |
| 143 scoped_refptr<TransportContext> transport_context, | 142 scoped_refptr<TransportContext> transport_context, |
| 144 EventHandler* event_handler) | 143 EventHandler* event_handler) |
| 145 : worker_thread_(worker_thread), | 144 : worker_thread_(worker_thread), |
| 146 transport_context_(transport_context), | 145 transport_context_(transport_context), |
| 147 event_handler_(event_handler), | 146 event_handler_(event_handler), |
| 148 handshake_hmac_(crypto::HMAC::SHA256), | 147 handshake_hmac_(crypto::HMAC::SHA256), |
| 149 weak_factory_(this) { | 148 weak_factory_(this) { |
| 150 transport_context_->set_relay_mode(TransportContext::RelayMode::TURN); | 149 transport_context_->set_relay_mode(TransportContext::RelayMode::TURN); |
| 151 } | 150 } |
| 152 | 151 |
| 153 WebrtcTransport::~WebrtcTransport() {} | 152 WebrtcTransport::~WebrtcTransport() { |
| 153 // Destroy |fake_audio_device_module_| asynchronously. PeerConnection may be | |
| 154 // on the stack and so it will be destroyed later. We need to ensures that | |
|
Jamie
2016/07/23 00:03:48
s/ensures/ensure/
Sergey Ulanov
2016/07/23 06:30:04
reworded this comment
| |
| 155 // |fake_audio_device_module_| is destroyed only after that. | |
| 156 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( | |
| 157 FROM_HERE, fake_audio_device_module_.release()); | |
| 158 } | |
| 154 | 159 |
| 155 std::unique_ptr<MessagePipe> WebrtcTransport::CreateOutgoingChannel( | 160 std::unique_ptr<MessagePipe> WebrtcTransport::CreateOutgoingChannel( |
| 156 const std::string& name) { | 161 const std::string& name) { |
| 157 return data_stream_adapter_->CreateOutgoingChannel(name); | 162 return data_stream_adapter_->CreateOutgoingChannel(name); |
| 158 } | 163 } |
| 159 | 164 |
| 160 void WebrtcTransport::Start( | 165 void WebrtcTransport::Start( |
| 161 Authenticator* authenticator, | 166 Authenticator* authenticator, |
| 162 SendTransportInfoCallback send_transport_info_callback) { | 167 SendTransportInfoCallback send_transport_info_callback) { |
| 163 DCHECK(thread_checker_.CalledOnValidThread()); | 168 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 peer_connection_->Close(); | 584 peer_connection_->Close(); |
| 580 peer_connection_ = nullptr; | 585 peer_connection_ = nullptr; |
| 581 peer_connection_factory_ = nullptr; | 586 peer_connection_factory_ = nullptr; |
| 582 | 587 |
| 583 if (error != OK) | 588 if (error != OK) |
| 584 event_handler_->OnWebrtcTransportError(error); | 589 event_handler_->OnWebrtcTransportError(error); |
| 585 } | 590 } |
| 586 | 591 |
| 587 } // namespace protocol | 592 } // namespace protocol |
| 588 } // namespace remoting | 593 } // namespace remoting |
| OLD | NEW |