Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: webrtc/base/trace_event.h

Issue 2716343002: Fix race in INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file under third_party_mods/chromium or at: 3 // found in the LICENSE file under third_party_mods/chromium or at:
4 // http://src.chromium.org/svn/trunk/src/LICENSE 4 // http://src.chromium.org/svn/trunk/src/LICENSE
5 5
6 #ifndef WEBRTC_BASE_TRACE_EVENT_H_ 6 #ifndef WEBRTC_BASE_TRACE_EVENT_H_
7 #define WEBRTC_BASE_TRACE_EVENT_H_ 7 #define WEBRTC_BASE_TRACE_EVENT_H_
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 // variable a unique name based on the line number to prevent name collissions. 570 // variable a unique name based on the line number to prevent name collissions.
571 #define INTERNAL_TRACE_EVENT_UID3(a,b) \ 571 #define INTERNAL_TRACE_EVENT_UID3(a,b) \
572 trace_event_unique_##a##b 572 trace_event_unique_##a##b
573 #define INTERNAL_TRACE_EVENT_UID2(a,b) \ 573 #define INTERNAL_TRACE_EVENT_UID2(a,b) \
574 INTERNAL_TRACE_EVENT_UID3(a,b) 574 INTERNAL_TRACE_EVENT_UID3(a,b)
575 #define INTERNAL_TRACE_EVENT_UID(name_prefix) \ 575 #define INTERNAL_TRACE_EVENT_UID(name_prefix) \
576 INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__) 576 INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__)
577 577
578 // Implementation detail: internal macro to create static category. 578 // Implementation detail: internal macro to create static category.
579 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category) \ 579 #define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category) \
580 static const unsigned char* INTERNAL_TRACE_EVENT_UID(catstatic) = 0; \ 580 static const unsigned char* INTERNAL_TRACE_EVENT_UID(catstatic) = \
581 if (!INTERNAL_TRACE_EVENT_UID(catstatic)) { \ 581 TRACE_EVENT_API_GET_CATEGORY_ENABLED(category);
582 INTERNAL_TRACE_EVENT_UID(catstatic) = \
583 TRACE_EVENT_API_GET_CATEGORY_ENABLED(category); \
584 }
585 582
586 // Implementation detail: internal macro to create static category and add 583 // Implementation detail: internal macro to create static category and add
587 // event if the category is enabled. 584 // event if the category is enabled.
588 #define INTERNAL_TRACE_EVENT_ADD(phase, category, name, flags, ...) \ 585 #define INTERNAL_TRACE_EVENT_ADD(phase, category, name, flags, ...) \
589 do { \ 586 do { \
590 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \ 587 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category); \
591 if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \ 588 if (*INTERNAL_TRACE_EVENT_UID(catstatic)) { \
592 webrtc::trace_event_internal::AddTraceEvent( \ 589 webrtc::trace_event_internal::AddTraceEvent( \
593 phase, INTERNAL_TRACE_EVENT_UID(catstatic), name, \ 590 phase, INTERNAL_TRACE_EVENT_UID(catstatic), name, \
594 webrtc::trace_event_internal::kNoEventId, flags, ##__VA_ARGS__); \ 591 webrtc::trace_event_internal::kNoEventId, flags, ##__VA_ARGS__); \
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 const char* name; 904 const char* name;
908 }; 905 };
909 Data* p_data_; 906 Data* p_data_;
910 Data data_; 907 Data data_;
911 }; 908 };
912 909
913 } // namespace trace_event_internal 910 } // namespace trace_event_internal
914 } // namespace webrtc 911 } // namespace webrtc
915 912
916 #endif // WEBRTC_BASE_TRACE_EVENT_H_ 913 #endif // WEBRTC_BASE_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698