Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Issue 2776853002: Make UMA_HISTOGRAM_ENUMERATION work with scoped enums. (Closed)

Created:
3 years, 9 months ago by dcheng
Modified:
3 years, 8 months ago
CC:
asvitkine+watch_chromium.org, chromium-reviews, danakj, Mark P, vmpstr+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Make UMA_HISTOGRAM_ENUMERATION work with scoped enums. Internally, the macro does some math on the macro arguments, which doesn't interact well with scoped enums. To work around this, the internal macro now explicitly casts the enum values to integral types. To ensure some modicum of safety, there are new static asserts to verify that the enum values are in range of HistogramBase::Sample. This breaks code that was using UMA_HISTOGRAM_ENUMERATION to record things that aren't C++ enumerations, so switch those to use UMA_HISTOGRAM_EXACT_LINEAR as well. BUG=705171 R=rkaplow,jochen,mrefaat,sky,thestig,xhwang TBR=mukai Review-Url: https://codereview.chromium.org/2776853002 Cr-Commit-Position: refs/heads/master@{#460938} Committed: https://chromium.googlesource.com/chromium/src/+/f6f4e494cd797690b41c4359c08bc33d49811759

Patch Set 1 #

Patch Set 2 : Debius #

Patch Set 3 : . #

Patch Set 4 : qualify with base:: #

Patch Set 5 : Another approach #

Patch Set 6 : Move headers back to internal #

Patch Set 7 : iOS, Windows, and CrOS compile fixes #

Total comments: 25

Patch Set 8 : . #

Patch Set 9 : Add comments #

Total comments: 1

Patch Set 10 : Better follow Chrome naming conventions #

Patch Set 11 : rebase #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+223 lines, -135 lines) Patch
M ash/common/shelf/shelf_view.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +7 lines, -4 lines 0 comments Download
M ash/common/shelf/shelf_view.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -5 lines 0 comments Download
M base/metrics/histogram_macros.h View 1 2 3 4 5 2 chunks +7 lines, -7 lines 0 comments Download
M base/metrics/histogram_macros_internal.h View 1 2 3 4 5 3 chunks +48 lines, -13 lines 3 comments Download
M base/metrics/histogram_macros_unittest.cc View 1 1 chunk +31 lines, -0 lines 0 comments Download
M base/metrics/histogram_unittest.nc View 1 2 1 chunk +16 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/first_run/first_run_controller.cc View 1 2 3 4 5 6 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/chromeos/login/screens/user_image_screen.cc View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc View 1 2 3 4 5 6 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/content_settings/web_site_settings_uma_util.cc View 1 2 3 4 1 chunk +8 lines, -8 lines 0 comments Download
M chrome/browser/devtools/devtools_ui_bindings.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/extensions/installed_loader.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/renderer_context_menu/render_view_context_menu.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +13 lines, -12 lines 0 comments Download
M chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/page_info/page_info.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc View 1 2 3 4 5 6 4 chunks +16 lines, -16 lines 0 comments Download
M chrome/browser/ui/webui/settings/chromeos/change_picture_handler.cc View 1 2 3 4 5 6 4 chunks +16 lines, -16 lines 0 comments Download
M components/content_settings/core/browser/host_content_settings_map.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -2 lines 0 comments Download
M components/history/core/browser/history_backend.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M components/user_prefs/tracked/tracked_preference_helper.cc View 1 2 3 4 1 chunk +4 lines, -3 lines 0 comments Download
M content/browser/gpu/gpu_data_manager_impl_private.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -6 lines 0 comments Download
M content/renderer/media/rtc_peer_connection_handler.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +14 lines, -12 lines 0 comments Download
M ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -4 lines 0 comments Download
M media/blink/resource_multibuffer_data_provider.cc View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -2 lines 0 comments Download
M ui/events/blink/input_handler_proxy.cc View 1 2 3 4 5 6 7 8 9 2 chunks +6 lines, -5 lines 0 comments Download

Messages

