| 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 #ifndef NET_SPDY_SPDY_SESSION_H_ | 5 #ifndef NET_SPDY_SPDY_SESSION_H_ |
| 6 #define NET_SPDY_SPDY_SESSION_H_ | 6 #define NET_SPDY_SPDY_SESSION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // session pool. | 224 // session pool. |
| 225 void CloseSessionOnError(net::Error err, bool remove_from_pool); | 225 void CloseSessionOnError(net::Error err, bool remove_from_pool); |
| 226 | 226 |
| 227 // Retrieves information on the current state of the SPDY session as a | 227 // Retrieves information on the current state of the SPDY session as a |
| 228 // Value. Caller takes possession of the returned value. | 228 // Value. Caller takes possession of the returned value. |
| 229 base::Value* GetInfoAsValue() const; | 229 base::Value* GetInfoAsValue() const; |
| 230 | 230 |
| 231 // Indicates whether the session is being reused after having successfully | 231 // Indicates whether the session is being reused after having successfully |
| 232 // used to send/receive data in the past. | 232 // used to send/receive data in the past. |
| 233 bool IsReused() const { | 233 bool IsReused() const { |
| 234 return frames_received_ > 0; | 234 return buffered_spdy_framer_.frames_received() > 0; |
| 235 } | 235 } |
| 236 | 236 |
| 237 // Returns true if the underlying transport socket ever had any reads or | 237 // Returns true if the underlying transport socket ever had any reads or |
| 238 // writes. | 238 // writes. |
| 239 bool WasEverUsed() const { | 239 bool WasEverUsed() const { |
| 240 return connection_->socket()->WasEverUsed(); | 240 return connection_->socket()->WasEverUsed(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void set_spdy_session_pool(SpdySessionPool* pool) { | 243 void set_spdy_session_pool(SpdySessionPool* pool) { |
| 244 spdy_session_pool_ = NULL; | 244 spdy_session_pool_ = NULL; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 virtual ~SpdySession(); | 327 virtual ~SpdySession(); |
| 328 | 328 |
| 329 void ProcessPendingCreateStreams(); | 329 void ProcessPendingCreateStreams(); |
| 330 int CreateStreamImpl( | 330 int CreateStreamImpl( |
| 331 const GURL& url, | 331 const GURL& url, |
| 332 RequestPriority priority, | 332 RequestPriority priority, |
| 333 scoped_refptr<SpdyStream>* spdy_stream, | 333 scoped_refptr<SpdyStream>* spdy_stream, |
| 334 const BoundNetLog& stream_net_log); | 334 const BoundNetLog& stream_net_log); |
| 335 | 335 |
| 336 // Control frame handlers. | |
| 337 void OnRst(const spdy::SpdyRstStreamControlFrame& frame); | |
| 338 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); | |
| 339 void OnPing(const spdy::SpdyPingControlFrame& frame); | |
| 340 void OnSettings(const spdy::SpdySettingsControlFrame& frame); | |
| 341 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame); | |
| 342 void OnCredential(const spdy::SpdyCredentialControlFrame& frame); | |
| 343 | |
| 344 // IO Callbacks | 336 // IO Callbacks |
| 345 void OnReadComplete(int result); | 337 void OnReadComplete(int result); |
| 346 void OnWriteComplete(int result); | 338 void OnWriteComplete(int result); |
| 347 | 339 |
| 348 // Send relevant SETTINGS. This is generally called on connection setup. | 340 // Send relevant SETTINGS. This is generally called on connection setup. |
| 349 void SendSettings(); | 341 void SendSettings(); |
| 350 | 342 |
| 351 // Handle SETTINGS. Either when we send settings, or when we receive a | 343 // Handle SETTINGS. Either when we send settings, or when we receive a |
| 352 // SETTINGS control frame, update our SpdySession accordingly. | 344 // SETTINGS control frame, update our SpdySession accordingly. |
| 353 void HandleSettings(const spdy::SpdySettings& settings); | 345 void HandleSettings(const spdy::SpdySettings& settings); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 void RecordHistograms(); | 412 void RecordHistograms(); |
| 421 | 413 |
| 422 // Closes all streams. Used as part of shutdown. | 414 // Closes all streams. Used as part of shutdown. |
| 423 void CloseAllStreams(net::Error status); | 415 void CloseAllStreams(net::Error status); |
| 424 | 416 |
| 425 // Invokes a user callback for stream creation. We provide this method so it | 417 // Invokes a user callback for stream creation. We provide this method so it |
| 426 // can be deferred to the MessageLoop, so we avoid re-entrancy problems. | 418 // can be deferred to the MessageLoop, so we avoid re-entrancy problems. |
| 427 void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream); | 419 void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream); |
| 428 | 420 |
| 429 // BufferedSpdyFramerVisitorInterface: | 421 // BufferedSpdyFramerVisitorInterface: |
| 430 virtual void OnError(spdy::SpdyFramer*) OVERRIDE; | 422 virtual void OnError() OVERRIDE; |
| 423 virtual void OnStreamError(spdy::SpdyStreamId stream_id) OVERRIDE; |
| 424 virtual void OnRstStream( |
| 425 const spdy::SpdyRstStreamControlFrame& frame) OVERRIDE; |
| 426 virtual void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame) OVERRIDE; |
| 427 virtual void OnPing(const spdy::SpdyPingControlFrame& frame) OVERRIDE; |
| 428 virtual void OnSettings(const spdy::SpdySettingsControlFrame& frame) OVERRIDE; |
| 429 virtual void OnWindowUpdate( |
| 430 const spdy::SpdyWindowUpdateControlFrame& frame) OVERRIDE; |
| 431 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id, | 431 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id, |
| 432 const char* data, | 432 const char* data, |
| 433 size_t len) OVERRIDE; | 433 size_t len) OVERRIDE; |
| 434 virtual void OnControl(const spdy::SpdyControlFrame* frame) OVERRIDE; | 434 virtual void OnSynStream( |
| 435 | 435 const spdy::SpdySynStreamControlFrame& frame, |
| 436 virtual bool OnControlFrameHeaderData(spdy::SpdyStreamId stream_id, | 436 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; |
| 437 const char* header_data, | |
| 438 size_t len) OVERRIDE; | |
| 439 | |
| 440 virtual bool OnCredentialFrameData(const char* frame_data, | |
| 441 size_t len) OVERRIDE; | |
| 442 | |
| 443 virtual void OnDataFrameHeader(const spdy::SpdyDataFrame* frame) OVERRIDE; | |
| 444 | |
| 445 virtual void OnSyn(const spdy::SpdySynStreamControlFrame& frame, | |
| 446 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; | |
| 447 virtual void OnSynReply( | 437 virtual void OnSynReply( |
| 448 const spdy::SpdySynReplyControlFrame& frame, | 438 const spdy::SpdySynReplyControlFrame& frame, |
| 449 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; | 439 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; |
| 450 virtual void OnHeaders( | 440 virtual void OnHeaders( |
| 451 const spdy::SpdyHeadersControlFrame& frame, | 441 const spdy::SpdyHeadersControlFrame& frame, |
| 452 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; | 442 const linked_ptr<spdy::SpdyHeaderBlock>& headers) OVERRIDE; |
| 453 | 443 |
| 454 // -------------------------- | 444 // -------------------------- |
| 455 // Helper methods for testing | 445 // Helper methods for testing |
| 456 // -------------------------- | 446 // -------------------------- |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 State state_; | 546 State state_; |
| 557 | 547 |
| 558 // Limits | 548 // Limits |
| 559 size_t max_concurrent_streams_; // 0 if no limit | 549 size_t max_concurrent_streams_; // 0 if no limit |
| 560 | 550 |
| 561 // Some statistics counters for the session. | 551 // Some statistics counters for the session. |
| 562 int streams_initiated_count_; | 552 int streams_initiated_count_; |
| 563 int streams_pushed_count_; | 553 int streams_pushed_count_; |
| 564 int streams_pushed_and_claimed_count_; | 554 int streams_pushed_and_claimed_count_; |
| 565 int streams_abandoned_count_; | 555 int streams_abandoned_count_; |
| 566 int frames_received_; | |
| 567 int bytes_received_; | 556 int bytes_received_; |
| 568 bool sent_settings_; // Did this session send settings when it started. | 557 bool sent_settings_; // Did this session send settings when it started. |
| 569 bool received_settings_; // Did this session receive at least one settings | 558 bool received_settings_; // Did this session receive at least one settings |
| 570 // frame. | 559 // frame. |
| 571 int stalled_streams_; // Count of streams that were ever stalled. | 560 int stalled_streams_; // Count of streams that were ever stalled. |
| 572 | 561 |
| 573 // Count of all pings on the wire, for which we have not gotten a response. | 562 // Count of all pings on the wire, for which we have not gotten a response. |
| 574 int64 pings_in_flight_; | 563 int64 pings_in_flight_; |
| 575 | 564 |
| 576 // This is the next ping_id (unique_id) to be sent in PING frame. | 565 // This is the next ping_id (unique_id) to be sent in PING frame. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 | 677 |
| 689 const size_t slot_; | 678 const size_t slot_; |
| 690 const std::string origin_; | 679 const std::string origin_; |
| 691 | 680 |
| 692 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyCredentialParameter); | 681 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyCredentialParameter); |
| 693 }; | 682 }; |
| 694 | 683 |
| 695 } // namespace net | 684 } // namespace net |
| 696 | 685 |
| 697 #endif // NET_SPDY_SPDY_SESSION_H_ | 686 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |