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

Side by Side Diff: components/cast_channel/cast_socket.h

Issue 2937153002: [cast_channel] Create KeepAliveDelegate in CastSocket instead of in CastChannelOpenFunction (Closed)
Patch Set: rebase with master Created 3 years, 6 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 | « no previous file | components/cast_channel/cast_socket.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ 5 #ifndef COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_
6 #define COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ 6 #define COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // 120 //
121 // NOTE: Not called "CastChannel" to reduce confusion with the generated API 121 // NOTE: Not called "CastChannel" to reduce confusion with the generated API
122 // code. 122 // code.
123 class CastSocketImpl : public CastSocket { 123 class CastSocketImpl : public CastSocket {
124 public: 124 public:
125 // Creates a new CastSocket that connects to |ip_endpoint|. 125 // Creates a new CastSocket that connects to |ip_endpoint|.
126 // Parameters: 126 // Parameters:
127 // |ip_endpoint|: IP address of the remote host. 127 // |ip_endpoint|: IP address of the remote host.
128 // |net_log|: Log of socket events. 128 // |net_log|: Log of socket events.
129 // |connect_timeout|: Connection timeout interval. 129 // |connect_timeout|: Connection timeout interval.
130 // |liveness_timeout|: Amount of idle time to wait before disconnecting.
131 // |ping_interval|: Amount of idle time to wait before pinging the receiver.
130 // |logger|: Log of cast channel events. 132 // |logger|: Log of cast channel events.
131 CastSocketImpl(const net::IPEndPoint& ip_endpoint, 133 CastSocketImpl(const net::IPEndPoint& ip_endpoint,
132 net::NetLog* net_log, 134 net::NetLog* net_log,
133 const base::TimeDelta& connect_timeout, 135 base::TimeDelta connect_timeout,
134 bool keep_alive, 136 base::TimeDelta liveness_timeout,
137 base::TimeDelta ping_interval,
135 const scoped_refptr<Logger>& logger, 138 const scoped_refptr<Logger>& logger,
136 uint64_t device_capabilities); 139 uint64_t device_capabilities);
137 140
138 // For test-only. 141 // For test-only.
139 // This constructor allows for setting a custom AuthContext. 142 // This constructor allows for setting a custom AuthContext.
140 CastSocketImpl(const net::IPEndPoint& ip_endpoint, 143 CastSocketImpl(const net::IPEndPoint& ip_endpoint,
141 net::NetLog* net_log, 144 net::NetLog* net_log,
142 const base::TimeDelta& connect_timeout, 145 base::TimeDelta connect_timeout,
143 bool keep_alive, 146 base::TimeDelta liveness_timeout,
147 base::TimeDelta ping_interval,
144 const scoped_refptr<Logger>& logger, 148 const scoped_refptr<Logger>& logger,
145 uint64_t device_capabilities, 149 uint64_t device_capabilities,
146 const AuthContext& auth_context); 150 const AuthContext& auth_context);
147 151
148 // Ensures that the socket is closed. 152 // Ensures that the socket is closed.
149 ~CastSocketImpl() override; 153 ~CastSocketImpl() override;
150 154
151 // CastSocket interface. 155 // CastSocket interface.
152 void Connect(std::unique_ptr<CastTransport::Delegate> delegate, 156 void Connect(std::unique_ptr<CastTransport::Delegate> delegate,
153 base::Callback<void(ChannelError)> callback) override; 157 base::Callback<void(ChannelError)> callback) override;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 THREAD_CHECKER(thread_checker_); 279 THREAD_CHECKER(thread_checker_);
276 280
277 // The id of the channel. 281 // The id of the channel.
278 int channel_id_; 282 int channel_id_;
279 // The IP endpoint that the the channel is connected to. 283 // The IP endpoint that the the channel is connected to.
280 net::IPEndPoint ip_endpoint_; 284 net::IPEndPoint ip_endpoint_;
281 // The NetLog for this service. 285 // The NetLog for this service.
282 net::NetLog* net_log_; 286 net::NetLog* net_log_;
283 // The NetLog source for this service. 287 // The NetLog source for this service.
284 net::NetLogSource net_log_source_; 288 net::NetLogSource net_log_source_;
285 // True when keep-alive signaling should be handled for this socket. 289
286 bool keep_alive_; 290 // Amount of idle time to wait before disconnecting. If |liveness_timeout_| is
291 // set, wraps |delegate_| with a KeepAliveDelegate.
292 base::TimeDelta liveness_timeout_;
293
294 // Amount of idle time to wait before pinging the receiver, used to create
295 // KeepAliveDelegate.
296 base::TimeDelta ping_interval_;
287 297
288 // Shared logging object, used to log CastSocket events for diagnostics. 298 // Shared logging object, used to log CastSocket events for diagnostics.
289 scoped_refptr<Logger> logger_; 299 scoped_refptr<Logger> logger_;
290 300
291 // CertVerifier is owned by us but should be deleted AFTER SSLClientSocket 301 // CertVerifier is owned by us but should be deleted AFTER SSLClientSocket
292 // since in some cases the destructor of SSLClientSocket may call a method 302 // since in some cases the destructor of SSLClientSocket may call a method
293 // to cancel a cert verification request. 303 // to cancel a cert verification request.
294 std::unique_ptr<net::CertVerifier> cert_verifier_; 304 std::unique_ptr<net::CertVerifier> cert_verifier_;
295 std::unique_ptr<net::TransportSecurityState> transport_security_state_; 305 std::unique_ptr<net::TransportSecurityState> transport_security_state_;
296 std::unique_ptr<net::CTVerifier> cert_transparency_verifier_; 306 std::unique_ptr<net::CTVerifier> cert_transparency_verifier_;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 375
366 // Raw pointer to the auth handshake delegate. Used to get detailed error 376 // Raw pointer to the auth handshake delegate. Used to get detailed error
367 // information. 377 // information.
368 AuthTransportDelegate* auth_delegate_; 378 AuthTransportDelegate* auth_delegate_;
369 379
370 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); 380 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl);
371 }; 381 };
372 } // namespace cast_channel 382 } // namespace cast_channel
373 383
374 #endif // COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ 384 #endif // COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | components/cast_channel/cast_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698