Reland "[base] Don't include <ostream> in string_piece.h"

This is a reland of 472bf833d128c8aa368ad70d3f64e12b45a559d7
Includes fix for fuchsia-x64-dbg in
components/viz/service/surfaces/surface_reference.cc

Original change's description:
> [base] Don't include <ostream> in string_piece.h
>
> It's not needed, and adds ca 200 MB of compiler input to the build.
>
> This also adds an implementation of CHECK_OP's "argument stringification"
> function for std::string values, since those previously relied on
> operator<< for stringification which would now require including
> <ostream> in many new files.
>
> Bug: 242216
> Change-Id: I34807204a82e622e50a5bbcabb7055c0b2f51f21
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3009579
> Commit-Queue: Hans Wennborg <hans@chromium.org>
> Reviewed-by: danakj <danakj@chromium.org>
> Owners-Override: danakj <danakj@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#900025}

Cq-Include-Trybots: luci.chromium.try:fuchsia-compile-x64-dbg
Bug: 242216
Change-Id: Ibdf16a1ec0307bd94aed2bfb327b7c64317e96bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3015330
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900528}
diff --git a/base/check_op.cc b/base/check_op.cc
index 4f887fc..454e044 100644
--- a/base/check_op.cc
+++ b/base/check_op.cc
@@ -64,6 +64,10 @@
   return strdup("nullptr");
 }
 
