diff options
author | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-15 03:11:45 +0000 |
---|---|---|
committer | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-15 03:11:45 +0000 |
commit | 5bfd0a44f68943ec285d9453e4ed7097b668c3de (patch) | |
tree | 369feacb755052e5c88cd44f3bc3babd61dcce0e /base/metrics/histogram.h | |
parent | 471021725505ede2d3b057a9d5363e20869b6bee (diff) | |
download | chromium_src-5bfd0a44f68943ec285d9453e4ed7097b668c3de.zip chromium_src-5bfd0a44f68943ec285d9453e4ed7097b668c3de.tar.gz chromium_src-5bfd0a44f68943ec285d9453e4ed7097b668c3de.tar.bz2 |
Make code generated for histogram macros more compact.
In builds where DCHECKs are compiled in (e.g. developer
builds and Chrome Canaries), the DCHECK_EQ() in the
histogram macro was expanding to a lot of generated
machine code.
This CL moves that DCHECK() to a function instead, so that the
code is not duplicated in every call site. The function call is
wrapped behind a DCHECK_IS_ON() conditional, so that it will
still be omitted if DCHECKs are not compiled into the build.
Makes my Chromium release build smaller by over 1MB,
measuring size of Chromium Framework.
Before size: 146547380
After size: 145400692
BUG=343946
TEST=No functional changes.
Review URL: https://codereview.chromium.org/167343002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/metrics/histogram.h')
-rw-r--r-- | base/metrics/histogram.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h index 7a6c688..02f3ac4 100644 --- a/base/metrics/histogram.h +++ b/base/metrics/histogram.h @@ -155,8 +155,8 @@ class Lock; base::subtle::Release_Store(&atomic_histogram_pointer, \ reinterpret_cast<base::subtle::AtomicWord>(histogram_pointer)); \ } \ - DCHECK_EQ(histogram_pointer->histogram_name(), \ - std::string(constant_histogram_name)); \ + if (DCHECK_IS_ON()) \ + histogram_pointer->CheckName(constant_histogram_name); \ histogram_pointer->histogram_add_method_invocation; \ } while (0) |