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

Side by Side Diff: remoting/protocol/ice_connection_to_host.h

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 4 years, 12 months 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 unified diff | Download patch
OLDNEW
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 #ifndef REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_ 5 #ifndef REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_
6 #define REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_ 6 #define REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/threading/non_thread_safe.h" 15 #include "base/threading/non_thread_safe.h"
16 #include "remoting/proto/internal.pb.h" 16 #include "remoting/proto/internal.pb.h"
17 #include "remoting/protocol/channel_dispatcher_base.h" 17 #include "remoting/protocol/channel_dispatcher_base.h"
18 #include "remoting/protocol/clipboard_filter.h" 18 #include "remoting/protocol/clipboard_filter.h"
19 #include "remoting/protocol/connection_to_host.h" 19 #include "remoting/protocol/connection_to_host.h"
20 #include "remoting/protocol/errors.h" 20 #include "remoting/protocol/errors.h"
21 #include "remoting/protocol/ice_transport.h"
21 #include "remoting/protocol/input_filter.h" 22 #include "remoting/protocol/input_filter.h"
22 #include "remoting/protocol/message_reader.h" 23 #include "remoting/protocol/message_reader.h"
23 #include "remoting/protocol/monitored_video_stub.h" 24 #include "remoting/protocol/monitored_video_stub.h"
24 #include "remoting/protocol/session.h" 25 #include "remoting/protocol/session.h"
25 #include "remoting/protocol/session_config.h" 26 #include "remoting/protocol/session_config.h"
26 27
27 namespace remoting { 28 namespace remoting {
28 namespace protocol { 29 namespace protocol {
29 30
30 class AudioReader; 31 class AudioReader;
31 class ClientControlDispatcher; 32 class ClientControlDispatcher;
32 class ClientEventDispatcher; 33 class ClientEventDispatcher;
33 class ClientVideoDispatcher; 34 class ClientVideoDispatcher;
34 35
35 class IceConnectionToHost : public ConnectionToHost, 36 class IceConnectionToHost : public ConnectionToHost,
36 public Session::EventHandler, 37 public Session::EventHandler,
38 public IceTransport::EventHandler,
37 public ChannelDispatcherBase::EventHandler, 39 public ChannelDispatcherBase::EventHandler,
38 public base::NonThreadSafe { 40 public base::NonThreadSafe {
39 public: 41 public:
40 IceConnectionToHost(); 42 IceConnectionToHost();
41 ~IceConnectionToHost() override; 43 ~IceConnectionToHost() override;
42 44
43 // ConnectionToHost interface. 45 // ConnectionToHost interface.
44 void set_client_stub(ClientStub* client_stub) override; 46 void set_client_stub(ClientStub* client_stub) override;
45 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; 47 void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
46 void set_video_stub(VideoStub* video_stub) override; 48 void set_video_stub(VideoStub* video_stub) override;
47 void set_audio_stub(AudioStub* audio_stub) override; 49 void set_audio_stub(AudioStub* audio_stub) override;
48 void Connect(scoped_ptr<Session> session, 50 void Connect(scoped_ptr<Session> session,
51 scoped_refptr<TransportContext> transport_context,
49 HostEventCallback* event_callback) override; 52 HostEventCallback* event_callback) override;
50 const SessionConfig& config() override; 53 const SessionConfig& config() override;
51 ClipboardStub* clipboard_forwarder() override; 54 ClipboardStub* clipboard_forwarder() override;
52 HostStub* host_stub() override; 55 HostStub* host_stub() override;
53 InputStub* input_stub() override; 56 InputStub* input_stub() override;
54 State state() const override; 57 State state() const override;
55 58
56 private: 59 private:
57 // Session::EventHandler interface. 60 // Session::EventHandler interface.
58 void OnSessionStateChange(Session::State state) override; 61 void OnSessionStateChange(Session::State state) override;
59 void OnSessionRouteChange(const std::string& channel_name, 62
60 const TransportRoute& route) override; 63 // IceTransport::EventHandler interface.
64 void OnIceTransportRouteChange(const std::string& channel_name,
65 const TransportRoute& route) override;
66 void OnIceTransportError(ErrorCode error) override;
61 67
62 // ChannelDispatcherBase::EventHandler interface. 68 // ChannelDispatcherBase::EventHandler interface.
63 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; 69 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override;
64 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, 70 void OnChannelError(ChannelDispatcherBase* channel_dispatcher,
65 ErrorCode error) override; 71 ErrorCode error) override;
66 72
67 // MonitoredVideoStub::EventHandler interface. 73 // MonitoredVideoStub::EventHandler interface.
68 virtual void OnVideoChannelStatus(bool active); 74 virtual void OnVideoChannelStatus(bool active);
69 75
70 void NotifyIfChannelsReady(); 76 void NotifyIfChannelsReady();
71 77
72 void CloseOnError(ErrorCode error); 78 void CloseOnError(ErrorCode error);
73 79
74 // Stops writing in the channels. 80 // Closes the P2P connection.
75 void CloseChannels(); 81 void CloseChannels();
76 82
77 void SetState(State state, ErrorCode error); 83 void SetState(State state, ErrorCode error);
78 84
79 HostEventCallback* event_callback_ = nullptr; 85 HostEventCallback* event_callback_ = nullptr;
80 86
81 // Stub for incoming messages. 87 // Stub for incoming messages.
82 ClientStub* client_stub_ = nullptr; 88 ClientStub* client_stub_ = nullptr;
83 ClipboardStub* clipboard_stub_ = nullptr; 89 ClipboardStub* clipboard_stub_ = nullptr;
84 AudioStub* audio_stub_ = nullptr; 90 AudioStub* audio_stub_ = nullptr;
85 91
86 scoped_ptr<Session> session_; 92 scoped_ptr<Session> session_;
93 scoped_ptr<IceTransport> transport_;
94
87 scoped_ptr<MonitoredVideoStub> monitored_video_stub_; 95 scoped_ptr<MonitoredVideoStub> monitored_video_stub_;
88
89 scoped_ptr<ClientVideoDispatcher> video_dispatcher_; 96 scoped_ptr<ClientVideoDispatcher> video_dispatcher_;
90 scoped_ptr<AudioReader> audio_reader_; 97 scoped_ptr<AudioReader> audio_reader_;
91 scoped_ptr<ClientControlDispatcher> control_dispatcher_; 98 scoped_ptr<ClientControlDispatcher> control_dispatcher_;
92 scoped_ptr<ClientEventDispatcher> event_dispatcher_; 99 scoped_ptr<ClientEventDispatcher> event_dispatcher_;
93 ClipboardFilter clipboard_forwarder_; 100 ClipboardFilter clipboard_forwarder_;
94 InputFilter event_forwarder_; 101 InputFilter event_forwarder_;
95 102
96 // Internal state of the connection. 103 // Internal state of the connection.
97 State state_ = INITIALIZING; 104 State state_ = INITIALIZING;
98 ErrorCode error_ = OK; 105 ErrorCode error_ = OK;
99 106
100 private: 107 private:
101 DISALLOW_COPY_AND_ASSIGN(IceConnectionToHost); 108 DISALLOW_COPY_AND_ASSIGN(IceConnectionToHost);
102 }; 109 };
103 110
104 } // namespace protocol 111 } // namespace protocol
105 } // namespace remoting 112 } // namespace remoting
106 113
107 #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_ 114 #endif // REMOTING_PROTOCOL_ICE_CONNECTION_TO_HOST_H_
OLDNEW
« no previous file with comments | « remoting/protocol/ice_connection_to_client.cc ('k') | remoting/protocol/ice_connection_to_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698