Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A client specific QuicSession subclass. This class owns the underlying | 5 // A client specific QuicSession subclass. This class owns the underlying |
| 6 // QuicConnection and QuicConnectionHelper objects. The connection stores | 6 // QuicConnection and QuicConnectionHelper objects. The connection stores |
| 7 // a non-owning pointer to the helper so this session needs to ensure that | 7 // a non-owning pointer to the helper so this session needs to ensure that |
| 8 // the helper outlives the connection. | 8 // the helper outlives the connection. |
| 9 | 9 |
| 10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 // to be the new default writer. Returns true if socket was | 266 // to be the new default writer. Returns true if socket was |
| 267 // successfully added to the session and the session was | 267 // successfully added to the session and the session was |
| 268 // successfully migrated to using the new socket. Returns true on | 268 // successfully migrated to using the new socket. Returns true on |
| 269 // successful migration, or false if number of migrations exceeds | 269 // successful migration, or false if number of migrations exceeds |
| 270 // kMaxReadersPerQuicSession. Takes ownership of |socket|, |reader|, | 270 // kMaxReadersPerQuicSession. Takes ownership of |socket|, |reader|, |
| 271 // and |writer|. | 271 // and |writer|. |
| 272 bool MigrateToSocket(std::unique_ptr<DatagramClientSocket> socket, | 272 bool MigrateToSocket(std::unique_ptr<DatagramClientSocket> socket, |
| 273 std::unique_ptr<QuicChromiumPacketReader> reader, | 273 std::unique_ptr<QuicChromiumPacketReader> reader, |
| 274 std::unique_ptr<QuicChromiumPacketWriter> writer); | 274 std::unique_ptr<QuicChromiumPacketWriter> writer); |
| 275 | 275 |
| 276 // Method to call when NetworkChangeNotifier notifies observers of a | |
| 277 // new network. Tries to migrate any sessions that are waiting for a | |
| 278 // new network to connect. | |
|
Ryan Hamilton
2016/09/13 00:33:18
nit: This comment talks about "any sessions" but p
Jana
2016/09/13 01:12:19
Fixed comment.
| |
| 279 void OnNetworkConnected(NetworkChangeNotifier::NetworkHandle network, | |
| 280 const BoundNetLog& bound_net_log); | |
| 281 | |
| 282 // Schedules a migration alarm if one isn't already pending to wait | |
| 283 // for a new network. | |
| 284 void OnNoNewNetwork(); | |
| 285 | |
| 286 // If migration alarm was not cancelled, closes session with error. | |
| 287 void OnMigrationTimeout(); | |
| 288 | |
| 276 // Populates network error details for this session. | 289 // Populates network error details for this session. |
| 277 void PopulateNetErrorDetails(NetErrorDetails* details); | 290 void PopulateNetErrorDetails(NetErrorDetails* details); |
| 278 | 291 |
| 279 // Returns current default socket. This is the socket over which all | 292 // Returns current default socket. This is the socket over which all |
| 280 // QUIC packets are sent. This default socket can change, so do not store the | 293 // QUIC packets are sent. This default socket can change, so do not store the |
| 281 // returned socket. | 294 // returned socket. |
| 282 const DatagramClientSocket* GetDefaultSocket() const; | 295 const DatagramClientSocket* GetDefaultSocket() const; |
| 283 | 296 |
| 284 bool IsAuthorized(const std::string& hostname) override; | 297 bool IsAuthorized(const std::string& hostname) override; |
| 285 | 298 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 int streams_pushed_count_; | 385 int streams_pushed_count_; |
| 373 int streams_pushed_and_claimed_count_; | 386 int streams_pushed_and_claimed_count_; |
| 374 // Stores packet that witnesses socket write error. This packet is | 387 // Stores packet that witnesses socket write error. This packet is |
| 375 // written to a new socket after migration completes. | 388 // written to a new socket after migration completes. |
| 376 scoped_refptr<StringIOBuffer> packet_; | 389 scoped_refptr<StringIOBuffer> packet_; |
| 377 // TODO(jri): Replace use of migration_pending_ sockets_.size(). | 390 // TODO(jri): Replace use of migration_pending_ sockets_.size(). |
| 378 // When a task is posted for MigrateSessionOnError, pass in | 391 // When a task is posted for MigrateSessionOnError, pass in |
| 379 // sockets_.size(). Then in MigrateSessionOnError, check to see if | 392 // sockets_.size(). Then in MigrateSessionOnError, check to see if |
| 380 // the current sockets_.size() == the passed in value. | 393 // the current sockets_.size() == the passed in value. |
| 381 bool migration_pending_; // True while migration is underway. | 394 bool migration_pending_; // True while migration is underway. |
| 395 bool migration_alarm_pending_; // True when migration alarm is armed. | |
| 382 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 396 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
| 383 | 397 |
| 384 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 398 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
| 385 }; | 399 }; |
| 386 | 400 |
| 387 } // namespace net | 401 } // namespace net |
| 388 | 402 |
| 389 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 403 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
| OLD | NEW |