Total messages: 75 (52 generated)
dcheng
PTAL. There's still compile errors outside of Linux, but the fixes are straightforward and can ...
3 years, 9 months ago (2017-03-27 17:28:49 UTC) #20
Mark P
Handing this review off to rkaplow@, who's done most of the heavy lifting with histogram ...
3 years, 9 months ago (2017-03-27 17:45:27 UTC) #23
wychen
https://codereview.chromium.org/2776853002/diff/120001/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc File chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc (right): https://codereview.chromium.org/2776853002/diff/120001/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc#newcode355 chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc:355: UMA_HISTOGRAM_EXACT_LINEAR("UserImage.ChangeChoice", Do you know why these default_user_image:: constants have ...
3 years, 9 months ago (2017-03-27 19:44:01 UTC) #28
wychen
https://codereview.chromium.org/2776853002/diff/120001/base/metrics/histogram_macros_internal.h File base/metrics/histogram_macros_internal.h (right): https://codereview.chromium.org/2776853002/diff/120001/base/metrics/histogram_macros_internal.h#newcode138 base/metrics/histogram_macros_internal.h:138: // TODO(dcheng): This should assert that the passed in ...
3 years, 9 months ago (2017-03-27 20:08:56 UTC) #29
dcheng
https://codereview.chromium.org/2776853002/diff/120001/base/metrics/histogram_macros_internal.h File base/metrics/histogram_macros_internal.h (right): https://codereview.chromium.org/2776853002/diff/120001/base/metrics/histogram_macros_internal.h#newcode138 base/metrics/histogram_macros_internal.h:138: // TODO(dcheng): This should assert that the passed in ...
3 years, 8 months ago (2017-03-28 07:16:45 UTC) #32
dcheng
ping
3 years, 8 months ago (2017-03-29 16:39:16 UTC) #33
rkaplow
thanks for the fix and for fixing the clients. Mostly lg, just a few comments ...
3 years, 8 months ago (2017-03-29 18:02:51 UTC) #34
dcheng
https://codereview.chromium.org/2776853002/diff/120001/ash/common/shelf/shelf_view.h File ash/common/shelf/shelf_view.h (right): https://codereview.chromium.org/2776853002/diff/120001/ash/common/shelf/shelf_view.h#newcode61 ash/common/shelf/shelf_view.h:61: SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT, On 2017/03/29 18:02:50, rkaplow (slow) wrote: > Seems ...
3 years, 8 months ago (2017-03-29 18:24:41 UTC) #35
Mark P
https://codereview.chromium.org/2776853002/diff/120001/ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc File ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc (right): https://codereview.chromium.org/2776853002/diff/120001/ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc#newcode78 ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc:78: if (sms_entrypoint == i) { On 2017/03/29 18:24:40, dcheng ...
3 years, 8 months ago (2017-03-29 19:03:36 UTC) #37
rkaplow
lgtm https://codereview.chromium.org/2776853002/diff/120001/base/metrics/histogram_macros_internal.h File base/metrics/histogram_macros_internal.h (right): https://codereview.chromium.org/2776853002/diff/120001/base/metrics/histogram_macros_internal.h#newcode153 base/metrics/histogram_macros_internal.h:153: INTERNAL_HISTOGRAM_EXACT_LINEAR_WITH_FLAG( \ On 2017/03/29 18:24:40, dcheng wrote: > ...
3 years, 8 months ago (2017-03-29 23:21:17 UTC) #38
Mark P
https://codereview.chromium.org/2776853002/diff/120001/ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc File ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc (right): https://codereview.chromium.org/2776853002/diff/120001/ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc#newcode78 ios/chrome/browser/desktop_promotion/desktop_promotion_sync_observer.cc:78: if (sms_entrypoint == i) { On 2017/03/29 23:21:17, rkaplow ...
3 years, 8 months ago (2017-03-29 23:36:33 UTC) #39
dcheng
+sky for //ash, //chrome, //ui +jochen for //content, //components +sdefresne for //ios +xhwang for //media ...
3 years, 8 months ago (2017-03-30 00:41:59 UTC) #42
sky
LGTM https://codereview.chromium.org/2776853002/diff/160001/ui/events/blink/input_handler_proxy.cc File ui/events/blink/input_handler_proxy.cc (right): https://codereview.chromium.org/2776853002/diff/160001/ui/events/blink/input_handler_proxy.cc#newcode560 ui/events/blink/input_handler_proxy.cc:560: constexpr uint32_t mainThreadScrollingReasonEnumMax = kMainThread (or main_thread_sco...)
3 years, 8 months ago (2017-03-30 03:22:11 UTC) #47
xhwang
media/ lgtm
3 years, 8 months ago (2017-03-30 04:45:10 UTC) #50
sdefresne
lgtm ios/ looks good to me but you may want to ask mrefaat@ as OWNERS ...
3 years, 8 months ago (2017-03-30 09:14:06 UTC) #52
jochen (gone - plz use gerrit)
lgtm
3 years, 8 months ago (2017-03-30 11:52:07 UTC) #53
mrefaat
lgtm
3 years, 8 months ago (2017-03-30 18:55:43 UTC) #58
dcheng
TBRing mukai for noparent webui changes
3 years, 8 months ago (2017-03-30 21:01:16 UTC) #64
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2776853002/200001
3 years, 8 months ago (2017-03-30 21:02:58 UTC) #68
commit-bot: I haz the power
Committed patchset #11 (id:200001) as https://chromium.googlesource.com/chromium/src/+/f6f4e494cd797690b41c4359c08bc33d49811759
3 years, 8 months ago (2017-03-30 23:57:10 UTC) #71
Ilya Sherman
Thanks for working on this. https://codereview.chromium.org/2776853002/diff/200001/base/metrics/histogram_macros_internal.h File base/metrics/histogram_macros_internal.h (right): https://codereview.chromium.org/2776853002/diff/200001/base/metrics/histogram_macros_internal.h#newcode139 base/metrics/histogram_macros_internal.h:139: // types. It looks ...
3 years, 8 months ago (2017-03-31 00:28:15 UTC) #73
dcheng
https://codereview.chromium.org/2776853002/diff/200001/base/metrics/histogram_macros_internal.h File base/metrics/histogram_macros_internal.h (right): https://codereview.chromium.org/2776853002/diff/200001/base/metrics/histogram_macros_internal.h#newcode139 base/metrics/histogram_macros_internal.h:139: // types. On 2017/03/31 00:28:14, Ilya Sherman wrote: > ...
3 years, 8 months ago (2017-03-31 00:46:00 UTC) #74
Ilya Sherman
3 years, 8 months ago (2017-03-31 00:47:15 UTC) #75
Message was sent while issue was closed.
https://codereview.chromium.org/2776853002/diff/200001/base/metrics/histogram...
File base/metrics/histogram_macros_internal.h (right):

https://codereview.chromium.org/2776853002/diff/200001/base/metrics/histogram...
base/metrics/histogram_macros_internal.h:139: // types.
On 2017/03/31 00:46:00, dcheng wrote:
> On 2017/03/31 00:28:14, Ilya Sherman wrote:
> > It looks to me like the current code allows, say, doubles to be passed in as
> > arguments to this macro.  Is that working as intended?
> 
> I'll be addressing this TODO shortly. I expect to find interesting code in the
> process, but the end state should be relatively type safe (well, as safe as a
> macro is going to be =)

Okay, lovely -- thanks!

Powered by Google App Engine
This is Rietveld 408576698