gfe-relnote: Add NumRegisteredStreams interface to WriteScheduler and implements it in subclasses. No used in prod yet, not protected. Also move WriteSchedulerType to third_party/spdy/spdy_protocol.h to allow it be used by QUIC. PiperOrigin-RevId: 259786320 Change-Id: I71fd5b68be9c10bf47f576c3020af17f80212178
diff --git a/spdy/core/http2_priority_write_scheduler.h b/spdy/core/http2_priority_write_scheduler.h index 1f72fdb..d08d125 100644 --- a/spdy/core/http2_priority_write_scheduler.h +++ b/spdy/core/http2_priority_write_scheduler.h
@@ -76,11 +76,9 @@ PopNextReadyStreamAndPrecedence() override; size_t NumReadyStreams() const override; bool IsStreamReady(StreamIdType stream_id) const override; + size_t NumRegisteredStreams() const override; SpdyString DebugString() const override; - // Return the number of streams currently in the tree. - int num_streams() const; - private: friend class test::Http2PriorityWriteSchedulerPeer<StreamIdType>; @@ -201,11 +199,6 @@ } template <typename StreamIdType> -int Http2PriorityWriteScheduler<StreamIdType>::num_streams() const { - return all_stream_infos_.size(); -} - -template <typename StreamIdType> bool Http2PriorityWriteScheduler<StreamIdType>::StreamRegistered( StreamIdType stream_id) const { return SpdyContainsKey(all_stream_infos_, stream_id); @@ -696,8 +689,14 @@ } template <typename StreamIdType> +size_t Http2PriorityWriteScheduler<StreamIdType>::NumRegisteredStreams() const { + return all_stream_infos_.size(); +} + +template <typename StreamIdType> SpdyString Http2PriorityWriteScheduler<StreamIdType>::DebugString() const { - return SpdyStrCat("Http2PriorityWriteScheduler {num_streams=", num_streams(), + return SpdyStrCat("Http2PriorityWriteScheduler {num_registered_streams=", + NumRegisteredStreams(), " num_ready_streams=", NumReadyStreams(), "}"); } @@ -757,15 +756,15 @@ } } - // Make sure num_streams reflects the total number of streams the map - // contains. - if (total_streams != num_streams()) { + // Make sure NumRegisteredStreams() reflects the total number of streams the + // map contains. + if (total_streams != NumRegisteredStreams()) { SPDY_DLOG(INFO) << "Map contains incorrect number of streams."; return false; } // Validate the validation function; we should have visited each stream twice // (except for the root) - DCHECK(streams_visited == 2 * num_streams() - 1); + DCHECK(streams_visited == 2 * NumRegisteredStreams() - 1); return true; }