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

Unified 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: Tweaked comments and destruction notification vs. extra test util class. 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 side-by-side diff with in-line comments
Download patch
Index: net/spdy/spdy_session.h
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index 3ad5d27138d980b3d2adf9fab5cf5d73d6bbb3ce..1acfe1b9bb7bf871a0aa49dda8c40467c516765a 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -39,6 +39,10 @@
namespace net {
+namespace test {
+class SpdyStreamTest;
+}
+
// This is somewhat arbitrary and not really fixed, but it will always work
// reasonably with ethernet. Chop the world into 2-packet chunks. This is
// somewhat arbitrary, but is reasonably small and ensures that we elicit
@@ -517,9 +521,15 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
bool CloseOneIdleConnection() override;
private:
+ friend class test::SpdyStreamTest;
friend class base::RefCounted<SpdySession>;
- friend class SpdyStreamRequest;
+ friend class HttpNetworkTransactionTest;
+ friend class HttpProxyClientSocketPoolTest;
+ friend class SpdyHttpStreamTest;
+ friend class SpdyNetworkTransactionTest;
+ friend class SpdyProxyClientSocketTest;
friend class SpdySessionTest;
+ friend class SpdyStreamRequest;
// Allow tests to access our innards for testing purposes.
FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClientPing);
@@ -548,6 +558,7 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
FRIEND_TEST_ALL_PREFIXES(SpdySessionTest,
CancelReservedStreamOnHeadersReceived);
FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, RejectInvalidUnknownFrames);
+ FRIEND_TEST_ALL_PREFIXES(SpdySessionPoolTest, IPAddressChanged);
typedef std::deque<base::WeakPtr<SpdyStreamRequest> >
PendingStreamRequestQueue;
@@ -958,6 +969,10 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
size_t max_concurrent_streams() const { return max_concurrent_streams_; }
+ // Set whether priority->dependency conversion is enabled
+ // by default for all future SpdySessions.
+ static void SetPriorityDependencyDefaultForTesting(bool enable);
+
// Whether Do{Read,Write}Loop() is in the call stack. Useful for
// making sure we don't destroy ourselves prematurely in that case.
bool in_io_loop_;
@@ -1004,6 +1019,14 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
// them?
ActiveStreamMap active_streams_;
+ // Per-priority map from stream id to all active streams. This map will
+ // contain the same set of streams as |active_streams_|. It is used for
+ // setting dependencies to match incoming requests RequestPriority.
+ //
+ // |active_streams_by_priority_| does *not* own its SpdyStream objects.
+ std::map<SpdyStreamId, SpdyStream*>
+ active_streams_by_priority_[NUM_PRIORITIES];
+
// (Bijective) map from the URL to the ID of the streams that have
// already started to be pushed by the server, but do not have
// consumers yet. Contains a subset of |active_streams_|.
@@ -1182,6 +1205,10 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
TimeFunc time_func_;
+ // Should priority-based dependency information be sent in stream header
+ // frames.
+ bool send_priority_dependency_;
+
// Used for posting asynchronous IO tasks. We use this even though
// SpdySession is refcounted because we don't need to keep the SpdySession
// alive if the last reference is within a RunnableMethod. Just revoke the

Powered by Google App Engine
This is Rietveld 408576698