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

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

Issue 14311002: [SPDY] Avoid leaking bytes from the session flow control receive window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
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 <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 // Returns the ServerBoundCertService used by this Socket, or NULL 306 // Returns the ServerBoundCertService used by this Socket, or NULL
307 // if server bound certs are not supported in this session. 307 // if server bound certs are not supported in this session.
308 ServerBoundCertService* GetServerBoundCertService() const; 308 ServerBoundCertService* GetServerBoundCertService() const;
309 309
310 // Send a WINDOW_UPDATE frame for a stream. Called by a stream 310 // Send a WINDOW_UPDATE frame for a stream. Called by a stream
311 // whenever receive window size is increased. 311 // whenever receive window size is increased.
312 void SendStreamWindowUpdate(SpdyStreamId stream_id, 312 void SendStreamWindowUpdate(SpdyStreamId stream_id,
313 uint32 delta_window_size); 313 uint32 delta_window_size);
314 314
315 // Called by a stream to increase this session's receive window size
316 // by |delta_window_size|, which must be at least 1 and must not
317 // cause this session's receive window size to overflow, possibly
318 // also sending a WINDOW_UPDATE frame. Does nothing if session flow
319 // control is turned off.
320 void IncreaseRecvWindowSize(int32 delta_window_size);
321
322 // If session is closed, no new streams/transactions should be created. 315 // If session is closed, no new streams/transactions should be created.
323 bool IsClosed() const { return state_ == CLOSED; } 316 bool IsClosed() const { return state_ == CLOSED; }
324 317
325 // Closes this session. This will close all active streams and mark 318 // Closes this session. This will close all active streams and mark
326 // the session as permanently closed. 319 // the session as permanently closed.
327 // |err| should not be OK; this function is intended to be called on 320 // |err| should not be OK; this function is intended to be called on
328 // error. 321 // error.
329 // |remove_from_pool| indicates whether to also remove the session from the 322 // |remove_from_pool| indicates whether to also remove the session from the
330 // session pool. 323 // session pool.
331 // |description| indicates the reason for the error. 324 // |description| indicates the reason for the error.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); 452 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream);
460 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, DeleteExpiredPushStreams); 453 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, DeleteExpiredPushStreams);
461 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, ProtocolNegotiation); 454 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, ProtocolNegotiation);
462 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, ProtocolNegotiation31); 455 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, ProtocolNegotiation31);
463 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, ProtocolNegotiation4); 456 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, ProtocolNegotiation4);
464 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, IncreaseRecvWindowSize); 457 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, IncreaseRecvWindowSize);
465 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, AdjustRecvWindowSize31); 458 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, AdjustRecvWindowSize31);
466 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, AdjustSendWindowSize31); 459 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, AdjustSendWindowSize31);
467 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, 460 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test,
468 SessionFlowControlInactiveStream31); 461 SessionFlowControlInactiveStream31);
462 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test,
463 SessionFlowControlNoReceiveLeaks31);
469 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, SessionFlowControlEndToEnd31); 464 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, SessionFlowControlEndToEnd31);
470 465
471 typedef std::deque<SpdyStreamRequest*> PendingStreamRequestQueue; 466 typedef std::deque<SpdyStreamRequest*> PendingStreamRequestQueue;
472 typedef std::set<SpdyStreamRequest*> PendingStreamRequestCompletionSet; 467 typedef std::set<SpdyStreamRequest*> PendingStreamRequestCompletionSet;
473 468
474 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; 469 typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap;
475 typedef std::map<std::string, 470 typedef std::map<std::string,
476 std::pair<scoped_refptr<SpdyStream>, base::TimeTicks> > PushedStreamMap; 471 std::pair<scoped_refptr<SpdyStream>, base::TimeTicks> > PushedStreamMap;
477 472
478 typedef std::set<scoped_refptr<SpdyStream> > CreatedStreamSet; 473 typedef std::set<scoped_refptr<SpdyStream> > CreatedStreamSet;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 // empty. 656 // empty.
662 SpdyStreamId PopStreamToPossiblyResume(); 657 SpdyStreamId PopStreamToPossiblyResume();
663 658
664 // If session flow control is turned on, called by CreateDataFrame() 659 // If session flow control is turned on, called by CreateDataFrame()
665 // (which is in turn called by a stream) to decrease this session's 660 // (which is in turn called by a stream) to decrease this session's
666 // send window size by |delta_window_size|, which must be at least 1 661 // send window size by |delta_window_size|, which must be at least 1
667 // and at most kMaxSpdyFrameChunkSize. |delta_window_size| must not 662 // and at most kMaxSpdyFrameChunkSize. |delta_window_size| must not
668 // cause this session's send window size to go negative. 663 // cause this session's send window size to go negative.
669 void DecreaseSendWindowSize(int32 delta_window_size); 664 void DecreaseSendWindowSize(int32 delta_window_size);
670 665
666 // Called by SpdyBuffers (via ConsumeCallbacks) to increase this
667 // session's receive window size by |delta_window_size|, which must
668 // be at least 1 and must not cause this session's receive window
669 // size to overflow, possibly also sending a WINDOW_UPDATE
670 // frame. Also called during initialization to set the initial
671 // receive window size. Does nothing if session flow control is
672 // turned off.
673 void IncreaseRecvWindowSize(size_t delta_window_size);
674
671 // If session flow control is turned on, called by OnStreamFrameData 675 // If session flow control is turned on, called by OnStreamFrameData
672 // (which is in turn called by the framer) to decrease this 676 // (which is in turn called by the framer) to decrease this
673 // session's receive window size by |delta_window_size|, which must 677 // session's receive window size by |delta_window_size|, which must
674 // be at least 1 and must not cause this session's receive window 678 // be at least 1 and must not cause this session's receive window
675 // size to go negative. 679 // size to go negative.
676 void DecreaseRecvWindowSize(int32 delta_window_size); 680 void DecreaseRecvWindowSize(int32 delta_window_size);
677 681
678 // -------------------------- 682 // --------------------------
679 // Helper methods for testing 683 // Helper methods for testing
680 // -------------------------- 684 // --------------------------
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 // This SPDY proxy is allowed to push resources from origins that are 888 // This SPDY proxy is allowed to push resources from origins that are
885 // different from those of their associated streams. 889 // different from those of their associated streams.
886 HostPortPair trusted_spdy_proxy_; 890 HostPortPair trusted_spdy_proxy_;
887 891
888 TimeFunc time_func_; 892 TimeFunc time_func_;
889 }; 893 };
890 894
891 } // namespace net 895 } // namespace net
892 896
893 #endif // NET_SPDY_SPDY_SESSION_H_ 897 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698