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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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
« no previous file with comments | « remoting/protocol/ice_transport.cc ('k') | remoting/protocol/ice_transport_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_TRANSPORT_CHANNEL_H_ 5 #ifndef REMOTING_PROTOCOL_ICE_TRANSPORT_CHANNEL_H_
6 #define REMOTING_PROTOCOL_ICE_TRANSPORT_CHANNEL_H_ 6 #define REMOTING_PROTOCOL_ICE_TRANSPORT_CHANNEL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 virtual void OnChannelRouteChange(IceTransportChannel* transport, 52 virtual void OnChannelRouteChange(IceTransportChannel* transport,
53 const TransportRoute& route) = 0; 53 const TransportRoute& route) = 0;
54 54
55 // Called when when the channel has failed to connect or reconnect. 55 // Called when when the channel has failed to connect or reconnect.
56 virtual void OnChannelFailed(IceTransportChannel* transport) = 0; 56 virtual void OnChannelFailed(IceTransportChannel* transport) = 0;
57 57
58 // Called when the channel is about to be deleted. 58 // Called when the channel is about to be deleted.
59 virtual void OnChannelDeleted(IceTransportChannel* transport) = 0; 59 virtual void OnChannelDeleted(IceTransportChannel* transport) = 0;
60 }; 60 };
61 61
62 typedef base::Callback<void(scoped_ptr<P2PDatagramSocket>)> ConnectedCallback; 62 typedef base::Callback<void(std::unique_ptr<P2PDatagramSocket>)>
63 ConnectedCallback;
63 64
64 explicit IceTransportChannel( 65 explicit IceTransportChannel(
65 scoped_refptr<TransportContext> transport_context); 66 scoped_refptr<TransportContext> transport_context);
66 ~IceTransportChannel() override; 67 ~IceTransportChannel() override;
67 68
68 // Connects the channel and calls the |callback| after that. 69 // Connects the channel and calls the |callback| after that.
69 void Connect(const std::string& name, 70 void Connect(const std::string& name,
70 Delegate* delegate, 71 Delegate* delegate,
71 const ConnectedCallback& callback); 72 const ConnectedCallback& callback);
72 73
73 // Sets remote ICE credentials. 74 // Sets remote ICE credentials.
74 void SetRemoteCredentials(const std::string& ufrag, 75 void SetRemoteCredentials(const std::string& ufrag,
75 const std::string& password); 76 const std::string& password);
76 77
77 // Adds |candidate| received from the peer. 78 // Adds |candidate| received from the peer.
78 void AddRemoteCandidate(const cricket::Candidate& candidate); 79 void AddRemoteCandidate(const cricket::Candidate& candidate);
79 80
80 // Name of the channel. Used to identify the channel and disambiguate 81 // Name of the channel. Used to identify the channel and disambiguate
81 // candidates it generates from candidates generated by parallel connections. 82 // candidates it generates from candidates generated by parallel connections.
82 const std::string& name() const; 83 const std::string& name() const;
83 84
84 // Returns true if the channel is already connected. 85 // Returns true if the channel is already connected.
85 bool is_connected() const; 86 bool is_connected() const;
86 87
87 private: 88 private:
88 void OnPortAllocatorCreated( 89 void OnPortAllocatorCreated(
89 scoped_ptr<cricket::PortAllocator> port_allocator); 90 std::unique_ptr<cricket::PortAllocator> port_allocator);
90 91
91 void NotifyConnected(); 92 void NotifyConnected();
92 93
93 // Signal handlers for cricket::TransportChannel. 94 // Signal handlers for cricket::TransportChannel.
94 void OnCandidateGathered(cricket::TransportChannelImpl* channel, 95 void OnCandidateGathered(cricket::TransportChannelImpl* channel,
95 const cricket::Candidate& candidate); 96 const cricket::Candidate& candidate);
96 void OnRouteChange(cricket::TransportChannel* channel, 97 void OnRouteChange(cricket::TransportChannel* channel,
97 const cricket::Candidate& candidate); 98 const cricket::Candidate& candidate);
98 void OnWritableState(cricket::TransportChannel* channel); 99 void OnWritableState(cricket::TransportChannel* channel);
99 100
100 // Callback for TransportChannelSocketAdapter to notify when the socket is 101 // Callback for TransportChannelSocketAdapter to notify when the socket is
101 // destroyed. 102 // destroyed.
102 void OnChannelDestroyed(); 103 void OnChannelDestroyed();
103 104
104 void NotifyRouteChanged(); 105 void NotifyRouteChanged();
105 106
106 // Tries to connect by restarting ICE. Called by |reconnect_timer_|. 107 // Tries to connect by restarting ICE. Called by |reconnect_timer_|.
107 void TryReconnect(); 108 void TryReconnect();
108 109
109 scoped_refptr<TransportContext> transport_context_; 110 scoped_refptr<TransportContext> transport_context_;
110 111
111 std::string name_; 112 std::string name_;
112 Delegate* delegate_ = nullptr; 113 Delegate* delegate_ = nullptr;
113 ConnectedCallback callback_; 114 ConnectedCallback callback_;
114 std::string ice_username_fragment_; 115 std::string ice_username_fragment_;
115 116
116 scoped_ptr<cricket::PortAllocator> port_allocator_; 117 std::unique_ptr<cricket::PortAllocator> port_allocator_;
117 118
118 std::string remote_ice_username_fragment_; 119 std::string remote_ice_username_fragment_;
119 std::string remote_ice_password_; 120 std::string remote_ice_password_;
120 std::list<cricket::Candidate> pending_candidates_; 121 std::list<cricket::Candidate> pending_candidates_;
121 scoped_ptr<cricket::P2PTransportChannel> channel_; 122 std::unique_ptr<cricket::P2PTransportChannel> channel_;
122 int connect_attempts_left_; 123 int connect_attempts_left_;
123 base::RepeatingTimer reconnect_timer_; 124 base::RepeatingTimer reconnect_timer_;
124 125
125 base::ThreadChecker thread_checker_; 126 base::ThreadChecker thread_checker_;
126 127
127 base::WeakPtrFactory<IceTransportChannel> weak_factory_; 128 base::WeakPtrFactory<IceTransportChannel> weak_factory_;
128 129
129 DISALLOW_COPY_AND_ASSIGN(IceTransportChannel); 130 DISALLOW_COPY_AND_ASSIGN(IceTransportChannel);
130 }; 131 };
131 132
132 } // namespace protocol 133 } // namespace protocol
133 } // namespace remoting 134 } // namespace remoting
134 135
135 #endif // REMOTING_PROTOCOL_ICE_TRANSPORT_CHANNEL_H_ 136 #endif // REMOTING_PROTOCOL_ICE_TRANSPORT_CHANNEL_H_
OLDNEW
« no previous file with comments | « remoting/protocol/ice_transport.cc ('k') | remoting/protocol/ice_transport_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698