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

Side by Side Diff: net/spdy/spdy_session.h

Issue 11644088: SPDY - implement greedy approach to read all the data and process it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/spdy/spdy_session.cc » ('j') | net/spdy/spdy_session.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair> 404 typedef std::map<const scoped_refptr<SpdyStream>*, CallbackResultPair>
405 PendingCallbackMap; 405 PendingCallbackMap;
406 406
407 enum State { 407 enum State {
408 IDLE, 408 IDLE,
409 CONNECTING, 409 CONNECTING,
410 CONNECTED, 410 CONNECTED,
411 CLOSED 411 CLOSED
412 }; 412 };
413 413
414 enum IoState {
415 STATE_NONE,
416 STATE_DO_READ,
417 STATE_DO_READ_COMPLETE
418 };
419
414 virtual ~SpdySession(); 420 virtual ~SpdySession();
415 421
416 void ProcessPendingCreateStreams(); 422 void ProcessPendingCreateStreams();
417 int CreateStreamImpl( 423 int CreateStreamImpl(
418 const GURL& url, 424 const GURL& url,
419 RequestPriority priority, 425 RequestPriority priority,
420 scoped_refptr<SpdyStream>* spdy_stream, 426 scoped_refptr<SpdyStream>* spdy_stream,
421 const BoundNetLog& stream_net_log); 427 const BoundNetLog& stream_net_log);
422 428
429 // Try to make progress by reading and processing data.
430 int DoLoop(int rv);
431 // The implementations of each io_state_ of the IoState machine.
432 int DoRead();
433 int DoReadComplete(int bytes_read);
434
423 // IO Callbacks 435 // IO Callbacks
424 void OnReadComplete(int result); 436 void OnReadComplete(int result);
425 void OnWriteComplete(int result); 437 void OnWriteComplete(int result);
426 438
427 // Send relevant SETTINGS. This is generally called on connection setup. 439 // Send relevant SETTINGS. This is generally called on connection setup.
428 void SendInitialSettings(); 440 void SendInitialSettings();
429 441
430 // Helper method to send SETTINGS a frame. 442 // Helper method to send SETTINGS a frame.
431 void SendSettings(const SettingsMap& settings); 443 void SendSettings(const SettingsMap& settings);
432 444
(...skipping 14 matching lines...) Expand all
447 void WritePingFrame(uint32 unique_id); 459 void WritePingFrame(uint32 unique_id);
448 460
449 // Post a CheckPingStatus call after delay. Don't post if there is already 461 // Post a CheckPingStatus call after delay. Don't post if there is already
450 // CheckPingStatus running. 462 // CheckPingStatus running.
451 void PlanToCheckPingStatus(); 463 void PlanToCheckPingStatus();
452 464
453 // Check the status of the connection. It calls |CloseSessionOnError| if we 465 // Check the status of the connection. It calls |CloseSessionOnError| if we
454 // haven't received any data in |kHungInterval| time period. 466 // haven't received any data in |kHungInterval| time period.
455 void CheckPingStatus(base::TimeTicks last_check_time); 467 void CheckPingStatus(base::TimeTicks last_check_time);
456 468
457 // Start reading from the socket.
458 // Returns OK on success, or an error on failure.
459 net::Error ReadSocket();
460
461 // Write current data to the socket. 469 // Write current data to the socket.
462 void WriteSocketLater(); 470 void WriteSocketLater();
463 void WriteSocket(); 471 void WriteSocket();
464 472
465 // Get a new stream id. 473 // Get a new stream id.
466 int GetNewStreamId(); 474 int GetNewStreamId();
467 475
468 // Queue a frame for sending. 476 // Queue a frame for sending.
469 // |frame| is the frame to send. 477 // |frame| is the frame to send.
470 // |priority| is the priority for insertion into the queue. 478 // |priority| is the priority for insertion into the queue.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 int certificate_error_code_; 646 int certificate_error_code_;
639 647
640 // Spdy Frame state. 648 // Spdy Frame state.
641 scoped_ptr<BufferedSpdyFramer> buffered_spdy_framer_; 649 scoped_ptr<BufferedSpdyFramer> buffered_spdy_framer_;
642 650
643 // If an error has occurred on the session, the session is effectively 651 // If an error has occurred on the session, the session is effectively
644 // dead. Record this error here. When no error has occurred, |error_| will 652 // dead. Record this error here. When no error has occurred, |error_| will
645 // be OK. 653 // be OK.
646 net::Error error_; 654 net::Error error_;
647 State state_; 655 State state_;
656 IoState io_state_;
648 657
649 // Limits 658 // Limits
650 size_t max_concurrent_streams_; // 0 if no limit 659 size_t max_concurrent_streams_; // 0 if no limit
651 size_t max_concurrent_streams_limit_; 660 size_t max_concurrent_streams_limit_;
652 661
653 // Some statistics counters for the session. 662 // Some statistics counters for the session.
654 int streams_initiated_count_; 663 int streams_initiated_count_;
655 int streams_pushed_count_; 664 int streams_pushed_count_;
656 int streams_pushed_and_claimed_count_; 665 int streams_pushed_and_claimed_count_;
657 int streams_abandoned_count_; 666 int streams_abandoned_count_;
658 int bytes_received_; 667 int bytes_received_;
668 int bytes_read_;
659 bool sent_settings_; // Did this session send settings when it started. 669 bool sent_settings_; // Did this session send settings when it started.
660 bool received_settings_; // Did this session receive at least one settings 670 bool received_settings_; // Did this session receive at least one settings
661 // frame. 671 // frame.
662 int stalled_streams_; // Count of streams that were ever stalled. 672 int stalled_streams_; // Count of streams that were ever stalled.
663 673
664 // Count of all pings on the wire, for which we have not gotten a response. 674 // Count of all pings on the wire, for which we have not gotten a response.
665 int64 pings_in_flight_; 675 int64 pings_in_flight_;
666 676
667 // This is the next ping_id (unique_id) to be sent in PING frame. 677 // This is the next ping_id (unique_id) to be sent in PING frame.
668 uint32 next_ping_id_; 678 uint32 next_ping_id_;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 // This SPDY proxy is allowed to push resources from origins that are 742 // This SPDY proxy is allowed to push resources from origins that are
733 // different from those of their associated streams. 743 // different from those of their associated streams.
734 HostPortPair trusted_spdy_proxy_; 744 HostPortPair trusted_spdy_proxy_;
735 745
736 TimeFunc time_func_; 746 TimeFunc time_func_;
737 }; 747 };
738 748
739 } // namespace net 749 } // namespace net
740 750
741 #endif // NET_SPDY_SPDY_SESSION_H_ 751 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_session.cc » ('j') | net/spdy/spdy_session.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698