From 3a9002473ddf7272df6f9c53bc83544873ebb5b3 Mon Sep 17 00:00:00 2001 From: Mohannad Farrag Date: Tue, 30 Apr 2024 16:46:09 +0000 Subject: Remove zlib divergence Removed the zlib divergence where we had to replace line like `#include "third_party/zlib/zlib.h"` with `#include `. This was done by creating an actual header file whose path is `third_party/zlib zlib.h` that will include AOSP's header. Test: m cronet_aml_net_net && atest net_unittests_tester Bug: 321680067 Bug: 304217500 Change-Id: Ie794ff71c0d5f9c9083024bb5a3e05f1fadf6171 --- components/cronet/android/cronet_library_loader.cc | 2 +- net/disk_cache/simple/simple_entry_impl.cc | 2 +- net/disk_cache/simple/simple_synchronous_entry.cc | 2 +- net/disk_cache/simple/simple_util.cc | 2 +- net/disk_cache/simple/simple_version_upgrade.cc | 2 +- net/filter/filter_source_stream_test_util.cc | 2 +- net/filter/gzip_header.cc | 2 +- net/filter/gzip_source_stream.cc | 2 +- net/filter/gzip_source_stream_unittest.cc | 2 +- net/http/http_cache_transaction.cc | 1 - net/http/http_cache_unittest.cc | 1 + net/log/trace_net_log_observer_unittest.cc | 4 +++- net/socket/ssl_client_socket_impl.cc | 1 - net/spdy/spdy_session.cc | 1 - net/spdy/spdy_session_pool.cc | 1 - net/test/embedded_test_server/controllable_http_response.cc | 1 - .../content_decoder_tool/content_decoder_tool_unittest.cc | 2 +- net/url_request/url_request_context_builder_unittest.cc | 3 +-- net/websockets/websocket_deflater.cc | 2 +- net/websockets/websocket_inflater.cc | 2 +- third_party/zlib/README.md | 5 +++++ third_party/zlib/zlib.h | 12 ++++++++++++ 22 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 third_party/zlib/README.md create mode 100644 third_party/zlib/zlib.h diff --git a/components/cronet/android/cronet_library_loader.cc b/components/cronet/android/cronet_library_loader.cc index ee080dda9..f95ddda63 100644 --- a/components/cronet/android/cronet_library_loader.cc +++ b/components/cronet/android/cronet_library_loader.cc @@ -6,7 +6,6 @@ #include #include #include -#include #include "base/android/base_jni_onload.h" #include "base/android/build_info.h" @@ -38,6 +37,7 @@ #include "net/base/network_change_notifier.h" #include "net/proxy_resolution/configured_proxy_resolution_service.h" #include "net/proxy_resolution/proxy_config_service_android.h" +#include "third_party/zlib/zlib.h" #include "url/buildflags.h" #if !BUILDFLAG(USE_PLATFORM_ICU_ALTERNATIVES) diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc index 0ddd8507c..13e312d27 100644 --- a/net/disk_cache/simple/simple_entry_impl.cc +++ b/net/disk_cache/simple/simple_entry_impl.cc @@ -9,7 +9,6 @@ #include #include #include -#include #include "base/check_op.h" #include "base/functional/bind.h" @@ -37,6 +36,7 @@ #include "net/log/net_log.h" #include "net/log/net_log_source_type.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/zlib/zlib.h" namespace disk_cache { namespace { diff --git a/net/disk_cache/simple/simple_synchronous_entry.cc b/net/disk_cache/simple/simple_synchronous_entry.cc index 5621a2a09..3990b21a1 100644 --- a/net/disk_cache/simple/simple_synchronous_entry.cc +++ b/net/disk_cache/simple/simple_synchronous_entry.cc @@ -7,7 +7,6 @@ #include #include #include -#include #include "base/compiler_specific.h" #include "base/files/file_util.h" @@ -35,6 +34,7 @@ #include "net/disk_cache/simple/simple_util.h" #include "third_party/abseil-cpp/absl/container/inlined_vector.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/zlib/zlib.h" using base::FilePath; using base::Time; diff --git a/net/disk_cache/simple/simple_util.cc b/net/disk_cache/simple/simple_util.cc index edd8a9d78..d823335b5 100644 --- a/net/disk_cache/simple/simple_util.cc +++ b/net/disk_cache/simple/simple_util.cc @@ -5,7 +5,6 @@ #include "net/disk_cache/simple/simple_util.h" #include -#include #include "base/check_op.h" #include "base/files/file_util.h" @@ -17,6 +16,7 @@ #include "base/threading/thread_restrictions.h" #include "base/time/time.h" #include "net/disk_cache/simple/simple_entry_format.h" +#include "third_party/zlib/zlib.h" namespace { diff --git a/net/disk_cache/simple/simple_version_upgrade.cc b/net/disk_cache/simple/simple_version_upgrade.cc index 1d6bcce11..09d80c5af 100644 --- a/net/disk_cache/simple/simple_version_upgrade.cc +++ b/net/disk_cache/simple/simple_version_upgrade.cc @@ -5,7 +5,6 @@ #include "net/disk_cache/simple/simple_version_upgrade.h" #include -#include #include "base/files/file.h" #include "base/files/file_enumerator.h" @@ -17,6 +16,7 @@ #include "net/disk_cache/disk_cache.h" #include "net/disk_cache/simple/simple_backend_version.h" #include "net/disk_cache/simple/simple_entry_format_history.h" +#include "third_party/zlib/zlib.h" namespace { diff --git a/net/filter/filter_source_stream_test_util.cc b/net/filter/filter_source_stream_test_util.cc index 73ccfb75e..2e18235b7 100644 --- a/net/filter/filter_source_stream_test_util.cc +++ b/net/filter/filter_source_stream_test_util.cc @@ -5,10 +5,10 @@ #include "net/filter/filter_source_stream_test_util.h" #include -#include #include "base/bit_cast.h" #include "base/check_op.h" +#include "third_party/zlib/zlib.h" namespace net { diff --git a/net/filter/gzip_header.cc b/net/filter/gzip_header.cc index b0b1ed62b..69028c17b 100644 --- a/net/filter/gzip_header.cc +++ b/net/filter/gzip_header.cc @@ -7,9 +7,9 @@ #include #include -#include #include "base/check_op.h" +#include "third_party/zlib/zlib.h" namespace net { diff --git a/net/filter/gzip_source_stream.cc b/net/filter/gzip_source_stream.cc index 987b3cfb5..82e6f2a0a 100644 --- a/net/filter/gzip_source_stream.cc +++ b/net/filter/gzip_source_stream.cc @@ -7,7 +7,6 @@ #include #include #include -#include #include "base/bit_cast.h" #include "base/check_op.h" @@ -17,6 +16,7 @@ #include "base/notreached.h" #include "base/numerics/checked_math.h" #include "net/base/io_buffer.h" +#include "third_party/zlib/zlib.h" namespace net { diff --git a/net/filter/gzip_source_stream_unittest.cc b/net/filter/gzip_source_stream_unittest.cc index 10187807a..072371ce1 100644 --- a/net/filter/gzip_source_stream_unittest.cc +++ b/net/filter/gzip_source_stream_unittest.cc @@ -4,7 +4,6 @@ #include #include -#include #include "base/functional/bind.h" #include "base/functional/callback.h" @@ -15,6 +14,7 @@ #include "net/filter/gzip_source_stream.h" #include "net/filter/mock_source_stream.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/zlib/zlib.h" namespace net { diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index f348ad8aa..624ed6c25 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -32,7 +32,6 @@ #include "base/strings/string_util.h" // For EqualsCaseInsensitiveASCII. #include "base/task/single_thread_task_runner.h" #include "base/time/clock.h" -#include "base/trace_event/base_tracing.h" #include "base/trace_event/common/trace_event_common.h" #include "base/values.h" #include "net/base/auth.h" diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index f1dfdbb49..366e51a14 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -29,6 +29,7 @@ #include "base/test/scoped_feature_list.h" #include "base/test/simple_test_clock.h" #include "base/time/time.h" +#include "base/trace_event/memory_allocator_dump.h" #include "base/trace_event/memory_dump_request_args.h" #include "base/trace_event/process_memory_dump.h" #include "net/base/cache_type.h" diff --git a/net/log/trace_net_log_observer_unittest.cc b/net/log/trace_net_log_observer_unittest.cc index 9f4d3d17c..fd2b7dd73 100644 --- a/net/log/trace_net_log_observer_unittest.cc +++ b/net/log/trace_net_log_observer_unittest.cc @@ -17,7 +17,9 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/test/task_environment.h" -#include "base/trace_event/base_tracing.h" +#include "base/trace_event/trace_buffer.h" +#include "base/trace_event/trace_event.h" +#include "base/trace_event/trace_event_impl.h" #include "base/values.h" #include "net/log/net_log.h" #include "net/log/net_log_event_type.h" diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc index 77c681805..c5a000cd8 100644 --- a/net/socket/ssl_client_socket_impl.cc +++ b/net/socket/ssl_client_socket_impl.cc @@ -27,7 +27,6 @@ #include "base/rand_util.h" #include "base/strings/string_piece.h" #include "base/synchronization/lock.h" -#include "base/trace_event/base_tracing.h" #include "base/task/sequenced_task_runner.h" #include "base/values.h" #include "build/build_config.h" diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 323d53804..c9f9c4c56 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -27,7 +27,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/task/single_thread_task_runner.h" #include "base/time/time.h" -#include "base/trace_event/base_tracing.h" #include "base/trace_event/memory_usage_estimator.h" #include "base/values.h" #include "net/base/features.h" diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index 6e3f85336..23c31f164 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -12,7 +12,6 @@ #include "base/functional/bind.h" #include "base/metrics/histogram_macros.h" #include "base/ranges/algorithm.h" -#include "base/trace_event/base_tracing.h" #include "base/task/single_thread_task_runner.h" #include "base/values.h" #include "build/build_config.h" diff --git a/net/test/embedded_test_server/controllable_http_response.cc b/net/test/embedded_test_server/controllable_http_response.cc index 57d515c74..c95b76bb1 100644 --- a/net/test/embedded_test_server/controllable_http_response.cc +++ b/net/test/embedded_test_server/controllable_http_response.cc @@ -7,7 +7,6 @@ #include "base/check_op.h" #include "base/functional/bind.h" #include "base/strings/stringprintf.h" -#include "base/trace_event/base_tracing.h" #include "base/task/single_thread_task_runner.h" #include "net/base/tracing.h" #include "net/test/embedded_test_server/http_response.h" diff --git a/net/tools/content_decoder_tool/content_decoder_tool_unittest.cc b/net/tools/content_decoder_tool/content_decoder_tool_unittest.cc index 92ed6a693..0073b474e 100644 --- a/net/tools/content_decoder_tool/content_decoder_tool_unittest.cc +++ b/net/tools/content_decoder_tool/content_decoder_tool_unittest.cc @@ -8,7 +8,6 @@ #include #include #include -#include #include "base/files/file_util.h" #include "base/path_service.h" @@ -17,6 +16,7 @@ #include "net/filter/mock_source_stream.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +#include "third_party/zlib/zlib.h" namespace net { diff --git a/net/url_request/url_request_context_builder_unittest.cc b/net/url_request/url_request_context_builder_unittest.cc index f27a7c69e..d0d0e1553 100644 --- a/net/url_request/url_request_context_builder_unittest.cc +++ b/net/url_request/url_request_context_builder_unittest.cc @@ -31,7 +31,6 @@ #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_test_util.h" -#include "net/base/cronet_buildflags.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" #include "url/gurl.h" @@ -190,7 +189,7 @@ TEST_F(URLRequestContextBuilderTest, CustomHttpAuthHandlerFactory) { host_resolver_.get(), &handler)); } -#if BUILDFLAG(ENABLE_REPORTING) && !BUILDFLAG(CRONET_BUILD) +#if BUILDFLAG(ENABLE_REPORTING) // See crbug.com/935209. This test ensures that shutdown occurs correctly and // does not crash while destoying the NEL and Reporting services in the process // of destroying the URLRequestContext whilst Reporting has a pending upload. diff --git a/net/websockets/websocket_deflater.cc b/net/websockets/websocket_deflater.cc index 975baebee..f19d431bd 100644 --- a/net/websockets/websocket_deflater.cc +++ b/net/websockets/websocket_deflater.cc @@ -8,12 +8,12 @@ #include #include -#include #include "base/check.h" #include "base/check_op.h" #include "base/containers/circular_deque.h" #include "net/base/io_buffer.h" +#include "third_party/zlib/zlib.h" namespace net { diff --git a/net/websockets/websocket_inflater.cc b/net/websockets/websocket_inflater.cc index cfe0c5f3b..09198ed31 100644 --- a/net/websockets/websocket_inflater.cc +++ b/net/websockets/websocket_inflater.cc @@ -8,11 +8,11 @@ #include #include -#include #include "base/check.h" #include "base/check_op.h" #include "net/base/io_buffer.h" +#include "third_party/zlib/zlib.h" namespace net { diff --git a/third_party/zlib/README.md b/third_party/zlib/README.md new file mode 100644 index 000000000..43e3bac68 --- /dev/null +++ b/third_party/zlib/README.md @@ -0,0 +1,5 @@ +This directory was created manually and not imported from Chromium. It was created to remove the +divergence we had where we had to rename `#include "third_party/zlib/zlib.h"` line to +`#include `. This is due to the fact that we don't import Chromium's zlib and we use +zlib from AOSP. In order to workaround that, we redirect traffic from `third_party/zlib/zlib.h` to +AOSP's zlib. \ No newline at end of file diff --git a/third_party/zlib/zlib.h b/third_party/zlib/zlib.h new file mode 100644 index 000000000..ce946e91b --- /dev/null +++ b/third_party/zlib/zlib.h @@ -0,0 +1,12 @@ +// This directory was created manually and not imported from Chromium. It was created to remove the +// divergence we had where we had to rename `#include "third_party/zlib/zlib.h"` line to +// `#include `. This is due to the fact that we don't import Chromium's zlib and we use +// zlib from AOSP. In order to workaround that, we redirect traffic from `third_party/zlib/zlib.h` to +// AOSP's zlib. + +#ifndef THIRD_PARTY_ZLIB_ZLIB +#define THIRD_PARTY_ZLIB_ZLIB + +#include + +#endif // THIRD_PARTY_ZLIB_ZLIB \ No newline at end of file -- cgit v1.2.3