Convert HttpTransaction to ByteSize Throughout the network stack many layers pass byte counts around as signed ints. It's often unclear which of those ints can hold negative values in practice (such as -1 to indicate errors). This makes it hard to deprecate ByteCount (signed) because the replacement, ByteSize, is unsigned, and high-level ByteCount fields are populated with values that come from deep in the network stack (eg. at https://crsrc.org/c/third_party/blink/renderer/platform/exported/resource_load_info_notifier_wrapper.cc;l=201;drc=64820206068b8feaf4b9d4de22362cfcf047b8b6). This replaces HttpTransaction methods returning int64_t, and all implementations, with ByteSize. Followups can bubble up the ByteSize type through the rest of the stack, checking whether negatives need to be handled at each layer. ByteSize holds values in the range [0, std::numeric_limits<int64_t>::max()], so the call sites that convert back to int64_t are guaranteed not to overflow. All implementations already use unsigned data sources except HttpNetworkTransaction which reads an int, but already checks for positive values. Internally, ByteSize CHECK's on overflow, so the only semantic change in this patch is a safety improvement: previously out-of-range values could overflow int64_t, now they will CHECK if that happens. Bug: 448661443 Change-Id: Ic3d2df42dffdeddf5ff69e17fd3149fbbcafed62 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7726691 Auto-Submit: Joe Mason <joenotcharles@google.com> Reviewed-by: Adam Rice <ricea@chromium.org> Commit-Queue: Joe Mason <joenotcharles@google.com> Cr-Commit-Position: refs/heads/main@{#1610804}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.