[net] Use an atomic counter to track received bytes.

With this CL, a global atomic counter is used to track bytes received
through //net's UDP and TCP sockets. This replaces the previous
lock-protected counter in a singleton object managed by LazyInstance.

An atomic counter is faster than a lock-protected counter:
https://chromeperf.appspot.com/report?sid=82ed117e0b1ef424ee3388019db813d17497700f688268d4cc7ccbbc0c72548c

A global avoids the memory barriers introduced by LazyInstance:
https://source.chromium.org/chromium/chromium/src/+/master:base/lazy_instance_helpers.h;l=58-95;drc=59b18de9525c94e2ee27748059d110c56aea32e9

We make these performance optimizations in preparation for
updating the counter every time bytes are received by UDPSocketPosix,
instead of updating on a timer.

Bug: 1189805
Change-Id: I8fd5da67f2a086352c60c7f6223d72ad87167d21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2774071
Commit-Queue: Eric Orth <ericorth@chromium.org>
Auto-Submit: François Doray <fdoray@chromium.org>
Reviewed-by: Eric Orth <ericorth@chromium.org>
Cr-Commit-Position: refs/heads/master@{#870991}
GitOrigin-RevId: 8ba18aaba7e6115401f3880827d58f04b94c2c38
8 files changed