Use a consistent representation for integers in NetLog |
||
Issue descriptionCurrently any 64-bit integers are represented in NetLog by a string, in order to ensure it is round-trip serializable to JSON without losing precision. The first problem with this approach is that the policy to call base::NumberToString() is scattered across consumers rather than centralized. This should be refactored. Once refactored we have the opportunity to change the encoding. In the majority of cases we are emitting integers that are expected to be < 2^53 (representable by a double), so we can use a numeric encoding in JSON and reserve the string hack for the edge cases when we truly need it.
,
Dec 18
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0 commit aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0 Author: Eric Roman <eroman@chromium.org> Date: Tue Dec 18 21:38:01 2018 Use a consistent approach for encoding 64-bit ints in NetLogs. Introduces NetLogNumberValue() as a wrapper for adding int64 and uint64 values to a NetLog. Numbers whose absolute value is less than 2^53 will be represented by a numeric type in the JSON, otherwise they will be encoded as a base-10 string. Bug: 915391 Change-Id: I19d944f478b2fa8533f15ff2a47783318e73c074 Reviewed-on: https://chromium-review.googlesource.com/c/1378680 Commit-Queue: Eric Roman <eroman@chromium.org> Reviewed-by: Ryan Hamilton <rch@chromium.org> Cr-Commit-Position: refs/heads/master@{#617633} [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/disk_cache/net_log_parameters.cc [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/log/file_net_log_observer.cc [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/log/file_net_log_observer.h [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/log/net_log.cc [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/log/net_log.h [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/log/net_log_unittest.cc [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/log/net_log_util.cc [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/quic/quic_chromium_client_session.cc [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/quic/quic_connection_logger.cc [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/quic/quic_connectivity_probing_manager.cc [modify] https://crrev.com/aefc98c4a52b9af51cfc761abbc2bbcb6a0d75e0/net/quic/quic_network_transaction_unittest.cc
,
Dec 18
|
||
►
Sign in to add a comment |
||
Comment 1 by eroman@chromium.org
, Dec 14