Cherry-picked as-is? What's the delta for the reland?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Cherry-picked as-is? What's the delta for the reland?
It's a reland created from Gerrit UI. I'll modify it. I didn't intend to request a review yet.
Commit-Queue | +1 |
gab: Please take a look. Thanks.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Reland "Use base::ByteCount in base::SysInfo."
This is a reland of commit 1d9a1d3425f0ab9b5350a70203c03a05ea83eabc
What changed?
Diff:
https://chromium-review.googlesource.com/c/chromium/src/+/6850973/1..7
Explanation:
The 1st CL unnecessarily modified the type of `sys_ram_size` in
base/android/sys_utils_unittest.cc, assuming that a `long` would be
enough to hold the result of multiplying 2 `long`. The test failure
suggests that an integer overflow occurred on 32-bits ARM Android:
crbug.com/438649892. Therefore, this CL changes
base/android/sys_utils_unittest.cc to use a int64_t for
`sys_ram_size`:
int64_t sys_ram_size =
static_cast<int64_t>(sysconf(_SC_PHYS_PAGES)) * sysconf(_SC_PAGESIZE);
Note that this is still different from the initial code:
size_t sys_ram_size =
static_cast<size_t>(sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE));
Which casted the result to size_t, but still did the computation
using `long`, which from what I understand is undefined behavior if
the result of the computation overflows.
Original change's description:
> Use base::ByteCount in base::SysInfo.
>
> Use base::ByteCount as the return value of
> SysInfo::AmountOfPhysicalMemory() and
> SysInfo::AmountOfAvailablePhysicalMemory() and adjust call sites across
> the codebase. Note that other methods in base::SysInfo could also return
> base::Bytes, but they're not upgraded in this CL to avoid making it
> bigger.
>
> base::ByteCount is a class to make bytes manipulations type safe, easier
> to read and less error-prone.
>
> NO_IFTTT=Code style change in base/system/sys_info.cc, does not affect code behavior.
>
> AX-Relnotes: n/a
> Bug: 429140103
> Change-Id: I540a58b843b1765a61d03bb5d7867b3bf8a2ddd1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6698912
> Reviewed-by: Gabriel Charette <g...@chromium.org>
> Owners-Override: Gabriel Charette <g...@chromium.org>
> Commit-Queue: Francois Pierre Doray <fdo...@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1501122}
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |