Make it possible for tests to set up trace event handlers.
As it is now, the first time a TRACE_EVENT... is called, the result from the current handler is stored in a static const variable, and subsequent calls will use that value regardless of changes to the handler. This is a problem if a test wants to use another handler. BUG=None Review-Url: https://codereview.webrtc.org/3002663002 Cr-Commit-Position: refs/heads/master@{#19382}
This commit is contained in:
parent
6ff045f097
commit
a973265622
@ -26,6 +26,17 @@ config("common_inherited_config") {
|
||||
if (build_with_mozilla) {
|
||||
defines += [ "WEBRTC_MOZILLA_BUILD" ]
|
||||
}
|
||||
# Some tests need to declare their own trace event handlers. If this define is
|
||||
# not set, the first time TRACE_EVENT_* is called it will store the return
|
||||
# value for the current handler in an static variable, so that subsequent
|
||||
# changes to the handler for that TRACE_EVENT_* will be ignored.
|
||||
# So when tests are included, we set this define, making it possible to use
|
||||
# different event handlers in different tests.
|
||||
if (rtc_include_tests) {
|
||||
defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ]
|
||||
} else {
|
||||
defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ]
|
||||
}
|
||||
if (build_with_chromium) {
|
||||
defines = [
|
||||
# TODO(kjellander): Cleanup unused ones and move defines closer to
|
||||
|
||||
@ -575,9 +575,15 @@
|
||||
#define INTERNAL_TRACE_EVENT_UID(name_prefix) \
|
||||
INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__)
|
||||
|
||||
#if WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS
|
||||
#define INTERNAL_TRACE_EVENT_INFO_TYPE const unsigned char*
|
||||
#else
|
||||
#define INTERNAL_TRACE_EVENT_INFO_TYPE static const unsigned char*
|
||||
#endif // WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS
|
||||
|
||||
// Implementation detail: internal macro to create static category.
|
||||
#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category) \
|
||||
static const unsigned char* INTERNAL_TRACE_EVENT_UID(catstatic) = \
|
||||
INTERNAL_TRACE_EVENT_INFO_TYPE INTERNAL_TRACE_EVENT_UID(catstatic) = \
|
||||
TRACE_EVENT_API_GET_CATEGORY_ENABLED(category);
|
||||
|
||||
// Implementation detail: internal macro to create static category and add
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user