Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: remoting/protocol/webrtc_transport.cc

Issue 1545743002: Move ownership of Transport out of Session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass_client
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/webrtc_transport.h ('k') | remoting/protocol/webrtc_transport_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_transport.cc
diff --git a/remoting/protocol/webrtc_transport.cc b/remoting/protocol/webrtc_transport.cc
index 537557ec833a1c81538b9372a1f77f31da5d1db0..59711e0593cc79d1ea05d991be41563fbd3a7671 100644
--- a/remoting/protocol/webrtc_transport.cc
+++ b/remoting/protocol/webrtc_transport.cc
@@ -105,18 +105,23 @@ class SetSessionDescriptionObserver
WebrtcTransport::WebrtcTransport(
rtc::Thread* worker_thread,
- scoped_refptr<TransportContext> transport_context)
- : transport_context_(transport_context),
- worker_thread_(worker_thread),
+ scoped_refptr<TransportContext> transport_context,
+ EventHandler* event_handler)
+ : worker_thread_(worker_thread),
+ transport_context_(transport_context),
+ event_handler_(event_handler),
weak_factory_(this) {}
WebrtcTransport::~WebrtcTransport() {}
-void WebrtcTransport::Start(EventHandler* event_handler,
- Authenticator* authenticator) {
+void WebrtcTransport::Start(
+ Authenticator* authenticator,
+ SendTransportInfoCallback send_transport_info_callback) {
DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(send_transport_info_callback_.is_null());
+
+ send_transport_info_callback_ = std::move(send_transport_info_callback);
- event_handler_ = event_handler;
// TODO(sergeyu): Use the |authenticator| to authenticate PeerConnection.
transport_context_->CreatePortAllocator(base::Bind(
@@ -248,15 +253,6 @@ StreamChannelFactory* WebrtcTransport::GetStreamChannelFactory() {
return &data_stream_adapter_;
}
-StreamChannelFactory* WebrtcTransport::GetMultiplexedChannelFactory() {
- DCHECK(thread_checker_.CalledOnValidThread());
- return GetStreamChannelFactory();
-}
-
-WebrtcTransport* WebrtcTransport::AsWebrtcTransport() {
- return this;
-}
-
void WebrtcTransport::OnLocalSessionDescriptionCreated(
scoped_ptr<webrtc::SessionDescriptionInterface> description,
const std::string& error) {
@@ -287,7 +283,7 @@ void WebrtcTransport::OnLocalSessionDescriptionCreated(
offer_tag->SetAttr(QName(std::string(), "type"), description->type());
offer_tag->SetBodyText(description_sdp);
- event_handler_->OnOutgoingTransportInfo(std::move(transport_info));
+ send_transport_info_callback_.Run(std::move(transport_info));
peer_connection_->SetLocalDescription(
SetSessionDescriptionObserver::Create(base::Bind(
@@ -346,7 +342,7 @@ void WebrtcTransport::Close(ErrorCode error) {
peer_connection_factory_ = nullptr;
if (error != OK)
- event_handler_->OnTransportError(error);
+ event_handler_->OnWebrtcTransportError(error);
}
void WebrtcTransport::OnSignalingChange(
@@ -398,7 +394,7 @@ void WebrtcTransport::OnIceConnectionChange(
DCHECK(thread_checker_.CalledOnValidThread());
if (new_state == webrtc::PeerConnectionInterface::kIceConnectionConnected)
- event_handler_->OnTransportConnected();
+ event_handler_->OnWebrtcTransportConnected();
}
void WebrtcTransport::OnIceGatheringChange(
@@ -473,9 +469,7 @@ void WebrtcTransport::SendTransportInfo() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(pending_transport_info_message_);
- event_handler_->OnOutgoingTransportInfo(
- std::move(pending_transport_info_message_));
- pending_transport_info_message_.reset();
+ send_transport_info_callback_.Run(std::move(pending_transport_info_message_));
}
void WebrtcTransport::AddPendingCandidatesIfPossible() {
@@ -494,18 +488,5 @@ void WebrtcTransport::AddPendingCandidatesIfPossible() {
}
}
-WebrtcTransportFactory::WebrtcTransportFactory(
- rtc::Thread* worker_thread,
- scoped_refptr<TransportContext> transport_context)
- : worker_thread_(worker_thread),
- transport_context_(transport_context) {}
-
-WebrtcTransportFactory::~WebrtcTransportFactory() {}
-
-scoped_ptr<Transport> WebrtcTransportFactory::CreateTransport() {
- return make_scoped_ptr(
- new WebrtcTransport(worker_thread_, transport_context_.get()));
-}
-
} // namespace protocol
} // namespace remoting
« no previous file with comments | « remoting/protocol/webrtc_transport.h ('k') | remoting/protocol/webrtc_transport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698