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

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

Issue 1411383005: Initial implementation of RequestPriority-based HTTP/2 dependencies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated tests. Created 5 years, 1 month 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
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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // https://http2.github.io/http2-spec/#TLSUsage mandates minimum security 509 // https://http2.github.io/http2-spec/#TLSUsage mandates minimum security
510 // standards for TLS. 510 // standards for TLS.
511 bool HasAcceptableTransportSecurity() const; 511 bool HasAcceptableTransportSecurity() const;
512 512
513 // Must be used only by |pool_|. 513 // Must be used only by |pool_|.
514 base::WeakPtr<SpdySession> GetWeakPtr(); 514 base::WeakPtr<SpdySession> GetWeakPtr();
515 515
516 // HigherLayeredPool implementation: 516 // HigherLayeredPool implementation:
517 bool CloseOneIdleConnection() override; 517 bool CloseOneIdleConnection() override;
518 518
519 // Set whether priority->dependency conversion is enabled
520 // by default for all future SpdySessions.
521 static void SetPriorityDependencyDefaultForTesting(bool enable);
Bence 2015/11/11 18:47:15 I don't like the idea of having a global variable
Randy Smith (Not in Mondays) 2015/11/11 23:25:59 Agreed.
522
519 private: 523 private:
520 friend class base::RefCounted<SpdySession>; 524 friend class base::RefCounted<SpdySession>;
521 friend class SpdyStreamRequest; 525 friend class SpdyStreamRequest;
522 friend class SpdySessionTest; 526 friend class SpdySessionTest;
523 527
524 // Allow tests to access our innards for testing purposes. 528 // Allow tests to access our innards for testing purposes.
525 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClientPing); 529 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClientPing);
526 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing); 530 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing);
527 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); 531 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream);
528 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, DeleteExpiredPushStreams); 532 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, DeleteExpiredPushStreams);
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 // the server to start pushing the stream]) or there are still network events 1001 // the server to start pushing the stream]) or there are still network events
998 // incoming even though the consumer has already gone away (cancellation). 1002 // incoming even though the consumer has already gone away (cancellation).
999 // 1003 //
1000 // |active_streams_| owns all its SpdyStream objects. 1004 // |active_streams_| owns all its SpdyStream objects.
1001 // 1005 //
1002 // TODO(willchan): Perhaps we should separate out cancelled streams and move 1006 // TODO(willchan): Perhaps we should separate out cancelled streams and move
1003 // them into a separate ActiveStreamMap, and not deliver network events to 1007 // them into a separate ActiveStreamMap, and not deliver network events to
1004 // them? 1008 // them?
1005 ActiveStreamMap active_streams_; 1009 ActiveStreamMap active_streams_;
1006 1010
1011 // Per-priority map from stream id to all active streams. This map will
1012 // contain the same set of streams as |active_streams_|. It is used for
1013 // setting dependencies to match incoming requests RequestPriority.
1014 //
1015 // |active_streams_by_priority_| does *not* own its SpdyStream objects.
1016 std::map<SpdyStreamId, SpdyStream*>
1017 active_streams_by_priority_[NUM_PRIORITIES];
1018
1007 // (Bijective) map from the URL to the ID of the streams that have 1019 // (Bijective) map from the URL to the ID of the streams that have
1008 // already started to be pushed by the server, but do not have 1020 // already started to be pushed by the server, but do not have
1009 // consumers yet. Contains a subset of |active_streams_|. 1021 // consumers yet. Contains a subset of |active_streams_|.
1010 PushedStreamMap unclaimed_pushed_streams_; 1022 PushedStreamMap unclaimed_pushed_streams_;
1011 1023
1012 // Set of all created streams but that have not yet sent any frames. 1024 // Set of all created streams but that have not yet sent any frames.
1013 // 1025 //
1014 // |created_streams_| owns all its SpdyStream objects. 1026 // |created_streams_| owns all its SpdyStream objects.
1015 CreatedStreamSet created_streams_; 1027 CreatedStreamSet created_streams_;
1016 1028
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 // to build a new connection, and see if that completes before we (finally) 1187 // to build a new connection, and see if that completes before we (finally)
1176 // get a PING response (http://crbug.com/127812). 1188 // get a PING response (http://crbug.com/127812).
1177 base::TimeDelta hung_interval_; 1189 base::TimeDelta hung_interval_;
1178 1190
1179 // This SPDY proxy is allowed to push resources from origins that are 1191 // This SPDY proxy is allowed to push resources from origins that are
1180 // different from those of their associated streams. 1192 // different from those of their associated streams.
1181 HostPortPair trusted_spdy_proxy_; 1193 HostPortPair trusted_spdy_proxy_;
1182 1194
1183 TimeFunc time_func_; 1195 TimeFunc time_func_;
1184 1196
1197 // Should priority-based depencency information be sent in stream header
Bence 2015/11/11 18:47:15 s/depencency/dependency/
Randy Smith (Not in Mondays) 2015/11/11 23:25:59 Done.
1198 // frames.
1199 bool send_priority_dependency_;
1200
1185 // Used for posting asynchronous IO tasks. We use this even though 1201 // Used for posting asynchronous IO tasks. We use this even though
1186 // SpdySession is refcounted because we don't need to keep the SpdySession 1202 // SpdySession is refcounted because we don't need to keep the SpdySession
1187 // alive if the last reference is within a RunnableMethod. Just revoke the 1203 // alive if the last reference is within a RunnableMethod. Just revoke the
1188 // method. 1204 // method.
1189 base::WeakPtrFactory<SpdySession> weak_factory_; 1205 base::WeakPtrFactory<SpdySession> weak_factory_;
1190 }; 1206 };
1191 1207
1192 } // namespace net 1208 } // namespace net
1193 1209
1194 #endif // NET_SPDY_SPDY_SESSION_H_ 1210 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698