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

Unified Diff: net/spdy/http2_priority_dependencies.h

Issue 2596703002: http2: Update priorities of pushed streams (Closed)
Patch Set: Created 4 years 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/http2_priority_dependencies.h
diff --git a/net/spdy/http2_priority_dependencies.h b/net/spdy/http2_priority_dependencies.h
index cfd2106b94c722e2eb9c7c5f9c71ea2380cb94a9..d356a79586a63a3307f27c59555b9ddc6908c3c1 100644
--- a/net/spdy/http2_priority_dependencies.h
+++ b/net/spdy/http2_priority_dependencies.h
@@ -21,21 +21,32 @@ class NET_EXPORT_PRIVATE Http2PriorityDependencies {
Http2PriorityDependencies();
~Http2PriorityDependencies();
- // Called when a stream SYN is sent to the server. Note that in the
- // case of server push, a stream may be created without this routine
- // being called. In such cases, the client ignores the stream's priority
- // (as the server is effectively overriding the client's notions of
- // priority anyway).
+ // Called when a stream is created. This is used for both client-initiated
+ // and server-initiated (pushed) streams.
// On return, |*dependent_stream_id| is set to the stream id that
// this stream should be made dependent on, and |*exclusive| set to
// whether that dependency should be exclusive.
- void OnStreamSynSent(SpdyStreamId id,
- SpdyPriority priority,
- SpdyStreamId* dependent_stream_id,
- bool* exclusive);
+ void OnStreamCreation(SpdyStreamId id,
+ SpdyPriority priority,
+ SpdyStreamId* dependent_stream_id,
+ bool* exclusive);
+ // Called when a stream is destroyed.
void OnStreamDestruction(SpdyStreamId id);
+ struct DependencyUpdate {
+ SpdyStreamId id;
+ SpdyStreamId dependent_stream_id;
+ bool exclusive;
+ };
+
+ // Called when a stream's priority has changed. Returns a list of
+ // dependency updates that should be sent to the server to describe
+ // the requested priority change. The updates should be sent in the
+ // given order.
+ std::vector<DependencyUpdate> OnStreamUpdate(SpdyStreamId id,
+ SpdyPriority new_priority);
+
private:
// The requirements for the internal data structure for this class are:
// a) Constant time insertion of entries at the end of the list,
@@ -54,6 +65,21 @@ class NET_EXPORT_PRIVATE Http2PriorityDependencies {
// Iterators to list elements remain valid until those particular elements
// are erased.
EntryMap entry_by_stream_id_;
+
+ // Finds the lowest-priority stream that has a priority >= |priority|.
+ // Returns false if there are no such streams.
+ // Otherwise, returns true and sets |*bound|.
+ bool PriorityLowerBound(SpdyPriority priority, IdList::iterator* bound);
+
+ // Finds the stream just above |id| in the total order.
+ // Returns false if there are no streams with a higher priority.
+ // Otherwise, returns true and sets |*parent|.
+ bool ParentOfStream(SpdyStreamId id, IdList::iterator* parent);
+
+ // Finds the stream just below |id| in the total order.
+ // Returns false if there are no streams with a lower priority.
+ // Otherwise, returns true and sets |*child|.
+ bool ChildOfStream(SpdyStreamId id, IdList::iterator* child);
};
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698