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/tracked_objects.cc | |
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/tracked_objects.cc')
-rw-r--r-- | base/tracked_objects.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index 4320509..fc29e2e 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -873,21 +873,21 @@ TaskStopwatch::TaskStopwatch() current_thread_data_(NULL), excluded_duration_ms_(0), parent_(NULL) { -#if DCHECK_IS_ON +#if DCHECK_IS_ON() state_ = CREATED; child_ = NULL; #endif } TaskStopwatch::~TaskStopwatch() { -#if DCHECK_IS_ON +#if DCHECK_IS_ON() DCHECK(state_ != RUNNING); DCHECK(child_ == NULL); #endif } void TaskStopwatch::Start() { -#if DCHECK_IS_ON +#if DCHECK_IS_ON() DCHECK(state_ == CREATED); state_ = RUNNING; #endif @@ -899,7 +899,7 @@ void TaskStopwatch::Start() { return; parent_ = current_thread_data_->current_stopwatch_; -#if DCHECK_IS_ON +#if DCHECK_IS_ON() if (parent_) { DCHECK(parent_->state_ == RUNNING); DCHECK(parent_->child_ == NULL); @@ -911,7 +911,7 @@ void TaskStopwatch::Start() { void TaskStopwatch::Stop() { const TrackedTime end_time = ThreadData::Now(); -#if DCHECK_IS_ON +#if DCHECK_IS_ON() DCHECK(state_ == RUNNING); state_ = STOPPED; DCHECK(child_ == NULL); @@ -929,7 +929,7 @@ void TaskStopwatch::Stop() { if (!parent_) return; -#if DCHECK_IS_ON +#if DCHECK_IS_ON() DCHECK(parent_->state_ == RUNNING); DCHECK(parent_->child_ == this); parent_->child_ = NULL; @@ -939,7 +939,7 @@ void TaskStopwatch::Stop() { } TrackedTime TaskStopwatch::StartTime() const { -#if DCHECK_IS_ON +#if DCHECK_IS_ON() DCHECK(state_ != CREATED); #endif @@ -947,7 +947,7 @@ TrackedTime TaskStopwatch::StartTime() const { } int32 TaskStopwatch::RunDurationMs() const { -#if DCHECK_IS_ON +#if DCHECK_IS_ON() DCHECK(state_ == STOPPED); #endif @@ -955,7 +955,7 @@ int32 TaskStopwatch::RunDurationMs() const { } ThreadData* TaskStopwatch::GetThreadData() const { -#if DCHECK_IS_ON +#if DCHECK_IS_ON() DCHECK(state_ != CREATED); #endif |