| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
| 6 #define NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const GURL& socket_url, | 103 const GURL& socket_url, |
| 104 const std::vector<std::string>& requested_protocols, | 104 const std::vector<std::string>& requested_protocols, |
| 105 const url::Origin& origin, | 105 const url::Origin& origin, |
| 106 const WebSocketStreamCreator& creator); | 106 const WebSocketStreamCreator& creator); |
| 107 | 107 |
| 108 // The default timout for the closing handshake is a sensible value (see | 108 // The default timout for the closing handshake is a sensible value (see |
| 109 // kClosingHandshakeTimeoutSeconds in websocket_channel.cc). However, we can | 109 // kClosingHandshakeTimeoutSeconds in websocket_channel.cc). However, we can |
| 110 // set it to a very small value for testing purposes. | 110 // set it to a very small value for testing purposes. |
| 111 void SetClosingHandshakeTimeoutForTesting(base::TimeDelta delay); | 111 void SetClosingHandshakeTimeoutForTesting(base::TimeDelta delay); |
| 112 | 112 |
| 113 // The default timout for the underlying connection close is a sensible value |
| 114 // (see kUnderlyingConnectionCloseTimeoutSeconds in websocket_channel.cc). |
| 115 // However, we can set it to a very small value for testing purposes. |
| 116 void SetUnderlyingConnectionCloseTimeoutForTesting(base::TimeDelta delay); |
| 117 |
| 113 // Called when the stream starts the WebSocket Opening Handshake. | 118 // Called when the stream starts the WebSocket Opening Handshake. |
| 114 // This method is public for testing. | 119 // This method is public for testing. |
| 115 void OnStartOpeningHandshake( | 120 void OnStartOpeningHandshake( |
| 116 scoped_ptr<WebSocketHandshakeRequestInfo> request); | 121 scoped_ptr<WebSocketHandshakeRequestInfo> request); |
| 117 | 122 |
| 118 // Called when the stream ends the WebSocket Opening Handshake. | 123 // Called when the stream ends the WebSocket Opening Handshake. |
| 119 // This method is public for testing. | 124 // This method is public for testing. |
| 120 void OnFinishOpeningHandshake( | 125 void OnFinishOpeningHandshake( |
| 121 scoped_ptr<WebSocketHandshakeResponseInfo> response); | 126 scoped_ptr<WebSocketHandshakeResponseInfo> response); |
| 122 | 127 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // (quota units). | 369 // (quota units). |
| 365 int send_quota_high_water_mark_; | 370 int send_quota_high_water_mark_; |
| 366 // The current amount of quota that the renderer has available for sending | 371 // The current amount of quota that the renderer has available for sending |
| 367 // on this logical channel (quota units). | 372 // on this logical channel (quota units). |
| 368 int current_send_quota_; | 373 int current_send_quota_; |
| 369 // The remaining amount of quota that the renderer will allow us to send on | 374 // The remaining amount of quota that the renderer will allow us to send on |
| 370 // this logical channel (quota units). | 375 // this logical channel (quota units). |
| 371 uint64 current_receive_quota_; | 376 uint64 current_receive_quota_; |
| 372 | 377 |
| 373 // Timer for the closing handshake. | 378 // Timer for the closing handshake. |
| 374 base::OneShotTimer<WebSocketChannel> timer_; | 379 base::OneShotTimer<WebSocketChannel> close_timer_; |
| 375 | 380 |
| 376 // Timeout for the closing handshake. | 381 // Timeout for the closing handshake. |
| 377 base::TimeDelta timeout_; | 382 base::TimeDelta closing_handshake_timeout_; |
| 383 |
| 384 // Timeout for the underlying connection close after completion of closing |
| 385 // handshake. |
| 386 base::TimeDelta underlying_connection_close_timeout_; |
| 378 | 387 |
| 379 // Storage for the status code and reason from the time the Close frame | 388 // Storage for the status code and reason from the time the Close frame |
| 380 // arrives until the connection is closed and they are passed to | 389 // arrives until the connection is closed and they are passed to |
| 381 // OnDropChannel(). | 390 // OnDropChannel(). |
| 382 bool has_received_close_frame_; | 391 bool has_received_close_frame_; |
| 383 uint16 received_close_code_; | 392 uint16 received_close_code_; |
| 384 std::string received_close_reason_; | 393 std::string received_close_reason_; |
| 385 | 394 |
| 386 // The current state of the channel. Mainly used for sanity checking, but also | 395 // The current state of the channel. Mainly used for sanity checking, but also |
| 387 // used to track the close state. | 396 // used to track the close state. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 408 // For UMA. The time when OnConnectSuccess() method was called and |stream_| | 417 // For UMA. The time when OnConnectSuccess() method was called and |stream_| |
| 409 // was set. | 418 // was set. |
| 410 base::TimeTicks established_on_; | 419 base::TimeTicks established_on_; |
| 411 | 420 |
| 412 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); | 421 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); |
| 413 }; | 422 }; |
| 414 | 423 |
| 415 } // namespace net | 424 } // namespace net |
| 416 | 425 |
| 417 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 426 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
| OLD | NEW |