diff options
author | danakj <danakj@chromium.org> | 2015-01-08 15:35:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-08 23:37:17 +0000 |
commit | e649f573a38b00bb20fe0925098251a4ff184566 (patch) | |
tree | 6f400822726e85def4cad5a1ee704e232a6364ad /base/metrics | |
parent | 95bc5b1779dcf8e4a9e37ef600c0ea76293307e3 (diff) | |
download | chromium_src-e649f573a38b00bb20fe0925098251a4ff184566.zip chromium_src-e649f573a38b00bb20fe0925098251a4ff184566.tar.gz chromium_src-e649f573a38b00bb20fe0925098251a4ff184566.tar.bz2 |
base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON().
This ensures that if the header is not included, and a DCHECK is guarded
by this check, that the file will fail to compile instead of silently
compiling the DCHECK out.
For example:
#if DCHECK_IS_ON
DCHECK(SomeThing());
#endif
This example would be compiled out if DCHECK_IS_ON was not defined due
to not including the logging.h header.
Instead, this will fail to compile:
#if DCHECK_IS_ON()
DCHECK(SomeThing());
#endif
R=thakis@chromium.org
Review URL: https://codereview.chromium.org/842523002
Cr-Commit-Position: refs/heads/master@{#310626}
Diffstat (limited to 'base/metrics')
-rw-r--r-- | base/metrics/histogram_macros.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/base/metrics/histogram_macros.h b/base/metrics/histogram_macros.h index a9996d1..e9a871c3 100644 --- a/base/metrics/histogram_macros.h +++ b/base/metrics/histogram_macros.h @@ -68,25 +68,25 @@ // a macro argument here. The name is only used in a DCHECK, to assure that // callers don't try to vary the name of the histogram (which would tend to be // ignored by the one-time initialization of the histogtram_pointer). -#define STATIC_HISTOGRAM_POINTER_BLOCK(constant_histogram_name, \ - histogram_add_method_invocation, \ - histogram_factory_get_invocation) \ - do { \ - static base::subtle::AtomicWord atomic_histogram_pointer = 0; \ - base::HistogramBase* histogram_pointer( \ - reinterpret_cast<base::HistogramBase*>( \ - base::subtle::Acquire_Load(&atomic_histogram_pointer))); \ - if (!histogram_pointer) { \ - histogram_pointer = histogram_factory_get_invocation; \ - base::subtle::Release_Store(&atomic_histogram_pointer, \ +#define STATIC_HISTOGRAM_POINTER_BLOCK(constant_histogram_name, \ + histogram_add_method_invocation, \ + histogram_factory_get_invocation) \ + do { \ + static base::subtle::AtomicWord atomic_histogram_pointer = 0; \ + base::HistogramBase* histogram_pointer( \ + reinterpret_cast<base::HistogramBase*>( \ + base::subtle::Acquire_Load(&atomic_histogram_pointer))); \ + if (!histogram_pointer) { \ + histogram_pointer = histogram_factory_get_invocation; \ + base::subtle::Release_Store( \ + &atomic_histogram_pointer, \ reinterpret_cast<base::subtle::AtomicWord>(histogram_pointer)); \ - } \ - if (DCHECK_IS_ON) \ - histogram_pointer->CheckName(constant_histogram_name); \ - histogram_pointer->histogram_add_method_invocation; \ + } \ + if (DCHECK_IS_ON()) \ + histogram_pointer->CheckName(constant_histogram_name); \ + histogram_pointer->histogram_add_method_invocation; \ } while (0) - //------------------------------------------------------------------------------ // Provide easy general purpose histogram in a macro, just like stats counters. // The first four macros use 50 buckets. |