From 955c490ff6157d6833d27eceaae3b18f4302c30c Mon Sep 17 00:00:00 2001 From: Matt Menke Date: Wed, 24 Feb 2021 15:58:23 +0000 Subject: [PATCH] Remove legacy SourceStream::SourceTypes The are used in Accept-Encoding handling. The remove legacy types: SDCH/SDCH_POSSIBLE: Sdch support has since been removed. GZIP_FALLBACK: This used to be used when sniffing if deflate responses might actually be gzipped instead, but is no longer used (I believe we removed that logic, though may have just restructured it) Rejected: I believe this was specifically for when Brotli wasn't advertised but we received Brotli responses anyways, to discourage sites failing to respect Accept-Encoding advertisements, though it may have applied to other schemes. This logic has since been removed. We just don't decompress when we see an unadvertised encoding, currently. Invalid: I'm not sure if this was ever used. The only histogram that used these enums is Net.ContentDecodingFailed2, which expired and was removed in https://crbug.com/969974 Bug: NONE Change-Id: Id6968b8de8254e065ad57eb7a0fdb35d600c64dd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2716903 Reviewed-by: Alex Rudenko Reviewed-by: Maksim Orlovich Commit-Queue: Matt Menke Cr-Commit-Position: refs/heads/master@{#857189} --- net/BUILD.gn | 1 - net/filter/source_stream.h | 10 +++++----- net/filter/source_stream_type_list.h | 22 ---------------------- net/url_request/url_request_http_job.cc | 14 -------------- 4 files changed, 5 insertions(+), 42 deletions(-) delete mode 100644 net/filter/source_stream_type_list.h diff --git a/net/BUILD.gn b/net/BUILD.gn index f753e702b09e9c..9549eeb432d562 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn @@ -660,7 +660,6 @@ component("net") { "filter/gzip_source_stream.h", "filter/source_stream.cc", "filter/source_stream.h", - "filter/source_stream_type_list.h", "http/alternative_service.cc", "http/alternative_service.h", "http/bidirectional_stream.cc", diff --git a/net/filter/source_stream.h b/net/filter/source_stream.h index 1ae74e495bb1a8..53373971bfd8b4 100644 --- a/net/filter/source_stream.h +++ b/net/filter/source_stream.h @@ -22,11 +22,11 @@ class IOBuffer; class NET_EXPORT_PRIVATE SourceStream { public: enum SourceType { -#define SOURCE_STREAM_TYPE(label) TYPE_##label, -#include "net/filter/source_stream_type_list.h" -#undef SOURCE_STREAM_TYPE - // Used for UMA. - TYPE_MAX, + TYPE_BROTLI, + TYPE_DEFLATE, + TYPE_GZIP, + TYPE_UNKNOWN, + TYPE_NONE, }; // |type| is the type of the SourceStream. diff --git a/net/filter/source_stream_type_list.h b/net/filter/source_stream_type_list.h deleted file mode 100644 index 5eef7069f2efe7..00000000000000 --- a/net/filter/source_stream_type_list.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 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. - -// This file intentionally does not have header guards, it's included -// inside a macro to generate enum values. The following line silences a -// presubmit and Tricium warning that would otherwise be triggered by this: -// no-include-guard-because-multiply-included -// NOLINT(build/header_guard) - -// Specifies type of filters that can be created. Do not change the values -// of this enum; it is preserved in a histogram. -SOURCE_STREAM_TYPE(BROTLI) -SOURCE_STREAM_TYPE(DEFLATE) -SOURCE_STREAM_TYPE(GZIP) -SOURCE_STREAM_TYPE(GZIP_FALLBACK_DEPRECATED) -SOURCE_STREAM_TYPE(SDCH_DEPRECATED) -SOURCE_STREAM_TYPE(SDCH_POSSIBLE_DEPRECATED) -SOURCE_STREAM_TYPE(INVALID) -SOURCE_STREAM_TYPE(NONE) -SOURCE_STREAM_TYPE(REJECTED) -SOURCE_STREAM_TYPE(UNKNOWN) diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 849142ae28b75b..15cacc16cfa7ff 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -1115,14 +1115,6 @@ std::unique_ptr URLRequestHttpJob::SetUpSourceStream() { // Request will not be canceled; though // it is expected that user will see malformed / garbage response. return upstream; - case SourceStream::TYPE_GZIP_FALLBACK_DEPRECATED: - case SourceStream::TYPE_SDCH_DEPRECATED: - case SourceStream::TYPE_SDCH_POSSIBLE_DEPRECATED: - case SourceStream::TYPE_REJECTED: - case SourceStream::TYPE_INVALID: - case SourceStream::TYPE_MAX: - NOTREACHED(); - return nullptr; } } @@ -1137,14 +1129,8 @@ std::unique_ptr URLRequestHttpJob::SetUpSourceStream() { case SourceStream::TYPE_DEFLATE: downstream = GzipSourceStream::Create(std::move(upstream), type); break; - case SourceStream::TYPE_GZIP_FALLBACK_DEPRECATED: - case SourceStream::TYPE_SDCH_DEPRECATED: - case SourceStream::TYPE_SDCH_POSSIBLE_DEPRECATED: case SourceStream::TYPE_NONE: - case SourceStream::TYPE_INVALID: - case SourceStream::TYPE_REJECTED: case SourceStream::TYPE_UNKNOWN: - case SourceStream::TYPE_MAX: NOTREACHED(); return nullptr; }