diff options
author | jbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-30 01:33:09 +0000 |
---|---|---|
committer | jbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-30 01:33:09 +0000 |
commit | c7763b2a47fa8c05ff315a22c2b3307c8eb575fc (patch) | |
tree | a018a42318f6724905149ffbcb042e4f94a09ac2 /base/debug | |
parent | dde9a7c10c7a47969109aaac351f4684d62f4371 (diff) | |
download | chromium_src-c7763b2a47fa8c05ff315a22c2b3307c8eb575fc.zip chromium_src-c7763b2a47fa8c05ff315a22c2b3307c8eb575fc.tar.gz chromium_src-c7763b2a47fa8c05ff315a22c2b3307c8eb575fc.tar.bz2 |
Make non-scoped trace macros work in one-line scopes.
BUG=120727
Review URL: http://codereview.chromium.org/9844035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129753 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug')
-rw-r--r-- | base/debug/trace_event.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h index 00e0208..d6ccae7 100644 --- a/base/debug/trace_event.h +++ b/base/debug/trace_event.h @@ -532,12 +532,14 @@ // Implementation detail: internal macro to create static category and add // event if the category is enabled. #define INTERNAL_TRACE_EVENT_ADD(phase, category, name, flags, ...) \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ - if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ - trace_event_internal::AddTraceEvent( \ - phase, INTERNAL_TRACE_EVENT_UID(catstatic), name, \ - trace_event_internal::kNoEventId, flags, ##__VA_ARGS__); \ - } + do { \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ + if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ + trace_event_internal::AddTraceEvent( \ + phase, INTERNAL_TRACE_EVENT_UID(catstatic), name, \ + trace_event_internal::kNoEventId, flags, ##__VA_ARGS__); \ + } \ + } while (0) // Implementation detail: internal macro to create static category and add begin // event if the category is enabled. Also adds the end event when the scope @@ -580,16 +582,18 @@ // event if the category is enabled. #define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category, name, id, flags, \ ...) \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ - if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ - unsigned char trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ - trace_event_internal::TraceID trace_event_trace_id( \ - id, &trace_event_flags); \ - trace_event_internal::AddTraceEvent( \ - phase, INTERNAL_TRACE_EVENT_UID(catstatic), \ - name, trace_event_trace_id.data(), trace_event_flags, \ - ##__VA_ARGS__); \ - } + do { \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ + if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ + unsigned char trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \ + trace_event_internal::TraceID trace_event_trace_id( \ + id, &trace_event_flags); \ + trace_event_internal::AddTraceEvent( \ + phase, INTERNAL_TRACE_EVENT_UID(catstatic), \ + name, trace_event_trace_id.data(), trace_event_flags, \ + ##__VA_ARGS__); \ + } \ + } while (0) // Notes regarding the following definitions: // New values can be added and propagated to third party libraries, but existing |