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

Unified Diff: remoting/protocol/webrtc_connection_to_host.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_connection_to_host.h ('k') | remoting/protocol/webrtc_transport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_connection_to_host.cc
diff --git a/remoting/protocol/webrtc_connection_to_host.cc b/remoting/protocol/webrtc_connection_to_host.cc
index 113da4d0de906e22aa7dacde2d9955940faeec30..43b7a4f8e14a679b46f8761114d03ec412828d8e 100644
--- a/remoting/protocol/webrtc_connection_to_host.cc
+++ b/remoting/protocol/webrtc_connection_to_host.cc
@@ -6,10 +6,12 @@
#include <utility>
+#include "jingle/glue/thread_wrapper.h"
#include "remoting/protocol/client_control_dispatcher.h"
#include "remoting/protocol/client_event_dispatcher.h"
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_stub.h"
+#include "remoting/protocol/transport_context.h"
#include "remoting/protocol/webrtc_transport.h"
namespace remoting {
@@ -18,13 +20,19 @@ namespace protocol {
WebrtcConnectionToHost::WebrtcConnectionToHost() {}
WebrtcConnectionToHost::~WebrtcConnectionToHost() {}
-void WebrtcConnectionToHost::Connect(scoped_ptr<Session> session,
- HostEventCallback* event_callback) {
+void WebrtcConnectionToHost::Connect(
+ scoped_ptr<Session> session,
+ scoped_refptr<TransportContext> transport_context,
+ HostEventCallback* event_callback) {
DCHECK(client_stub_);
DCHECK(clipboard_stub_);
+ transport_.reset(new WebrtcTransport(
+ jingle_glue::JingleThreadWrapper::current(), transport_context, this));
+
session_ = std::move(session);
session_->SetEventHandler(this);
+ session_->SetTransport(transport_.get());
event_callback_ = event_callback;
@@ -72,7 +80,6 @@ void WebrtcConnectionToHost::OnSessionStateChange(Session::State state) {
case Session::ACCEPTING:
case Session::ACCEPTED:
case Session::AUTHENTICATING:
- case Session::CONNECTED:
// Don't care about these events.
break;
@@ -80,14 +87,12 @@ void WebrtcConnectionToHost::OnSessionStateChange(Session::State state) {
SetState(AUTHENTICATED, OK);
control_dispatcher_.reset(new ClientControlDispatcher());
- control_dispatcher_->Init(
- session_->GetTransport()->GetStreamChannelFactory(), this);
+ control_dispatcher_->Init(transport_->GetStreamChannelFactory(), this);
control_dispatcher_->set_client_stub(client_stub_);
control_dispatcher_->set_clipboard_stub(clipboard_stub_);
event_dispatcher_.reset(new ClientEventDispatcher());
- event_dispatcher_->Init(
- session_->GetTransport()->GetStreamChannelFactory(), this);
+ event_dispatcher_->Init(transport_->GetStreamChannelFactory(), this);
break;
case Session::CLOSED:
@@ -98,10 +103,11 @@ void WebrtcConnectionToHost::OnSessionStateChange(Session::State state) {
}
}
-void WebrtcConnectionToHost::OnSessionRouteChange(
- const std::string& channel_name,
- const TransportRoute& route) {
- event_callback_->OnRouteChanged(channel_name, route);
+void WebrtcConnectionToHost::OnWebrtcTransportConnected() {}
+
+void WebrtcConnectionToHost::OnWebrtcTransportError(ErrorCode error) {
+ CloseChannels();
+ SetState(FAILED, error);
}
void WebrtcConnectionToHost::OnChannelInitialized(
@@ -115,7 +121,6 @@ void WebrtcConnectionToHost::OnChannelError(
LOG(ERROR) << "Failed to connect channel " << channel_dispatcher;
CloseChannels();
SetState(FAILED, CHANNEL_CONNECTION_ERROR);
- return;
}
ConnectionToHost::State WebrtcConnectionToHost::state() const {
« no previous file with comments | « remoting/protocol/webrtc_connection_to_host.h ('k') | remoting/protocol/webrtc_transport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698