Cherry-pick second fix
diff --git a/quic/core/frames/quic_max_stream_id_frame.cc b/quic/core/frames/quic_max_stream_id_frame.cc deleted file mode 100644 index 19270e8..0000000 --- a/quic/core/frames/quic_max_stream_id_frame.cc +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright (c) 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/third_party/quiche/src/quic/core/frames/quic_max_stream_id_frame.h" - -namespace quic { - -QuicMaxStreamIdFrame::QuicMaxStreamIdFrame() - : QuicInlinedFrame(MAX_STREAM_ID_FRAME), - control_frame_id(kInvalidControlFrameId) {} - -QuicMaxStreamIdFrame::QuicMaxStreamIdFrame(QuicControlFrameId control_frame_id, - QuicStreamId max_stream_id) - : QuicInlinedFrame(MAX_STREAM_ID_FRAME), - control_frame_id(control_frame_id), - max_stream_id(max_stream_id) {} - -std::ostream& operator<<(std::ostream& os, const QuicMaxStreamIdFrame& frame) { - os << "{ control_frame_id: " << frame.control_frame_id - << ", stream_id: " << frame.max_stream_id << " }\n"; - return os; -} - -} // namespace quic
diff --git a/quic/core/frames/quic_max_stream_id_frame.h b/quic/core/frames/quic_max_stream_id_frame.h deleted file mode 100644 index 6177687..0000000 --- a/quic/core/frames/quic_max_stream_id_frame.h +++ /dev/null
@@ -1,40 +0,0 @@ -// Copyright (c) 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_QUIC_CORE_FRAMES_QUIC_MAX_STREAM_ID_FRAME_H_ -#define QUICHE_QUIC_CORE_FRAMES_QUIC_MAX_STREAM_ID_FRAME_H_ - -#include <ostream> - -#include "net/third_party/quiche/src/quic/core/frames/quic_inlined_frame.h" -#include "net/third_party/quiche/src/quic/core/quic_constants.h" -#include "net/third_party/quiche/src/quic/core/quic_types.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_export.h" - -namespace quic { - -// IETF format MAX_STREAM_ID frame. -// This frame is used by the sender to inform the peer of the largest -// stream id that the peer may open and that the sender will accept. -struct QUIC_EXPORT_PRIVATE QuicMaxStreamIdFrame - : public QuicInlinedFrame<QuicMaxStreamIdFrame> { - QuicMaxStreamIdFrame(); - QuicMaxStreamIdFrame(QuicControlFrameId control_frame_id, - QuicStreamId max_stream_id); - - friend QUIC_EXPORT_PRIVATE std::ostream& operator<<( - std::ostream& os, - const QuicMaxStreamIdFrame& frame); - - // A unique identifier of this control frame. 0 when this frame is received, - // and non-zero when sent. - QuicControlFrameId control_frame_id; - - // The maximum stream id to support. - QuicStreamId max_stream_id; -}; - -} // namespace quic - -#endif // QUICHE_QUIC_CORE_FRAMES_QUIC_MAX_STREAM_ID_FRAME_H_
diff --git a/quic/core/frames/quic_stream_id_blocked_frame.cc b/quic/core/frames/quic_stream_id_blocked_frame.cc deleted file mode 100644 index 627ad2a..0000000 --- a/quic/core/frames/quic_stream_id_blocked_frame.cc +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright (c) 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/third_party/quiche/src/quic/core/frames/quic_stream_id_blocked_frame.h" - -namespace quic { - -QuicStreamIdBlockedFrame::QuicStreamIdBlockedFrame() - : QuicInlinedFrame(STREAM_ID_BLOCKED_FRAME), - control_frame_id(kInvalidControlFrameId) {} - -QuicStreamIdBlockedFrame::QuicStreamIdBlockedFrame( - QuicControlFrameId control_frame_id, - QuicStreamId stream_id) - : QuicInlinedFrame(STREAM_ID_BLOCKED_FRAME), - control_frame_id(control_frame_id), - stream_id(stream_id) {} - -std::ostream& operator<<(std::ostream& os, - const QuicStreamIdBlockedFrame& frame) { - os << "{ control_frame_id: " << frame.control_frame_id - << ", stream id: " << frame.stream_id << " }\n"; - return os; -} - -} // namespace quic
diff --git a/quic/core/frames/quic_stream_id_blocked_frame.h b/quic/core/frames/quic_stream_id_blocked_frame.h deleted file mode 100644 index f9ccca2..0000000 --- a/quic/core/frames/quic_stream_id_blocked_frame.h +++ /dev/null
@@ -1,40 +0,0 @@ -// Copyright (c) 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef QUICHE_QUIC_CORE_FRAMES_QUIC_STREAM_ID_BLOCKED_FRAME_H_ -#define QUICHE_QUIC_CORE_FRAMES_QUIC_STREAM_ID_BLOCKED_FRAME_H_ - -#include <ostream> - -#include "net/third_party/quiche/src/quic/core/frames/quic_inlined_frame.h" -#include "net/third_party/quiche/src/quic/core/quic_constants.h" -#include "net/third_party/quiche/src/quic/core/quic_types.h" -#include "net/third_party/quiche/src/quic/platform/api/quic_export.h" - -namespace quic { - -// IETF format STREAM_ID_BLOCKED frame. -// The sender uses this to inform the peer that the sender wished to -// open a new stream but was blocked from doing so due due to the -// maximum stream ID limit set by the peer (via a MAX_STREAM_ID frame) -struct QUIC_EXPORT_PRIVATE QuicStreamIdBlockedFrame - : public QuicInlinedFrame<QuicStreamIdBlockedFrame> { - QuicStreamIdBlockedFrame(); - QuicStreamIdBlockedFrame(QuicControlFrameId control_frame_id, - QuicStreamId stream_id); - - friend QUIC_EXPORT_PRIVATE std::ostream& operator<<( - std::ostream& os, - const QuicStreamIdBlockedFrame& frame); - - // A unique identifier of this control frame. 0 when this frame is received, - // and non-zero when sent. - QuicControlFrameId control_frame_id; - - QuicStreamId stream_id; -}; - -} // namespace quic - -#endif // QUICHE_QUIC_CORE_FRAMES_QUIC_STREAM_ID_BLOCKED_FRAME_H_
diff --git a/quic/core/quic_stream_id_manager_test.cc b/quic/core/quic_stream_id_manager_test.cc index 47b97cc..164e911 100644 --- a/quic/core/quic_stream_id_manager_test.cc +++ b/quic/core/quic_stream_id_manager_test.cc
@@ -202,10 +202,10 @@ // If bidi, Crypto stream default created at start up, it is one // more stream to account for since initialization is "number of // request/responses" & crypto is added in to that, not streams. - EXPECT_EQ(kDefaultMaxStreamsPerConnection + (GetParam() ? 1 : 0), + EXPECT_EQ(kDefaultMaxStreamsPerConnection + (GetParam() ? 1u : 0u), stream_id_manager_->outgoing_max_streams()); // Test is predicated on having 1 static stream going if bidi, 0 if not...) - EXPECT_EQ((GetParam() ? 1u : 0), + EXPECT_EQ((GetParam() ? 1u : 0u), stream_id_manager_->outgoing_static_stream_count()); EXPECT_EQ(kDefaultMaxStreamsPerConnection, @@ -243,7 +243,7 @@ // If bidi, Crypto stream default created at start up, it is one // more stream to account for since initialization is "number of // request/responses" & crypto is added in to that, not streams. - EXPECT_EQ(implementation_max - 1u + (GetParam() ? 1 : 0), + EXPECT_EQ(implementation_max - 1u + (GetParam() ? 1u : 0u), stream_id_manager_->outgoing_max_streams()); stream_id_manager_->AdjustMaxOpenOutgoingStreams(implementation_max); @@ -275,7 +275,7 @@ stream_id_manager_->incoming_initial_max_open_streams()); EXPECT_EQ(implementation_max - 1u, stream_id_manager_->incoming_actual_max_streams()); - EXPECT_EQ((implementation_max - 1u) / 2, + EXPECT_EQ((implementation_max - 1u) / 2u, stream_id_manager_->max_streams_window()); stream_id_manager_->SetMaxOpenIncomingStreams(implementation_max); @@ -296,7 +296,7 @@ stream_id_manager_->incoming_initial_max_open_streams()); EXPECT_EQ(implementation_max, stream_id_manager_->incoming_actual_max_streams()); - EXPECT_EQ(implementation_max / 2, stream_id_manager_->max_streams_window()); + EXPECT_EQ(implementation_max / 2u, stream_id_manager_->max_streams_window()); } // Check the case of the stream count in a STREAMS_BLOCKED frame is less than @@ -399,7 +399,7 @@ frame.unidirectional = IsUnidi(); EXPECT_TRUE(stream_id_manager_->OnMaxStreamsFrame(frame)); - EXPECT_EQ(initial_stream_count - 1, + EXPECT_EQ(initial_stream_count - 1u, stream_id_manager_->outgoing_max_streams()); QuicStreamCount save_outgoing_max_streams = @@ -417,7 +417,7 @@ frame.stream_count = initial_stream_count + 1; EXPECT_TRUE(stream_id_manager_->OnMaxStreamsFrame(frame)); - EXPECT_EQ(initial_stream_count + 1, + EXPECT_EQ(initial_stream_count + 1u, stream_id_manager_->outgoing_max_streams()); } @@ -455,10 +455,10 @@ // stream stream_id_manager_->OnStreamClosed( QuicStreamIdManagerPeer::GetFirstIncomingStreamId(stream_id_manager_)); - EXPECT_EQ(actual_stream_count + 1, + EXPECT_EQ(actual_stream_count + 1u, stream_id_manager_->incoming_actual_max_streams()); EXPECT_EQ(stream_id_manager_->incoming_actual_max_streams(), - stream_id_manager_->incoming_advertised_max_streams() + 1); + stream_id_manager_->incoming_advertised_max_streams() + 1u); // Now simulate receiving a STREAMS_BLOCKED frame... // Changing the actual maximum, above, forces a MAX_STREAMS frame to be @@ -496,7 +496,7 @@ // If bidi, Crypto stream default created at start up, it is one // more stream to account for since initialization is "number of // request/responses" & crypto is added in to that, not streams. - EXPECT_EQ(number_of_streams + (IsBidi() ? 1 : 0), + EXPECT_EQ(number_of_streams + (IsBidi() ? 1u : 0u), stream_id_manager_->outgoing_max_streams()); while (number_of_streams) { EXPECT_TRUE(stream_id_manager_->CanOpenNextOutgoingStream()); @@ -515,7 +515,7 @@ // If bidi, Crypto stream default created at start up, it is one // more stream to account for since initialization is "number of // request/responses" & crypto is added in to that, not streams. - EXPECT_EQ(kDefaultMaxStreamsPerConnection + (IsBidi() ? 1 : 0), + EXPECT_EQ(kDefaultMaxStreamsPerConnection + (IsBidi() ? 1u : 0u), session_->save_frame().max_streams_frame.stream_count); // If we try to get the next id (above the limit), it should cause a quic-bug. EXPECT_QUIC_BUG( @@ -630,7 +630,7 @@ // stream. stream_id_manager_->RegisterStaticStream(first_dynamic); // Should go up by 1 stream/stream id. - EXPECT_EQ(actual_max + 1, stream_id_manager_->incoming_actual_max_streams()); + EXPECT_EQ(actual_max + 1u, stream_id_manager_->incoming_actual_max_streams()); } // Check that the OnMaxStreamFrame logic properly handles all the @@ -648,7 +648,7 @@ // maximum frame.stream_count = max_stream_count - 10; EXPECT_TRUE(stream_id_manager_->OnMaxStreamsFrame(frame)); - EXPECT_EQ(max_stream_count - 10, stream_id_manager_->outgoing_max_streams()); + EXPECT_EQ(max_stream_count - 10u, stream_id_manager_->outgoing_max_streams()); // Now check if the offered count is larger than the max. // The count should be pegged at the max. @@ -783,7 +783,7 @@ // more stream to account for since initialization is "number of // request/responses" & crypto is added in to that, not streams. // Since this is the server, the stream is incoming. - EXPECT_EQ(kDefaultMaxStreamsPerConnection + (IsBidi() ? 1 : 0), + EXPECT_EQ(kDefaultMaxStreamsPerConnection + (IsBidi() ? 1u : 0u), stream_id_manager_->incoming_actual_max_streams()); EXPECT_EQ(kDefaultMaxStreamsPerConnection, stream_id_manager_->outgoing_max_streams()); @@ -838,7 +838,7 @@ // implementation maximum, frame.stream_count = max_stream_count - 10; EXPECT_TRUE(stream_id_manager_->OnMaxStreamsFrame(frame)); - EXPECT_EQ(max_stream_count - 10, stream_id_manager_->outgoing_max_streams()); + EXPECT_EQ(max_stream_count - 10u, stream_id_manager_->outgoing_max_streams()); // Check the case where the offered stream count is greater than the // implementation maximum. The count should peg at the maximum.
diff --git a/quic/core/uber_quic_stream_id_manager.cc b/quic/core/uber_quic_stream_id_manager.cc index 63abc3f..e2261a0 100644 --- a/quic/core/uber_quic_stream_id_manager.cc +++ b/quic/core/uber_quic_stream_id_manager.cc
@@ -8,14 +8,6 @@ #include "net/third_party/quiche/src/quic/core/quic_utils.h" namespace quic { -namespace { - -Perspective Reverse(Perspective perspective) { - return perspective == Perspective::IS_SERVER ? Perspective::IS_CLIENT - : Perspective::IS_SERVER; -} - -} // namespace UberQuicStreamIdManager::UberQuicStreamIdManager( QuicSession* session,