+char* CheckOpValueStr(const std::string& v) {
+  return strdup(v.c_str());
+}
+
 char* CheckOpValueStr(double v) {
   char buf[50];
   snprintf(buf, sizeof(buf), "%.6lf", v);
diff --git a/base/check_op.h b/base/check_op.h
index 1acfa614..14dd479 100644
--- a/base/check_op.h
+++ b/base/check_op.h
@@ -6,6 +6,7 @@
 #define BASE_CHECK_OP_H_
 
 #include <cstddef>
+#include <string>
 #include <type_traits>
 
 #include "base/check.h"
@@ -42,6 +43,7 @@
 BASE_EXPORT char* CheckOpValueStr(const void* v);
 BASE_EXPORT char* CheckOpValueStr(std::nullptr_t v);
 BASE_EXPORT char* CheckOpValueStr(double v);
+BASE_EXPORT char* CheckOpValueStr(const std::string& v);
 
 // Convert a streamable value to string out-of-line to avoid <sstream>.
 BASE_EXPORT char* StreamValToStr(const void* v,
diff --git a/base/process/process_handle_win.cc b/base/process/process_handle_win.cc
index ccc7590..e33b8d87 100644
--- a/base/process/process_handle_win.cc
+++ b/base/process/process_handle_win.cc
@@ -7,6 +7,8 @@
 #include <windows.h>
 #include <tlhelp32.h>
 
+#include <ostream>
+
 #include "base/win/scoped_handle.h"
 #include "base/win/windows_version.h"
 
diff --git a/base/profiler/native_unwinder_mac.cc b/base/profiler/native_unwinder_mac.cc
index e644ee7a6..f3ec279f 100644
--- a/base/profiler/native_unwinder_mac.cc
+++ b/base/profiler/native_unwinder_mac.cc
@@ -4,6 +4,8 @@
 
 #include "base/profiler/native_unwinder_mac.h"
 
+#include <sys/types.h>  // This needs to come before sys/ptrace.h
+
 #include <mach-o/compact_unwind_encoding.h>
 #include <mach/mach.h>
 #include <mach/vm_map.h>
diff --git a/base/strings/string_piece.h b/base/strings/string_piece.h
index 85a63d1..5ceb3a40 100644
--- a/base/strings/string_piece.h
+++ b/base/strings/string_piece.h
@@ -25,7 +25,6 @@
 
 #include <iosfwd>
 #include <limits>
-#include <ostream>
 #include <string>
 #include <type_traits>
 
diff --git a/base/strings/utf_string_conversions.cc b/base/strings/utf_string_conversions.cc
index 46ca92d..8269b8ef 100644
--- a/base/strings/utf_string_conversions.cc
+++ b/base/strings/utf_string_conversions.cc
@@ -7,6 +7,7 @@
 #include <limits.h>
 #include <stdint.h>
 
+#include <ostream>
 #include <type_traits>
 
 #include "base/strings/string_piece.h"
diff --git a/base/trace_event/trace_arguments.cc b/base/trace_event/trace_arguments.cc
index 13626351..7dbb3cd 100644
--- a/base/trace_event/trace_arguments.cc
+++ b/base/trace_event/trace_arguments.cc
@@ -10,6 +10,7 @@
 #include <string.h>
 
 #include <cmath>
+#include <ostream>
 
 #include "base/check_op.h"
 #include "base/json/string_escape.h"
diff --git a/base/version.cc b/base/version.cc
index d084912e..ce791d8 100644
--- a/base/version.cc
+++ b/base/version.cc
@@ -7,6 +7,7 @@
 #include <stddef.h>
 
 #include <algorithm>
+#include <ostream>
 
 #include "base/check_op.h"
 #include "base/strings/string_number_conversions.h"
diff --git a/base/win/i18n.cc b/base/win/i18n.cc
index 936d7e6..851da4da 100644
--- a/base/win/i18n.cc
+++ b/base/win/i18n.cc
@@ -6,6 +6,8 @@
 
 #include <windows.h>
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "base/strings/string_piece.h"
 #include "base/strings/string_split.h"
diff --git a/chrome/browser/metrics/perf/random_selector.cc b/chrome/browser/metrics/perf/random_selector.cc
index eeab449..484c793 100644
--- a/chrome/browser/metrics/perf/random_selector.cc
+++ b/chrome/browser/metrics/perf/random_selector.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/metrics/perf/random_selector.h"
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "base/notreached.h"
 #include "base/rand_util.h"
diff --git a/components/cast_channel/enum_table.h b/components/cast_channel/enum_table.h
index cca3a665..a63ae86 100644
--- a/components/cast_channel/enum_table.h
+++ b/components/cast_channel/enum_table.h
@@ -7,6 +7,7 @@
 
 #include <cstdint>
 #include <cstring>
+#include <ostream>
 
 #include "base/check_op.h"
 #include "base/macros.h"
diff --git a/components/media_router/common/media_route_provider_helper.cc b/components/media_router/common/media_route_provider_helper.cc
index 6e17493..fb86dce 100644
--- a/components/media_router/common/media_route_provider_helper.cc
+++ b/components/media_router/common/media_route_provider_helper.cc
@@ -4,6 +4,8 @@
 
 #include "components/media_router/common/media_route_provider_helper.h"
 
+#include <ostream>
+
 #include "base/notreached.h"
 #include "base/strings/string_piece.h"
 
diff --git a/components/query_parser/query_parser.cc b/components/query_parser/query_parser.cc
index 5be2cd74..ed485f4 100644
--- a/components/query_parser/query_parser.cc
+++ b/components/query_parser/query_parser.cc
@@ -6,6 +6,7 @@
 
 #include <algorithm>
 #include <memory>
+#include <ostream>
 
 #include "base/check.h"
 #include "base/compiler_specific.h"
diff --git a/components/url_formatter/spoof_checks/skeleton_generator.cc b/components/url_formatter/spoof_checks/skeleton_generator.cc
index ed242a7..3cc1d4b 100644
--- a/components/url_formatter/spoof_checks/skeleton_generator.cc
+++ b/components/url_formatter/spoof_checks/skeleton_generator.cc
@@ -4,6 +4,8 @@
 
 #include "components/url_formatter/spoof_checks/skeleton_generator.h"
 
+#include <ostream>
+
 #include "base/memory/ptr_util.h"
 #include "base/strings/string_piece.h"
 #include "third_party/icu/source/i18n/unicode/regex.h"
diff --git a/components/visitedlink/common/visitedlink_common.cc b/components/visitedlink/common/visitedlink_common.cc
index e06f588..5cd8eed 100644
--- a/components/visitedlink/common/visitedlink_common.cc
+++ b/components/visitedlink/common/visitedlink_common.cc
@@ -6,6 +6,8 @@
 
 #include <string.h>  // for memset()
 
+#include <ostream>
+
 #include "base/bit_cast.h"
 #include "base/check.h"
 #include "base/hash/md5.h"
diff --git a/components/viz/common/surfaces/frame_sink_id.cc b/components/viz/common/surfaces/frame_sink_id.cc
index 553d3e6..62c830de 100644
--- a/components/viz/common/surfaces/frame_sink_id.cc
+++ b/components/viz/common/surfaces/frame_sink_id.cc
@@ -4,6 +4,8 @@
 
 #include "components/viz/common/surfaces/frame_sink_id.h"
 
+#include <ostream>
+
 #include "base/strings/string_piece.h"
 #include "base/strings/stringprintf.h"
 
diff --git a/components/viz/common/surfaces/surface_id.cc b/components/viz/common/surfaces/surface_id.cc
index ce26752..be76e1ac 100644
--- a/components/viz/common/surfaces/surface_id.cc
+++ b/components/viz/common/surfaces/surface_id.cc
@@ -2,12 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <algorithm>
-
 #include "components/viz/common/surfaces/surface_id.h"
-#include "components/viz/common/surfaces/surface_range.h"
+
+#include <algorithm>
+#include <ostream>
 
 #include "base/strings/stringprintf.h"
+#include "components/viz/common/surfaces/surface_range.h"
 
 namespace viz {
 
diff --git a/components/viz/common/surfaces/surface_range.cc b/components/viz/common/surfaces/surface_range.cc
index d3b96347..609f612 100644
--- a/components/viz/common/surfaces/surface_range.cc
+++ b/components/viz/common/surfaces/surface_range.cc
@@ -4,6 +4,7 @@
 
 #include "components/viz/common/surfaces/surface_range.h"
 
+#include <ostream>
 #include <string>
 
 #include "base/strings/stringprintf.h"
diff --git a/components/viz/service/surfaces/surface_reference.cc b/components/viz/service/surfaces/surface_reference.cc
index 721d9d3..39bae88 100644
--- a/components/viz/service/surfaces/surface_reference.cc
+++ b/components/viz/service/surfaces/surface_reference.cc
@@ -4,6 +4,8 @@
 
 #include "components/viz/service/surfaces/surface_reference.h"
 
+#include <ostream>
+
 #include "base/strings/stringprintf.h"
 
 namespace viz {
diff --git a/components/web_package/test_support/web_bundle_builder.cc b/components/web_package/test_support/web_bundle_builder.cc
index 4913f24..6555a52b 100644
--- a/components/web_package/test_support/web_bundle_builder.cc
+++ b/components/web_package/test_support/web_bundle_builder.cc
@@ -4,6 +4,8 @@
 
 #include "components/web_package/test_support/web_bundle_builder.h"
 
+#include <ostream>
+
 namespace web_package {
 namespace test {
 
diff --git a/content/browser/web_exposed_isolation_info.cc b/content/browser/web_exposed_isolation_info.cc
index 98c3d2a..5cecf227 100644
--- a/content/browser/web_exposed_isolation_info.cc
+++ b/content/browser/web_exposed_isolation_info.cc
@@ -4,6 +4,8 @@
 
 #include "content/browser/web_exposed_isolation_info.h"
 
+#include <ostream>
+
 namespace content {
 
 // static
diff --git a/device/bluetooth/public/cpp/bluetooth_uuid.cc b/device/bluetooth/public/cpp/bluetooth_uuid.cc
index 0831078..019e843 100644
--- a/device/bluetooth/public/cpp/bluetooth_uuid.cc
+++ b/device/bluetooth/public/cpp/bluetooth_uuid.cc
@@ -6,6 +6,7 @@
 
 #include <stddef.h>
 
+#include <ostream>
 #include <string>
 
 #include "base/check_op.h"
diff --git a/device/fido/mac/credential_metadata.cc b/device/fido/mac/credential_metadata.cc
index e28764b9..16526d1 100644
--- a/device/fido/mac/credential_metadata.cc
+++ b/device/fido/mac/credential_metadata.cc
@@ -4,6 +4,8 @@
 
 #include "device/fido/mac/credential_metadata.h"
 
+#include <ostream>
+
 #include "base/check.h"
 #include "base/notreached.h"
 #include "base/strings/string_number_conversions.h"
diff --git a/extensions/common/error_utils.cc b/extensions/common/error_utils.cc
index fd5aef4..c75e4ce3 100644
--- a/extensions/common/error_utils.cc
+++ b/extensions/common/error_utils.cc
@@ -5,6 +5,7 @@
 #include "extensions/common/error_utils.h"
 
 #include <initializer_list>
+#include <ostream>
 
 #include "base/check_op.h"
 #include "base/strings/string_piece.h"
diff --git a/extensions/common/extension_icon_set.cc b/extensions/common/extension_icon_set.cc
index d8b7d77b..5099247 100644
--- a/extensions/common/extension_icon_set.cc
+++ b/extensions/common/extension_icon_set.cc
@@ -4,6 +4,8 @@
 
 #include "extensions/common/extension_icon_set.h"
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "base/files/file_path.h"
 #include "base/strings/string_util.h"
diff --git a/ios/chrome/app/multitasking_test_scene_delegate.mm b/ios/chrome/app/multitasking_test_scene_delegate.mm
index 9824cf3..1594bea 100644
--- a/ios/chrome/app/multitasking_test_scene_delegate.mm
+++ b/ios/chrome/app/multitasking_test_scene_delegate.mm
@@ -4,6 +4,8 @@
 
 #import "ios/chrome/app/multitasking_test_scene_delegate.h"
 
+#include <ostream>
+
 #include "base/notreached.h"
 #import "ios/chrome/app/application_delegate/app_state.h"
 #import "ios/chrome/app/chrome_overlay_window.h"
diff --git a/ios/chrome/app/startup/register_experimental_settings.mm b/ios/chrome/app/startup/register_experimental_settings.mm
index 021e77e3..6a70452 100644
--- a/ios/chrome/app/startup/register_experimental_settings.mm
+++ b/ios/chrome/app/startup/register_experimental_settings.mm
@@ -4,6 +4,8 @@
 
 #include "ios/chrome/app/startup/register_experimental_settings.h"
 
+#include <ostream>
+
 #include "base/check.h"
 #include "base/mac/bundle_locations.h"
 #include "base/notreached.h"
diff --git a/ios/chrome/app/startup/setup_debugging.mm b/ios/chrome/app/startup/setup_debugging.mm
index 178f837..d3fcdf6 100644
--- a/ios/chrome/app/startup/setup_debugging.mm
+++ b/ios/chrome/app/startup/setup_debugging.mm
@@ -6,6 +6,8 @@
 
 #include <objc/runtime.h>
 
+#include <ostream>
+
 #include "base/check.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/crash/core/common/objc_zombie.h"
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm b/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm
index a8b86d63..f4541ce 100644
--- a/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm
+++ b/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm
@@ -4,6 +4,8 @@
 
 #import "ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.h"
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "base/ios/ns_range.h"
 #include "components/google/core/common/google_util.h"
diff --git a/ios/chrome/browser/ui/commands/command_dispatcher.mm b/ios/chrome/browser/ui/commands/command_dispatcher.mm
index df679270..a5776ea 100644
--- a/ios/chrome/browser/ui/commands/command_dispatcher.mm
+++ b/ios/chrome/browser/ui/commands/command_dispatcher.mm
@@ -5,6 +5,8 @@
 #import "ios/chrome/browser/ui/commands/command_dispatcher.h"
 
 #include <objc/runtime.h>
+
+#include <ostream>
 #include <unordered_map>
 #include <vector>
 
diff --git a/ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm b/ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm
index d4eb60d..ff6af27 100644
--- a/ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm
+++ b/ios/chrome/browser/ui/first_run/welcome_to_chrome_view.mm
@@ -6,6 +6,8 @@
 
 #import <MaterialComponents/MaterialTypography.h>
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "base/i18n/rtl.h"
 #include "base/ios/ns_range.h"
diff --git a/ios/chrome/browser/ui/util/label_observer.mm b/ios/chrome/browser/ui/util/label_observer.mm
index 2e66e557..3fe4738 100644
--- a/ios/chrome/browser/ui/util/label_observer.mm
+++ b/ios/chrome/browser/ui/util/label_observer.mm
@@ -6,6 +6,8 @@
 
 #import <objc/runtime.h>
 
+#include <ostream>
+
 #include "base/notreached.h"
 #include "base/strings/sys_string_conversions.h"
 
diff --git a/ios/chrome/common/credential_provider/archivable_credential_store.mm b/ios/chrome/common/credential_provider/archivable_credential_store.mm
index e5d84e8c..4a51e85 100644
--- a/ios/chrome/common/credential_provider/archivable_credential_store.mm
+++ b/ios/chrome/common/credential_provider/archivable_credential_store.mm
@@ -4,6 +4,8 @@
 
 #import "ios/chrome/common/credential_provider/archivable_credential_store.h"
 
+#include <ostream>
+
 #include "base/check.h"
 #include "base/notreached.h"
 #include "base/strings/sys_string_conversions.h"
diff --git a/ios/testing/ocmock_complex_type_helper.mm b/ios/testing/ocmock_complex_type_helper.mm
index 053f0f0b..37fa305 100644
--- a/ios/testing/ocmock_complex_type_helper.mm
+++ b/ios/testing/ocmock_complex_type_helper.mm
@@ -4,6 +4,8 @@
 
 #import "ios/testing/ocmock_complex_type_helper.h"
 
+#include <ostream>
+
 #include "base/check.h"
 #import "base/strings/sys_string_conversions.h"
 
diff --git a/ios/web/js_messaging/crw_js_window_id_manager.mm b/ios/web/js_messaging/crw_js_window_id_manager.mm
index 63dc312..8b98d6d 100644
--- a/ios/web/js_messaging/crw_js_window_id_manager.mm
+++ b/ios/web/js_messaging/crw_js_window_id_manager.mm
@@ -4,6 +4,8 @@
 
 #import "ios/web/js_messaging/crw_js_window_id_manager.h"
 
+#include <ostream>
+
 #include "base/dcheck_is_on.h"
 #include "base/notreached.h"
 #include "base/strings/string_number_conversions.h"
diff --git a/ios/web/navigation/crw_error_page_helper.mm b/ios/web/navigation/crw_error_page_helper.mm
index a08ac40..6fa9237 100644
--- a/ios/web/navigation/crw_error_page_helper.mm
+++ b/ios/web/navigation/crw_error_page_helper.mm
@@ -4,6 +4,8 @@
 
 #import "ios/web/navigation/crw_error_page_helper.h"
 
+#include <ostream>
+
 #include "base/check.h"
 #include "base/strings/sys_string_conversions.h"
 #include "net/base/escape.h"
diff --git a/media/base/cdm_key_information.cc b/media/base/cdm_key_information.cc
index 73bd18b..38aed14 100644
--- a/media/base/cdm_key_information.cc
+++ b/media/base/cdm_key_information.cc
@@ -4,6 +4,8 @@
 
 #include "media/base/cdm_key_information.h"
 
+#include <ostream>
+
 #include "base/notreached.h"
 #include "base/strings/string_number_conversions.h"
 
diff --git a/media/base/decrypt_config.cc b/media/base/decrypt_config.cc
index ff3ed63f..b874b34 100644
--- a/media/base/decrypt_config.cc
+++ b/media/base/decrypt_config.cc
@@ -6,6 +6,8 @@
 
 #include <stddef.h>
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "base/memory/ptr_util.h"
 #include "base/strings/string_number_conversions.h"
diff --git a/net/base/escape.cc b/net/base/escape.cc
index 23f9cda..f2d7eee 100644
--- a/net/base/escape.cc
+++ b/net/base/escape.cc
@@ -4,12 +4,15 @@
 
 #include "net/base/escape.h"
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "base/cxx17_backports.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversion_utils.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/third_party/icu/icu_utf.h"
+#include "build/build_config.h"
 
 namespace net {
 
diff --git a/net/base/hash_value.cc b/net/base/hash_value.cc
index ec440bb..4a35bda 100644
--- a/net/base/hash_value.cc
+++ b/net/base/hash_value.cc
@@ -5,7 +5,9 @@
 #include "net/base/hash_value.h"
 
 #include <stdlib.h>
+
 #include <algorithm>
+#include <ostream>
 
 #include "base/base64.h"
 #include "base/check_op.h"
diff --git a/net/base/ip_endpoint.cc b/net/base/ip_endpoint.cc
index f8da6e4..f4e5abb 100644
--- a/net/base/ip_endpoint.cc
+++ b/net/base/ip_endpoint.cc
@@ -4,6 +4,8 @@
 
 #include "net/base/ip_endpoint.h"
 
+#include <ostream>
+
 #include "build/build_config.h"
 
 #if defined(OS_WIN)
diff --git a/net/ssl/ssl_cipher_suite_names.cc b/net/ssl/ssl_cipher_suite_names.cc
index fb852b7d..8a539db 100644
--- a/net/ssl/ssl_cipher_suite_names.cc
+++ b/net/ssl/ssl_cipher_suite_names.cc
@@ -4,6 +4,8 @@
 
 #include "net/ssl/ssl_cipher_suite_names.h"
 
+#include <ostream>
+
 #include "base/notreached.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
diff --git a/remoting/signaling/signaling_address.cc b/remoting/signaling/signaling_address.cc
index b33ed1cd..93c4852 100644
--- a/remoting/signaling/signaling_address.cc
+++ b/remoting/signaling/signaling_address.cc
@@ -6,6 +6,8 @@
 
 #include <string.h>
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "base/notreached.h"
 #include "base/strings/string_util.h"
diff --git a/storage/browser/blob/blob_storage_constants.cc b/storage/browser/blob/blob_storage_constants.cc
index 96143d9..ba9c728 100644
--- a/storage/browser/blob/blob_storage_constants.cc
+++ b/storage/browser/blob/blob_storage_constants.cc
@@ -4,6 +4,8 @@
 
 #include "storage/browser/blob/blob_storage_constants.h"
 
+#include <ostream>
+
 #include "base/check.h"
 #include "base/command_line.h"
 #include "base/strings/string_number_conversions.h"
diff --git a/third_party/blink/common/bluetooth/web_bluetooth_device_id.cc b/third_party/blink/common/bluetooth/web_bluetooth_device_id.cc
index 7ba88c0..bca469b 100644
--- a/third_party/blink/common/bluetooth/web_bluetooth_device_id.cc
+++ b/third_party/blink/common/bluetooth/web_bluetooth_device_id.cc
@@ -4,6 +4,7 @@
 
 #include "third_party/blink/public/common/bluetooth/web_bluetooth_device_id.h"
 
+#include <ostream>
 #include <utility>
 
 #include "base/base64.h"
diff --git a/third_party/crashpad/crashpad/util/win/get_function.cc b/third_party/crashpad/crashpad/util/win/get_function.cc
index 3d00a7a..91a91652a 100644
--- a/third_party/crashpad/crashpad/util/win/get_function.cc
+++ b/third_party/crashpad/crashpad/util/win/get_function.cc
@@ -14,6 +14,8 @@
 
 #include "util/win/get_function.h"
 
+#include <ostream>
+
 #include "base/check.h"
 #include "base/strings/utf_string_conversions.h"
 
diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py
index 9945e70..b62b6a8 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -47,6 +47,7 @@
                self._namespace.short_filename))
       .Append()
       .Append('#include <memory>')
+      .Append('#include <ostream>')
       .Append('#include <string>')
       .Append('#include <utility>')
       .Append('#include <vector>')
diff --git a/ui/base/text/bytes_formatting.cc b/ui/base/text/bytes_formatting.cc
index 7cceda67..eda25e9 100644
--- a/ui/base/text/bytes_formatting.cc
+++ b/ui/base/text/bytes_formatting.cc
@@ -4,6 +4,8 @@
 
 #include "ui/base/text/bytes_formatting.h"
 
+#include <ostream>
+
 #include "base/check.h"
 #include "base/cxx17_backports.h"
 #include "base/i18n/number_formatting.h"
diff --git a/url/third_party/mozilla/url_parse.cc b/url/third_party/mozilla/url_parse.cc
index d882e3f..8a2d9d9d 100644
--- a/url/third_party/mozilla/url_parse.cc
+++ b/url/third_party/mozilla/url_parse.cc
@@ -38,6 +38,8 @@
 
 #include <stdlib.h>
 
+#include <ostream>
+
 #include "base/check_op.h"
 #include "url/url_parse_internal.h"
 #include "url/url_util.h"
diff --git a/url/url_idna_icu_alternatives_ios.mm b/url/url_idna_icu_alternatives_ios.mm
index c5da3593..0fb241b 100644
--- a/url/url_idna_icu_alternatives_ios.mm
+++ b/url/url_idna_icu_alternatives_ios.mm
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <ostream>
 #include <string>
 
 #include "base/strings/string_piece.h"
@@ -24,4 +25,4 @@
   return false;
 }
 
-}  // namespace url
\ No newline at end of file
+}  // namespace url
diff --git a/url/url_util.cc b/url/url_util.cc
index 00da5707..42bb76c 100644
--- a/url/url_util.cc
+++ b/url/url_util.cc
@@ -6,7 +6,9 @@
 
 #include <stddef.h>
 #include <string.h>
+
 #include <atomic>
+#include <ostream>
 
 #include "base/check_op.h"
 #include "base/compiler_specific.h"