gfe-relnote: (n/a) Platformize logging for http2. Refactor only, no behavior change. Note on merge: http2/platform/impl/http2_logging_impl.h also needs to be merged to Chromium. PiperOrigin-RevId: 237381363 Change-Id: I98a69eaeca7ac1353054120681e18e99a73c63c4
diff --git a/http2/decoder/payload_decoders/altsvc_payload_decoder.cc b/http2/decoder/payload_decoders/altsvc_payload_decoder.cc index 4e4d860..b6dde85 100644 --- a/http2/decoder/payload_decoders/altsvc_payload_decoder.cc +++ b/http2/decoder/payload_decoders/altsvc_payload_decoder.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include "base/logging.h" -#include "base/macros.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_macros.h" namespace http2 { @@ -39,8 +38,8 @@ DecodeStatus AltSvcPayloadDecoder::StartDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "AltSvcPayloadDecoder::StartDecodingPayload: " - << state->frame_header(); + HTTP2_DVLOG(2) << "AltSvcPayloadDecoder::StartDecodingPayload: " + << state->frame_header(); DCHECK_EQ(Http2FrameType::ALTSVC, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); DCHECK_EQ(0, state->frame_header().flags); @@ -55,7 +54,8 @@ FrameDecoderState* state, DecodeBuffer* db) { const Http2FrameHeader& frame_header = state->frame_header(); - DVLOG(2) << "AltSvcPayloadDecoder::ResumeDecodingPayload: " << frame_header; + HTTP2_DVLOG(2) << "AltSvcPayloadDecoder::ResumeDecodingPayload: " + << frame_header; DCHECK_EQ(Http2FrameType::ALTSVC, frame_header.type); DCHECK_LE(state->remaining_payload(), frame_header.payload_length); DCHECK_LE(db->Remaining(), state->remaining_payload()); @@ -65,8 +65,9 @@ // see DCHECK_NE above. DecodeStatus status = DecodeStatus::kDecodeError; while (true) { - DVLOG(2) << "AltSvcPayloadDecoder::ResumeDecodingPayload payload_state_=" - << payload_state_; + HTTP2_DVLOG(2) + << "AltSvcPayloadDecoder::ResumeDecodingPayload payload_state_=" + << payload_state_; switch (payload_state_) { case PayloadState::kStartDecodingStruct: status = state->StartDecodingStructureInPayload(&altsvc_fields_, db); @@ -108,9 +109,9 @@ DecodeStatus AltSvcPayloadDecoder::DecodeStrings(FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "AltSvcPayloadDecoder::DecodeStrings remaining_payload=" - << state->remaining_payload() - << ", db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "AltSvcPayloadDecoder::DecodeStrings remaining_payload=" + << state->remaining_payload() + << ", db->Remaining=" << db->Remaining(); // Note that we don't explicitly keep track of exactly how far through the // origin; instead we compute it from how much is left of the original // payload length and the decoded total length of the origin.
diff --git a/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc b/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc index 0221328..6a4bee5 100644 --- a/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/altsvc_payload_decoder_test.cc
@@ -6,12 +6,12 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" @@ -39,29 +39,29 @@ void OnAltSvcStart(const Http2FrameHeader& header, size_t origin_length, size_t value_length) override { - VLOG(1) << "OnAltSvcStart header: " << header - << "; origin_length=" << origin_length - << "; value_length=" << value_length; + HTTP2_VLOG(1) << "OnAltSvcStart header: " << header + << "; origin_length=" << origin_length + << "; value_length=" << value_length; StartFrame(header)->OnAltSvcStart(header, origin_length, value_length); } void OnAltSvcOriginData(const char* data, size_t len) override { - VLOG(1) << "OnAltSvcOriginData: len=" << len; + HTTP2_VLOG(1) << "OnAltSvcOriginData: len=" << len; CurrentFrame()->OnAltSvcOriginData(data, len); } void OnAltSvcValueData(const char* data, size_t len) override { - VLOG(1) << "OnAltSvcValueData: len=" << len; + HTTP2_VLOG(1) << "OnAltSvcValueData: len=" << len; CurrentFrame()->OnAltSvcValueData(data, len); } void OnAltSvcEnd() override { - VLOG(1) << "OnAltSvcEnd"; + HTTP2_VLOG(1) << "OnAltSvcEnd"; EndFrame()->OnAltSvcEnd(); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } }; @@ -88,15 +88,17 @@ AltSvcPayloadLengthTests() : origin_length_(::testing::get<0>(GetParam())), value_length_(::testing::get<1>(GetParam())) { - VLOG(1) << "################ origin_length_=" << origin_length_ - << " value_length_=" << value_length_ << " ################"; + HTTP2_VLOG(1) << "################ origin_length_=" << origin_length_ + << " value_length_=" << value_length_ + << " ################"; } const uint16_t origin_length_; const uint32_t value_length_; }; -INSTANTIATE_TEST_SUITE_P(VariousOriginAndValueLengths, AltSvcPayloadLengthTests, +INSTANTIATE_TEST_SUITE_P(VariousOriginAndValueLengths, + AltSvcPayloadLengthTests, ::testing::Combine(::testing::Values(0, 1, 3, 65535), ::testing::Values(0, 1, 3, 65537)));
diff --git a/http2/decoder/payload_decoders/continuation_payload_decoder.cc b/http2/decoder/payload_decoders/continuation_payload_decoder.cc index aa9c817..37109f2 100644 --- a/http2/decoder/payload_decoders/continuation_payload_decoder.cc +++ b/http2/decoder/payload_decoders/continuation_payload_decoder.cc
@@ -6,11 +6,11 @@ #include <stddef.h> -#include "base/logging.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" namespace http2 { @@ -20,8 +20,8 @@ const Http2FrameHeader& frame_header = state->frame_header(); const uint32_t total_length = frame_header.payload_length; - DVLOG(2) << "ContinuationPayloadDecoder::StartDecodingPayload: " - << frame_header; + HTTP2_DVLOG(2) << "ContinuationPayloadDecoder::StartDecodingPayload: " + << frame_header; DCHECK_EQ(Http2FrameType::CONTINUATION, frame_header.type); DCHECK_LE(db->Remaining(), total_length); DCHECK_EQ(0, frame_header.flags & ~(Http2FrameFlag::END_HEADERS)); @@ -34,9 +34,9 @@ DecodeStatus ContinuationPayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "ContinuationPayloadDecoder::ResumeDecodingPayload" - << " remaining_payload=" << state->remaining_payload() - << " db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "ContinuationPayloadDecoder::ResumeDecodingPayload" + << " remaining_payload=" << state->remaining_payload() + << " db->Remaining=" << db->Remaining(); DCHECK_EQ(Http2FrameType::CONTINUATION, state->frame_header().type); DCHECK_LE(state->remaining_payload(), state->frame_header().payload_length); DCHECK_LE(db->Remaining(), state->remaining_payload());
diff --git a/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc b/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc index 6e81828..35479a1 100644 --- a/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/continuation_payload_decoder_test.cc
@@ -8,12 +8,12 @@ #include <type_traits> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" @@ -39,17 +39,17 @@ struct Listener : public FramePartsCollector { void OnContinuationStart(const Http2FrameHeader& header) override { - VLOG(1) << "OnContinuationStart: " << header; + HTTP2_VLOG(1) << "OnContinuationStart: " << header; StartFrame(header)->OnContinuationStart(header); } void OnHpackFragment(const char* data, size_t len) override { - VLOG(1) << "OnHpackFragment: len=" << len; + HTTP2_VLOG(1) << "OnHpackFragment: len=" << len; CurrentFrame()->OnHpackFragment(data, len); } void OnContinuationEnd() override { - VLOG(1) << "OnContinuationEnd"; + HTTP2_VLOG(1) << "OnContinuationEnd"; EndFrame()->OnContinuationEnd(); } }; @@ -61,13 +61,15 @@ public ::testing::WithParamInterface<uint32_t> { protected: ContinuationPayloadDecoderTest() : length_(GetParam()) { - VLOG(1) << "################ length_=" << length_ << " ################"; + HTTP2_VLOG(1) << "################ length_=" << length_ + << " ################"; } const uint32_t length_; }; -INSTANTIATE_TEST_SUITE_P(VariousLengths, ContinuationPayloadDecoderTest, +INSTANTIATE_TEST_SUITE_P(VariousLengths, + ContinuationPayloadDecoderTest, ::testing::Values(0, 1, 2, 3, 4, 5, 6)); TEST_P(ContinuationPayloadDecoderTest, ValidLength) {
diff --git a/http2/decoder/payload_decoders/data_payload_decoder.cc b/http2/decoder/payload_decoders/data_payload_decoder.cc index b6b8041..fb483a8 100644 --- a/http2/decoder/payload_decoders/data_payload_decoder.cc +++ b/http2/decoder/payload_decoders/data_payload_decoder.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include "base/logging.h" -#include "base/macros.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_macros.h" namespace http2 { @@ -39,7 +38,8 @@ const Http2FrameHeader& frame_header = state->frame_header(); const uint32_t total_length = frame_header.payload_length; - DVLOG(2) << "DataPayloadDecoder::StartDecodingPayload: " << frame_header; + HTTP2_DVLOG(2) << "DataPayloadDecoder::StartDecodingPayload: " + << frame_header; DCHECK_EQ(Http2FrameType::DATA, frame_header.type); DCHECK_LE(db->Remaining(), total_length); DCHECK_EQ(0, frame_header.flags & @@ -49,11 +49,11 @@ // the decode buffer. TO BE SEEN if that is true. It certainly requires that // the transport buffers be large (e.g. >> 16KB typically). // TODO(jamessynge) Add counters. - DVLOG(2) << "StartDecodingPayload total_length=" << total_length; + HTTP2_DVLOG(2) << "StartDecodingPayload total_length=" << total_length; if (!frame_header.IsPadded()) { - DVLOG(2) << "StartDecodingPayload !IsPadded"; + HTTP2_DVLOG(2) << "StartDecodingPayload !IsPadded"; if (db->Remaining() == total_length) { - DVLOG(2) << "StartDecodingPayload all present"; + HTTP2_DVLOG(2) << "StartDecodingPayload all present"; // Note that we don't cache the listener field so that the callee can // replace it if the frame is bad. // If this case is common enough, consider combining the 3 callbacks @@ -77,8 +77,8 @@ DecodeStatus DataPayloadDecoder::ResumeDecodingPayload(FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "DataPayloadDecoder::ResumeDecodingPayload payload_state_=" - << payload_state_; + HTTP2_DVLOG(2) << "DataPayloadDecoder::ResumeDecodingPayload payload_state_=" + << payload_state_; const Http2FrameHeader& frame_header = state->frame_header(); DCHECK_EQ(Http2FrameType::DATA, frame_header.type); DCHECK_LE(state->remaining_payload_and_padding(),
diff --git a/http2/decoder/payload_decoders/data_payload_decoder_test.cc b/http2/decoder/payload_decoders/data_payload_decoder_test.cc index 0622f17..1cae714 100644 --- a/http2/decoder/payload_decoders/data_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/data_payload_decoder_test.cc
@@ -6,13 +6,13 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/platform/api/http2_test_helpers.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" @@ -43,34 +43,34 @@ struct Listener : public FramePartsCollector { void OnDataStart(const Http2FrameHeader& header) override { - VLOG(1) << "OnDataStart: " << header; + HTTP2_VLOG(1) << "OnDataStart: " << header; StartFrame(header)->OnDataStart(header); } void OnDataPayload(const char* data, size_t len) override { - VLOG(1) << "OnDataPayload: len=" << len; + HTTP2_VLOG(1) << "OnDataPayload: len=" << len; CurrentFrame()->OnDataPayload(data, len); } void OnDataEnd() override { - VLOG(1) << "OnDataEnd"; + HTTP2_VLOG(1) << "OnDataEnd"; EndFrame()->OnDataEnd(); } void OnPadLength(size_t pad_length) override { - VLOG(1) << "OnPadLength: " << pad_length; + HTTP2_VLOG(1) << "OnPadLength: " << pad_length; CurrentFrame()->OnPadLength(pad_length); } void OnPadding(const char* padding, size_t skipped_length) override { - VLOG(1) << "OnPadding: " << skipped_length; + HTTP2_VLOG(1) << "OnPadding: " << skipped_length; CurrentFrame()->OnPadding(padding, skipped_length); } void OnPaddingTooLong(const Http2FrameHeader& header, size_t missing_length) override { - VLOG(1) << "OnPaddingTooLong: " << header - << " missing_length: " << missing_length; + HTTP2_VLOG(1) << "OnPaddingTooLong: " << header + << " missing_length: " << missing_length; EndFrame()->OnPaddingTooLong(header, missing_length); } }; @@ -98,7 +98,8 @@ } }; -INSTANTIATE_TEST_SUITE_P(VariousPadLengths, DataPayloadDecoderTest, +INSTANTIATE_TEST_SUITE_P(VariousPadLengths, + DataPayloadDecoderTest, ::testing::Values(0, 1, 2, 3, 4, 254, 255, 256)); TEST_P(DataPayloadDecoderTest, VariousDataPayloadSizes) {
diff --git a/http2/decoder/payload_decoders/goaway_payload_decoder.cc b/http2/decoder/payload_decoders/goaway_payload_decoder.cc index cf7b673..d1402ae 100644 --- a/http2/decoder/payload_decoders/goaway_payload_decoder.cc +++ b/http2/decoder/payload_decoders/goaway_payload_decoder.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include "base/logging.h" -#include "base/macros.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_macros.h" namespace http2 { @@ -39,8 +38,8 @@ DecodeStatus GoAwayPayloadDecoder::StartDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "GoAwayPayloadDecoder::StartDecodingPayload: " - << state->frame_header(); + HTTP2_DVLOG(2) << "GoAwayPayloadDecoder::StartDecodingPayload: " + << state->frame_header(); DCHECK_EQ(Http2FrameType::GOAWAY, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); DCHECK_EQ(0, state->frame_header().flags); @@ -53,9 +52,9 @@ DecodeStatus GoAwayPayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "GoAwayPayloadDecoder::ResumeDecodingPayload: remaining_payload=" - << state->remaining_payload() - << ", db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) + << "GoAwayPayloadDecoder::ResumeDecodingPayload: remaining_payload=" + << state->remaining_payload() << ", db->Remaining=" << db->Remaining(); const Http2FrameHeader& frame_header = state->frame_header(); DCHECK_EQ(Http2FrameType::GOAWAY, frame_header.type); @@ -68,8 +67,9 @@ DecodeStatus status = DecodeStatus::kDecodeError; size_t avail; while (true) { - DVLOG(2) << "GoAwayPayloadDecoder::ResumeDecodingPayload payload_state_=" - << payload_state_; + HTTP2_DVLOG(2) + << "GoAwayPayloadDecoder::ResumeDecodingPayload payload_state_=" + << payload_state_; switch (payload_state_) { case PayloadState::kStartDecodingFixedFields: status = state->StartDecodingStructureInPayload(&goaway_fields_, db);
diff --git a/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc b/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc index c90cdcc..5ea533a 100644 --- a/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/goaway_payload_decoder_test.cc
@@ -6,12 +6,12 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" @@ -36,22 +36,23 @@ struct Listener : public FramePartsCollector { void OnGoAwayStart(const Http2FrameHeader& header, const Http2GoAwayFields& goaway) override { - VLOG(1) << "OnGoAwayStart header: " << header << "; goaway: " << goaway; + HTTP2_VLOG(1) << "OnGoAwayStart header: " << header + << "; goaway: " << goaway; StartFrame(header)->OnGoAwayStart(header, goaway); } void OnGoAwayOpaqueData(const char* data, size_t len) override { - VLOG(1) << "OnGoAwayOpaqueData: len=" << len; + HTTP2_VLOG(1) << "OnGoAwayOpaqueData: len=" << len; CurrentFrame()->OnGoAwayOpaqueData(data, len); } void OnGoAwayEnd() override { - VLOG(1) << "OnGoAwayEnd"; + HTTP2_VLOG(1) << "OnGoAwayEnd"; EndFrame()->OnGoAwayEnd(); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } }; @@ -77,13 +78,15 @@ public ::testing::WithParamInterface<uint32_t> { protected: GoAwayOpaqueDataLengthTests() : length_(GetParam()) { - VLOG(1) << "################ length_=" << length_ << " ################"; + HTTP2_VLOG(1) << "################ length_=" << length_ + << " ################"; } const uint32_t length_; }; -INSTANTIATE_TEST_SUITE_P(VariousLengths, GoAwayOpaqueDataLengthTests, +INSTANTIATE_TEST_SUITE_P(VariousLengths, + GoAwayOpaqueDataLengthTests, ::testing::Values(0, 1, 2, 3, 4, 5, 6)); TEST_P(GoAwayOpaqueDataLengthTests, ValidLength) {
diff --git a/http2/decoder/payload_decoders/headers_payload_decoder.cc b/http2/decoder/payload_decoders/headers_payload_decoder.cc index ecaf0fa..d177eb6 100644 --- a/http2/decoder/payload_decoders/headers_payload_decoder.cc +++ b/http2/decoder/payload_decoders/headers_payload_decoder.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include "base/logging.h" -#include "base/macros.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_macros.h" namespace http2 { @@ -44,7 +43,8 @@ const Http2FrameHeader& frame_header = state->frame_header(); const uint32_t total_length = frame_header.payload_length; - DVLOG(2) << "HeadersPayloadDecoder::StartDecodingPayload: " << frame_header; + HTTP2_DVLOG(2) << "HeadersPayloadDecoder::StartDecodingPayload: " + << frame_header; DCHECK_EQ(Http2FrameType::HEADERS, frame_header.type); DCHECK_LE(db->Remaining(), total_length); @@ -67,9 +67,9 @@ // set then we can decode faster. const auto payload_flags = Http2FrameFlag::PADDED | Http2FrameFlag::PRIORITY; if (!frame_header.HasAnyFlags(payload_flags)) { - DVLOG(2) << "StartDecodingPayload !IsPadded && !HasPriority"; + HTTP2_DVLOG(2) << "StartDecodingPayload !IsPadded && !HasPriority"; if (db->Remaining() == total_length) { - DVLOG(2) << "StartDecodingPayload all present"; + HTTP2_DVLOG(2) << "StartDecodingPayload all present"; // Note that we don't cache the listener field so that the callee can // replace it if the frame is bad. // If this case is common enough, consider combining the 3 callbacks @@ -97,9 +97,9 @@ DecodeStatus HeadersPayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "HeadersPayloadDecoder::ResumeDecodingPayload " - << "remaining_payload=" << state->remaining_payload() - << "; db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "HeadersPayloadDecoder::ResumeDecodingPayload " + << "remaining_payload=" << state->remaining_payload() + << "; db->Remaining=" << db->Remaining(); const Http2FrameHeader& frame_header = state->frame_header(); @@ -110,8 +110,9 @@ DecodeStatus status; size_t avail; while (true) { - DVLOG(2) << "HeadersPayloadDecoder::ResumeDecodingPayload payload_state_=" - << payload_state_; + HTTP2_DVLOG(2) + << "HeadersPayloadDecoder::ResumeDecodingPayload payload_state_=" + << payload_state_; switch (payload_state_) { case PayloadState::kReadPadLength: // ReadPadLength handles the OnPadLength callback, and updating the
diff --git a/http2/decoder/payload_decoders/headers_payload_decoder_test.cc b/http2/decoder/payload_decoders/headers_payload_decoder_test.cc index cb58b8e..a7a90bf 100644 --- a/http2/decoder/payload_decoders/headers_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/headers_payload_decoder_test.cc
@@ -6,12 +6,12 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" @@ -47,44 +47,44 @@ // via the public methods of FramePartsCollector. struct Listener : public FramePartsCollector { void OnHeadersStart(const Http2FrameHeader& header) override { - VLOG(1) << "OnHeadersStart: " << header; + HTTP2_VLOG(1) << "OnHeadersStart: " << header; StartFrame(header)->OnHeadersStart(header); } void OnHeadersPriority(const Http2PriorityFields& priority) override { - VLOG(1) << "OnHeadersPriority: " << priority; + HTTP2_VLOG(1) << "OnHeadersPriority: " << priority; CurrentFrame()->OnHeadersPriority(priority); } void OnHpackFragment(const char* data, size_t len) override { - VLOG(1) << "OnHpackFragment: len=" << len; + HTTP2_VLOG(1) << "OnHpackFragment: len=" << len; CurrentFrame()->OnHpackFragment(data, len); } void OnHeadersEnd() override { - VLOG(1) << "OnHeadersEnd"; + HTTP2_VLOG(1) << "OnHeadersEnd"; EndFrame()->OnHeadersEnd(); } void OnPadLength(size_t pad_length) override { - VLOG(1) << "OnPadLength: " << pad_length; + HTTP2_VLOG(1) << "OnPadLength: " << pad_length; CurrentFrame()->OnPadLength(pad_length); } void OnPadding(const char* padding, size_t skipped_length) override { - VLOG(1) << "OnPadding: " << skipped_length; + HTTP2_VLOG(1) << "OnPadding: " << skipped_length; CurrentFrame()->OnPadding(padding, skipped_length); } void OnPaddingTooLong(const Http2FrameHeader& header, size_t missing_length) override { - VLOG(1) << "OnPaddingTooLong: " << header - << "; missing_length: " << missing_length; + HTTP2_VLOG(1) << "OnPaddingTooLong: " << header + << "; missing_length: " << missing_length; FrameError(header)->OnPaddingTooLong(header, missing_length); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } }; @@ -94,14 +94,16 @@ HeadersPayloadDecoderPeer, Listener> {}; -INSTANTIATE_TEST_SUITE_P(VariousPadLengths, HeadersPayloadDecoderTest, +INSTANTIATE_TEST_SUITE_P(VariousPadLengths, + HeadersPayloadDecoderTest, ::testing::Values(0, 1, 2, 3, 4, 254, 255, 256)); // Decode various sizes of (fake) HPACK payload, both with and without the // PRIORITY flag set. TEST_P(HeadersPayloadDecoderTest, VariousHpackPayloadSizes) { for (size_t hpack_size : {0, 1, 2, 3, 255, 256, 1024}) { - LOG(INFO) << "########### hpack_size = " << hpack_size << " ###########"; + HTTP2_LOG(INFO) << "########### hpack_size = " << hpack_size + << " ###########"; Http2PriorityFields priority(RandStreamId(), 1 + Random().Rand8(), Random().OneIn(2));
diff --git a/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc b/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc index 88e1b98..ba6d04a 100644 --- a/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc +++ b/http2/decoder/payload_decoders/payload_decoder_base_test_util.cc
@@ -19,7 +19,7 @@ } DecodeStatus PayloadDecoderBaseTest::StartDecoding(DecodeBuffer* db) { - DVLOG(2) << "StartDecoding, db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "StartDecoding, db->Remaining=" << db->Remaining(); // Make sure sub-class has set frame_header_ so that we can inject it // into the payload decoder below. if (!frame_header_is_set_) { @@ -63,7 +63,7 @@ } DecodeStatus PayloadDecoderBaseTest::ResumeDecoding(DecodeBuffer* db) { - DVLOG(2) << "ResumeDecoding, db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "ResumeDecoding, db->Remaining=" << db->Remaining(); DecodeStatus status = ResumeDecodingPayload(db); if (status != DecodeStatus::kDecodeInProgress) { // Keep track of this so that a concrete test can verify that both fast
diff --git a/http2/decoder/payload_decoders/payload_decoder_base_test_util.h b/http2/decoder/payload_decoders/payload_decoder_base_test_util.h index 8297e70..66dd88a 100644 --- a/http2/decoder/payload_decoders/payload_decoder_base_test_util.h +++ b/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
@@ -9,7 +9,6 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/decode_status.h" @@ -18,6 +17,7 @@ #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_constants_test_util.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_reconstruct_object.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_piece.h" @@ -55,7 +55,7 @@ void set_frame_header(const Http2FrameHeader& header) { EXPECT_EQ(0, InvalidFlagMaskForFrameType(header.type) & header.flags); if (!frame_header_is_set_ || frame_header_ != header) { - VLOG(2) << "set_frame_header: " << frame_header_; + HTTP2_VLOG(2) << "set_frame_header: " << frame_header_; } frame_header_ = header; frame_header_is_set_ = true; @@ -174,13 +174,14 @@ // Start decoding the payload. DecodeStatus StartDecodingPayload(DecodeBuffer* db) override { - DVLOG(2) << "StartDecodingPayload, db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "StartDecodingPayload, db->Remaining=" << db->Remaining(); return payload_decoder_.StartDecodingPayload(mutable_state(), db); } // Resume decoding the payload. DecodeStatus ResumeDecodingPayload(DecodeBuffer* db) override { - DVLOG(2) << "ResumeDecodingPayload, db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "ResumeDecodingPayload, db->Remaining=" + << db->Remaining(); return payload_decoder_.ResumeDecodingPayload(mutable_state(), db); } @@ -220,8 +221,8 @@ validator = [header, validator, this]( const DecodeBuffer& input, DecodeStatus status) -> ::testing::AssertionResult { - DVLOG(2) << "VerifyDetectsFrameSizeError validator; status=" << status - << "; input.Remaining=" << input.Remaining(); + HTTP2_DVLOG(2) << "VerifyDetectsFrameSizeError validator; status=" + << status << "; input.Remaining=" << input.Remaining(); VERIFY_EQ(DecodeStatus::kDecodeError, status); VERIFY_FALSE(listener_.IsInProgress()); VERIFY_EQ(1u, listener_.size()); @@ -277,7 +278,7 @@ if (approve_size != nullptr && !approve_size(real_payload_size)) { continue; } - VLOG(1) << "real_payload_size=" << real_payload_size; + HTTP2_VLOG(1) << "real_payload_size=" << real_payload_size; uint8_t flags = required_flags | RandFlags(); Http2FrameBuilder fb; if (total_pad_length > 0) { @@ -343,7 +344,7 @@ typedef typename Base::Validator Validator; AbstractPaddablePayloadDecoderTest() : total_pad_length_(GetParam()) { - LOG(INFO) << "total_pad_length_ = " << total_pad_length_; + HTTP2_LOG(INFO) << "total_pad_length_ = " << total_pad_length_; } // Note that total_pad_length_ includes the size of the Pad Length field, @@ -422,12 +423,12 @@ if (IsPadded()) { fb.AppendUInt8(pad_length()); fb.AppendZeroes(pad_length()); - VLOG(1) << "fb.size=" << fb.size(); + HTTP2_VLOG(1) << "fb.size=" << fb.size(); // Pick a random length for the payload that is shorter than neccesary. payload_length = Random().Uniform(fb.size()); } - VLOG(1) << "payload_length=" << payload_length; + HTTP2_VLOG(1) << "payload_length=" << payload_length; Http2String payload = fb.buffer().substr(0, payload_length); // The missing length is the amount we cut off the end, unless @@ -435,7 +436,7 @@ // byte, the Pad Length field, is missing. size_t missing_length = payload_length == 0 ? 1 : fb.size() - payload_length; - VLOG(1) << "missing_length=" << missing_length; + HTTP2_VLOG(1) << "missing_length=" << missing_length; const Http2FrameHeader header(payload_length, DecoderPeer::FrameType(), flags, RandStreamId());
diff --git a/http2/decoder/payload_decoders/ping_payload_decoder.cc b/http2/decoder/payload_decoders/ping_payload_decoder.cc index 8d98046..1363d4f 100644 --- a/http2/decoder/payload_decoders/ping_payload_decoder.cc +++ b/http2/decoder/payload_decoders/ping_payload_decoder.cc
@@ -4,9 +4,9 @@ #include "net/third_party/quiche/src/http2/decoder/payload_decoders/ping_payload_decoder.h" -#include "base/logging.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" namespace http2 { namespace { @@ -18,7 +18,8 @@ const Http2FrameHeader& frame_header = state->frame_header(); const uint32_t total_length = frame_header.payload_length; - DVLOG(2) << "PingPayloadDecoder::StartDecodingPayload: " << frame_header; + HTTP2_DVLOG(2) << "PingPayloadDecoder::StartDecodingPayload: " + << frame_header; DCHECK_EQ(Http2FrameType::PING, frame_header.type); DCHECK_LE(db->Remaining(), total_length); DCHECK_EQ(0, frame_header.flags & ~(Http2FrameFlag::ACK)); @@ -50,8 +51,8 @@ DecodeStatus PingPayloadDecoder::ResumeDecodingPayload(FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "ResumeDecodingPayload: remaining_payload=" - << state->remaining_payload(); + HTTP2_DVLOG(2) << "ResumeDecodingPayload: remaining_payload=" + << state->remaining_payload(); DCHECK_EQ(Http2FrameType::PING, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); return HandleStatus( @@ -60,8 +61,8 @@ DecodeStatus PingPayloadDecoder::HandleStatus(FrameDecoderState* state, DecodeStatus status) { - DVLOG(2) << "HandleStatus: status=" << status - << "; remaining_payload=" << state->remaining_payload(); + HTTP2_DVLOG(2) << "HandleStatus: status=" << status + << "; remaining_payload=" << state->remaining_payload(); if (status == DecodeStatus::kDecodeDone) { if (state->remaining_payload() == 0) { const Http2FrameHeader& frame_header = state->frame_header();
diff --git a/http2/decoder/payload_decoders/ping_payload_decoder_test.cc b/http2/decoder/payload_decoders/ping_payload_decoder_test.cc index 34833b2..932149f 100644 --- a/http2/decoder/payload_decoders/ping_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/ping_payload_decoder_test.cc
@@ -6,12 +6,12 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -35,18 +35,18 @@ struct Listener : public FramePartsCollector { void OnPing(const Http2FrameHeader& header, const Http2PingFields& ping) override { - VLOG(1) << "OnPing: " << header << "; " << ping; + HTTP2_VLOG(1) << "OnPing: " << header << "; " << ping; StartAndEndFrame(header)->OnPing(header, ping); } void OnPingAck(const Http2FrameHeader& header, const Http2PingFields& ping) override { - VLOG(1) << "OnPingAck: " << header << "; " << ping; + HTTP2_VLOG(1) << "OnPingAck: " << header << "; " << ping; StartAndEndFrame(header)->OnPingAck(header, ping); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } };
diff --git a/http2/decoder/payload_decoders/priority_payload_decoder.cc b/http2/decoder/payload_decoders/priority_payload_decoder.cc index 7be1c95..0c5face 100644 --- a/http2/decoder/payload_decoders/priority_payload_decoder.cc +++ b/http2/decoder/payload_decoders/priority_payload_decoder.cc
@@ -4,19 +4,19 @@ #include "net/third_party/quiche/src/http2/decoder/payload_decoders/priority_payload_decoder.h" -#include "base/logging.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" namespace http2 { DecodeStatus PriorityPayloadDecoder::StartDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "PriorityPayloadDecoder::StartDecodingPayload: " - << state->frame_header(); + HTTP2_DVLOG(2) << "PriorityPayloadDecoder::StartDecodingPayload: " + << state->frame_header(); DCHECK_EQ(Http2FrameType::PRIORITY, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); // PRIORITY frames have no flags. @@ -29,9 +29,9 @@ DecodeStatus PriorityPayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "PriorityPayloadDecoder::ResumeDecodingPayload" - << " remaining_payload=" << state->remaining_payload() - << " db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "PriorityPayloadDecoder::ResumeDecodingPayload" + << " remaining_payload=" << state->remaining_payload() + << " db->Remaining=" << db->Remaining(); DCHECK_EQ(Http2FrameType::PRIORITY, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); return HandleStatus(
diff --git a/http2/decoder/payload_decoders/priority_payload_decoder_test.cc b/http2/decoder/payload_decoders/priority_payload_decoder_test.cc index 4e44eba..3b0ac15 100644 --- a/http2/decoder/payload_decoders/priority_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/priority_payload_decoder_test.cc
@@ -6,12 +6,12 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -37,12 +37,12 @@ struct Listener : public FramePartsCollector { void OnPriorityFrame(const Http2FrameHeader& header, const Http2PriorityFields& priority_fields) override { - VLOG(1) << "OnPriority: " << header << "; " << priority_fields; + HTTP2_VLOG(1) << "OnPriority: " << header << "; " << priority_fields; StartAndEndFrame(header)->OnPriorityFrame(header, priority_fields); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } };
diff --git a/http2/decoder/payload_decoders/push_promise_payload_decoder.cc b/http2/decoder/payload_decoders/push_promise_payload_decoder.cc index cec1c07..8b043b6 100644 --- a/http2/decoder/payload_decoders/push_promise_payload_decoder.cc +++ b/http2/decoder/payload_decoders/push_promise_payload_decoder.cc
@@ -6,13 +6,12 @@ #include <stddef.h> -#include "base/logging.h" -#include "base/macros.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" #include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_macros.h" namespace http2 { @@ -42,8 +41,8 @@ const Http2FrameHeader& frame_header = state->frame_header(); const uint32_t total_length = frame_header.payload_length; - DVLOG(2) << "PushPromisePayloadDecoder::StartDecodingPayload: " - << frame_header; + HTTP2_DVLOG(2) << "PushPromisePayloadDecoder::StartDecodingPayload: " + << frame_header; DCHECK_EQ(Http2FrameType::PUSH_PROMISE, frame_header.type); DCHECK_LE(db->Remaining(), total_length); @@ -66,9 +65,9 @@ DecodeStatus PushPromisePayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "UnknownPayloadDecoder::ResumeDecodingPayload" - << " remaining_payload=" << state->remaining_payload() - << " db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "UnknownPayloadDecoder::ResumeDecodingPayload" + << " remaining_payload=" << state->remaining_payload() + << " db->Remaining=" << db->Remaining(); const Http2FrameHeader& frame_header = state->frame_header(); DCHECK_EQ(Http2FrameType::PUSH_PROMISE, frame_header.type); @@ -77,7 +76,7 @@ DecodeStatus status; while (true) { - DVLOG(2) + HTTP2_DVLOG(2) << "PushPromisePayloadDecoder::ResumeDecodingPayload payload_state_=" << payload_state_; switch (payload_state_) {
diff --git a/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc b/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc index 94220f7..64dd935 100644 --- a/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/push_promise_payload_decoder_test.cc
@@ -6,12 +6,12 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" @@ -46,38 +46,38 @@ void OnPushPromiseStart(const Http2FrameHeader& header, const Http2PushPromiseFields& promise, size_t total_padding_length) override { - VLOG(1) << "OnPushPromiseStart header: " << header - << " promise: " << promise - << " total_padding_length: " << total_padding_length; + HTTP2_VLOG(1) << "OnPushPromiseStart header: " << header + << " promise: " << promise + << " total_padding_length: " << total_padding_length; EXPECT_EQ(Http2FrameType::PUSH_PROMISE, header.type); StartFrame(header)->OnPushPromiseStart(header, promise, total_padding_length); } void OnHpackFragment(const char* data, size_t len) override { - VLOG(1) << "OnHpackFragment: len=" << len; + HTTP2_VLOG(1) << "OnHpackFragment: len=" << len; CurrentFrame()->OnHpackFragment(data, len); } void OnPushPromiseEnd() override { - VLOG(1) << "OnPushPromiseEnd"; + HTTP2_VLOG(1) << "OnPushPromiseEnd"; EndFrame()->OnPushPromiseEnd(); } void OnPadding(const char* padding, size_t skipped_length) override { - VLOG(1) << "OnPadding: " << skipped_length; + HTTP2_VLOG(1) << "OnPadding: " << skipped_length; CurrentFrame()->OnPadding(padding, skipped_length); } void OnPaddingTooLong(const Http2FrameHeader& header, size_t missing_length) override { - VLOG(1) << "OnPaddingTooLong: " << header - << "; missing_length: " << missing_length; + HTTP2_VLOG(1) << "OnPaddingTooLong: " << header + << "; missing_length: " << missing_length; FrameError(header)->OnPaddingTooLong(header, missing_length); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } }; @@ -87,14 +87,16 @@ PushPromisePayloadDecoderPeer, Listener> {}; -INSTANTIATE_TEST_SUITE_P(VariousPadLengths, PushPromisePayloadDecoderTest, +INSTANTIATE_TEST_SUITE_P(VariousPadLengths, + PushPromisePayloadDecoderTest, ::testing::Values(0, 1, 2, 3, 4, 254, 255, 256)); // Payload contains the required Http2PushPromiseFields, followed by some // (fake) HPACK payload. TEST_P(PushPromisePayloadDecoderTest, VariousHpackPayloadSizes) { for (size_t hpack_size : {0, 1, 2, 3, 255, 256, 1024}) { - LOG(INFO) << "########### hpack_size = " << hpack_size << " ###########"; + HTTP2_LOG(INFO) << "########### hpack_size = " << hpack_size + << " ###########"; Reset(); Http2String hpack_payload = Random().RandString(hpack_size); Http2PushPromiseFields push_promise{RandStreamId()};
diff --git a/http2/decoder/payload_decoders/rst_stream_payload_decoder.cc b/http2/decoder/payload_decoders/rst_stream_payload_decoder.cc index c39a16a..720209d 100644 --- a/http2/decoder/payload_decoders/rst_stream_payload_decoder.cc +++ b/http2/decoder/payload_decoders/rst_stream_payload_decoder.cc
@@ -4,19 +4,19 @@ #include "net/third_party/quiche/src/http2/decoder/payload_decoders/rst_stream_payload_decoder.h" -#include "base/logging.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" namespace http2 { DecodeStatus RstStreamPayloadDecoder::StartDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "RstStreamPayloadDecoder::StartDecodingPayload: " - << state->frame_header(); + HTTP2_DVLOG(2) << "RstStreamPayloadDecoder::StartDecodingPayload: " + << state->frame_header(); DCHECK_EQ(Http2FrameType::RST_STREAM, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); // RST_STREAM has no flags. @@ -29,9 +29,9 @@ DecodeStatus RstStreamPayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "RstStreamPayloadDecoder::ResumeDecodingPayload" - << " remaining_payload=" << state->remaining_payload() - << " db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "RstStreamPayloadDecoder::ResumeDecodingPayload" + << " remaining_payload=" << state->remaining_payload() + << " db->Remaining=" << db->Remaining(); DCHECK_EQ(Http2FrameType::RST_STREAM, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); return HandleStatus( @@ -40,8 +40,8 @@ DecodeStatus RstStreamPayloadDecoder::HandleStatus(FrameDecoderState* state, DecodeStatus status) { - DVLOG(2) << "HandleStatus: status=" << status - << "; remaining_payload=" << state->remaining_payload(); + HTTP2_DVLOG(2) << "HandleStatus: status=" << status + << "; remaining_payload=" << state->remaining_payload(); if (status == DecodeStatus::kDecodeDone) { if (state->remaining_payload() == 0) { state->listener()->OnRstStream(state->frame_header(),
diff --git a/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc b/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc index 08f6621..6e00e80 100644 --- a/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/rst_stream_payload_decoder_test.cc
@@ -6,13 +6,13 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_constants_test_util.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -38,12 +38,12 @@ struct Listener : public FramePartsCollector { void OnRstStream(const Http2FrameHeader& header, Http2ErrorCode error_code) override { - VLOG(1) << "OnRstStream: " << header << "; error_code=" << error_code; + HTTP2_VLOG(1) << "OnRstStream: " << header << "; error_code=" << error_code; StartAndEndFrame(header)->OnRstStream(header, error_code); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } };
diff --git a/http2/decoder/payload_decoders/settings_payload_decoder.cc b/http2/decoder/payload_decoders/settings_payload_decoder.cc index bf29c4d..fb7d26a 100644 --- a/http2/decoder/payload_decoders/settings_payload_decoder.cc +++ b/http2/decoder/payload_decoders/settings_payload_decoder.cc
@@ -4,11 +4,11 @@ #include "net/third_party/quiche/src/http2/decoder/payload_decoders/settings_payload_decoder.h" -#include "base/logging.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" namespace http2 { @@ -18,7 +18,8 @@ const Http2FrameHeader& frame_header = state->frame_header(); const uint32_t total_length = frame_header.payload_length; - DVLOG(2) << "SettingsPayloadDecoder::StartDecodingPayload: " << frame_header; + HTTP2_DVLOG(2) << "SettingsPayloadDecoder::StartDecodingPayload: " + << frame_header; DCHECK_EQ(Http2FrameType::SETTINGS, frame_header.type); DCHECK_LE(db->Remaining(), total_length); DCHECK_EQ(0, frame_header.flags & ~(Http2FrameFlag::ACK)); @@ -41,9 +42,9 @@ DecodeStatus SettingsPayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "SettingsPayloadDecoder::ResumeDecodingPayload" - << " remaining_payload=" << state->remaining_payload() - << " db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "SettingsPayloadDecoder::ResumeDecodingPayload" + << " remaining_payload=" << state->remaining_payload() + << " db->Remaining=" << db->Remaining(); DCHECK_EQ(Http2FrameType::SETTINGS, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); @@ -59,9 +60,9 @@ DecodeStatus SettingsPayloadDecoder::StartDecodingSettings( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "SettingsPayloadDecoder::StartDecodingSettings" - << " remaining_payload=" << state->remaining_payload() - << " db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "SettingsPayloadDecoder::StartDecodingSettings" + << " remaining_payload=" << state->remaining_payload() + << " db->Remaining=" << db->Remaining(); while (state->remaining_payload() > 0) { DecodeStatus status = state->StartDecodingStructureInPayload(&setting_fields_, db); @@ -71,9 +72,9 @@ } return HandleNotDone(state, db, status); } - DVLOG(2) << "LEAVING SettingsPayloadDecoder::StartDecodingSettings" - << "\n\tdb->Remaining=" << db->Remaining() - << "\n\t remaining_payload=" << state->remaining_payload(); + HTTP2_DVLOG(2) << "LEAVING SettingsPayloadDecoder::StartDecodingSettings" + << "\n\tdb->Remaining=" << db->Remaining() + << "\n\t remaining_payload=" << state->remaining_payload(); state->listener()->OnSettingsEnd(); return DecodeStatus::kDecodeDone; }
diff --git a/http2/decoder/payload_decoders/settings_payload_decoder_test.cc b/http2/decoder/payload_decoders/settings_payload_decoder_test.cc index 3429779..d3f116b 100644 --- a/http2/decoder/payload_decoders/settings_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/settings_payload_decoder_test.cc
@@ -8,13 +8,13 @@ #include <vector> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_constants_test_util.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -41,29 +41,29 @@ struct Listener : public FramePartsCollector { void OnSettingsStart(const Http2FrameHeader& header) override { - VLOG(1) << "OnSettingsStart: " << header; + HTTP2_VLOG(1) << "OnSettingsStart: " << header; EXPECT_EQ(Http2FrameType::SETTINGS, header.type) << header; EXPECT_EQ(Http2FrameFlag(), header.flags) << header; StartFrame(header)->OnSettingsStart(header); } void OnSetting(const Http2SettingFields& setting_fields) override { - VLOG(1) << "Http2SettingFields: setting_fields=" << setting_fields; + HTTP2_VLOG(1) << "Http2SettingFields: setting_fields=" << setting_fields; CurrentFrame()->OnSetting(setting_fields); } void OnSettingsEnd() override { - VLOG(1) << "OnSettingsEnd"; + HTTP2_VLOG(1) << "OnSettingsEnd"; EndFrame()->OnSettingsEnd(); } void OnSettingsAck(const Http2FrameHeader& header) override { - VLOG(1) << "OnSettingsAck: " << header; + HTTP2_VLOG(1) << "OnSettingsAck: " << header; StartAndEndFrame(header)->OnSettingsAck(header); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } };
diff --git a/http2/decoder/payload_decoders/unknown_payload_decoder.cc b/http2/decoder/payload_decoders/unknown_payload_decoder.cc index 10eaf24..574fd61 100644 --- a/http2/decoder/payload_decoders/unknown_payload_decoder.cc +++ b/http2/decoder/payload_decoders/unknown_payload_decoder.cc
@@ -6,11 +6,11 @@ #include <stddef.h> -#include "base/logging.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" namespace http2 { @@ -19,7 +19,8 @@ DecodeBuffer* db) { const Http2FrameHeader& frame_header = state->frame_header(); - DVLOG(2) << "UnknownPayloadDecoder::StartDecodingPayload: " << frame_header; + HTTP2_DVLOG(2) << "UnknownPayloadDecoder::StartDecodingPayload: " + << frame_header; DCHECK(!IsSupportedHttp2FrameType(frame_header.type)) << frame_header; DCHECK_LE(db->Remaining(), frame_header.payload_length); @@ -31,9 +32,9 @@ DecodeStatus UnknownPayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "UnknownPayloadDecoder::ResumeDecodingPayload " - << "remaining_payload=" << state->remaining_payload() - << "; db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "UnknownPayloadDecoder::ResumeDecodingPayload " + << "remaining_payload=" << state->remaining_payload() + << "; db->Remaining=" << db->Remaining(); DCHECK(!IsSupportedHttp2FrameType(state->frame_header().type)) << state->frame_header(); DCHECK_LE(state->remaining_payload(), state->frame_header().payload_length);
diff --git a/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc b/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc index f9d203a..018bd82 100644 --- a/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/unknown_payload_decoder_test.cc
@@ -8,12 +8,12 @@ #include <type_traits> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" @@ -41,17 +41,17 @@ struct Listener : public FramePartsCollector { void OnUnknownStart(const Http2FrameHeader& header) override { - VLOG(1) << "OnUnknownStart: " << header; + HTTP2_VLOG(1) << "OnUnknownStart: " << header; StartFrame(header)->OnUnknownStart(header); } void OnUnknownPayload(const char* data, size_t len) override { - VLOG(1) << "OnUnknownPayload: len=" << len; + HTTP2_VLOG(1) << "OnUnknownPayload: len=" << len; CurrentFrame()->OnUnknownPayload(data, len); } void OnUnknownEnd() override { - VLOG(1) << "OnUnknownEnd"; + HTTP2_VLOG(1) << "OnUnknownEnd"; EndFrame()->OnUnknownEnd(); } }; @@ -66,7 +66,8 @@ public ::testing::WithParamInterface<uint32_t> { protected: UnknownPayloadDecoderTest() : length_(GetParam()) { - VLOG(1) << "################ length_=" << length_ << " ################"; + HTTP2_VLOG(1) << "################ length_=" << length_ + << " ################"; // Each test case will choose a random frame type that isn't supported. do { @@ -77,7 +78,8 @@ const uint32_t length_; }; -INSTANTIATE_TEST_SUITE_P(VariousLengths, UnknownPayloadDecoderTest, +INSTANTIATE_TEST_SUITE_P(VariousLengths, + UnknownPayloadDecoderTest, ::testing::Values(0, 1, 2, 3, 255, 256)); TEST_P(UnknownPayloadDecoderTest, ValidLength) {
diff --git a/http2/decoder/payload_decoders/window_update_payload_decoder.cc b/http2/decoder/payload_decoders/window_update_payload_decoder.cc index c0bb028..3f83339 100644 --- a/http2/decoder/payload_decoders/window_update_payload_decoder.cc +++ b/http2/decoder/payload_decoders/window_update_payload_decoder.cc
@@ -4,12 +4,12 @@ #include "net/third_party/quiche/src/http2/decoder/payload_decoders/window_update_payload_decoder.h" -#include "base/logging.h" #include "net/third_party/quiche/src/http2/decoder/decode_buffer.h" #include "net/third_party/quiche/src/http2/decoder/decode_http2_structures.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" namespace http2 { @@ -19,8 +19,8 @@ const Http2FrameHeader& frame_header = state->frame_header(); const uint32_t total_length = frame_header.payload_length; - DVLOG(2) << "WindowUpdatePayloadDecoder::StartDecodingPayload: " - << frame_header; + HTTP2_DVLOG(2) << "WindowUpdatePayloadDecoder::StartDecodingPayload: " + << frame_header; DCHECK_EQ(Http2FrameType::WINDOW_UPDATE, frame_header.type); DCHECK_LE(db->Remaining(), total_length); @@ -45,9 +45,9 @@ DecodeStatus WindowUpdatePayloadDecoder::ResumeDecodingPayload( FrameDecoderState* state, DecodeBuffer* db) { - DVLOG(2) << "ResumeDecodingPayload: remaining_payload=" - << state->remaining_payload() - << "; db->Remaining=" << db->Remaining(); + HTTP2_DVLOG(2) << "ResumeDecodingPayload: remaining_payload=" + << state->remaining_payload() + << "; db->Remaining=" << db->Remaining(); DCHECK_EQ(Http2FrameType::WINDOW_UPDATE, state->frame_header().type); DCHECK_LE(db->Remaining(), state->frame_header().payload_length); return HandleStatus(state, state->ResumeDecodingStructureInPayload( @@ -56,8 +56,8 @@ DecodeStatus WindowUpdatePayloadDecoder::HandleStatus(FrameDecoderState* state, DecodeStatus status) { - DVLOG(2) << "HandleStatus: status=" << status - << "; remaining_payload=" << state->remaining_payload(); + HTTP2_DVLOG(2) << "HandleStatus: status=" << status + << "; remaining_payload=" << state->remaining_payload(); if (status == DecodeStatus::kDecodeDone) { if (state->remaining_payload() == 0) { state->listener()->OnWindowUpdate(
diff --git a/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc b/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc index 77a2b90..66d7d7e 100644 --- a/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc +++ b/http2/decoder/payload_decoders/window_update_payload_decoder_test.cc
@@ -6,12 +6,12 @@ #include <stddef.h> -#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/quiche/src/http2/decoder/payload_decoders/payload_decoder_base_test_util.h" #include "net/third_party/quiche/src/http2/http2_constants.h" #include "net/third_party/quiche/src/http2/http2_structures_test_util.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts.h" #include "net/third_party/quiche/src/http2/test_tools/frame_parts_collector.h" #include "net/third_party/quiche/src/http2/test_tools/http2_random.h" @@ -37,14 +37,14 @@ struct Listener : public FramePartsCollector { void OnWindowUpdate(const Http2FrameHeader& header, uint32_t window_size_increment) override { - VLOG(1) << "OnWindowUpdate: " << header - << "; window_size_increment=" << window_size_increment; + HTTP2_VLOG(1) << "OnWindowUpdate: " << header + << "; window_size_increment=" << window_size_increment; EXPECT_EQ(Http2FrameType::WINDOW_UPDATE, header.type); StartAndEndFrame(header)->OnWindowUpdate(header, window_size_increment); } void OnFrameSizeError(const Http2FrameHeader& header) override { - VLOG(1) << "OnFrameSizeError: " << header; + HTTP2_VLOG(1) << "OnFrameSizeError: " << header; FrameError(header)->OnFrameSizeError(header); } }; @@ -57,7 +57,7 @@ Http2WindowUpdateFields RandWindowUpdateFields() { Http2WindowUpdateFields fields; test::Randomize(&fields, RandomPtr()); - VLOG(3) << "RandWindowUpdateFields: " << fields; + HTTP2_VLOG(3) << "RandWindowUpdateFields: " << fields; return fields; } };