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

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

Issue 2316403002: Fix races in trace events filtering. (Closed)
Patch Set: Fixes. Created 4 years, 3 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 | base/trace_event/trace_log.h » ('j') | 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. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_H_
6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_ 6 #define BASE_TRACE_EVENT_TRACE_EVENT_H_
7 7
8 // This header file defines implementation details of how the trace macros in 8 // This header file defines implementation details of how the trace macros in
9 // trace_event_common.h collect and store trace events. Anything not 9 // trace_event_common.h collect and store trace events. Anything not
10 // implementation-specific should go in trace_event_common.h instead of here. 10 // implementation-specific should go in trace_event_common.h instead of here.
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 // Used by TRACE_EVENTx macros. Do not use directly. 1009 // Used by TRACE_EVENTx macros. Do not use directly.
1010 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer { 1010 class TRACE_EVENT_API_CLASS_EXPORT ScopedTracer {
1011 public: 1011 public:
1012 // Note: members of data_ intentionally left uninitialized. See Initialize. 1012 // Note: members of data_ intentionally left uninitialized. See Initialize.
1013 ScopedTracer() : p_data_(NULL) {} 1013 ScopedTracer() : p_data_(NULL) {}
1014 1014
1015 ~ScopedTracer() { 1015 ~ScopedTracer() {
1016 if (p_data_ && *data_.category_group_enabled) { 1016 if (p_data_ && *data_.category_group_enabled) {
1017 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( 1017 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
1018 data_.category_group_enabled, data_.name, data_.event_handle); 1018 data_.category_group_enabled, data_.name, data_.event_handle);
1019 if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_FILTERING_MODE(
1020 *data_.category_group_enabled)) {
1021 TRACE_EVENT_API_END_FILTERED_EVENT(data_.category_group_enabled,
1022 data_.name, data_.event_handle);
1023 }
1024 } 1019 }
1025 } 1020 }
1026 1021
1027 void Initialize(const unsigned char* category_group_enabled, 1022 void Initialize(const unsigned char* category_group_enabled,
1028 const char* name, 1023 const char* name,
1029 base::trace_event::TraceEventHandle event_handle) { 1024 base::trace_event::TraceEventHandle event_handle) {
1030 data_.category_group_enabled = category_group_enabled; 1025 data_.category_group_enabled = category_group_enabled;
1031 data_.name = name; 1026 data_.name = name;
1032 data_.event_handle = event_handle; 1027 data_.event_handle = event_handle;
1033 p_data_ = &data_; 1028 p_data_ = &data_;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 const char* name_; 1123 const char* name_;
1129 IDType id_; 1124 IDType id_;
1130 1125
1131 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); 1126 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject);
1132 }; 1127 };
1133 1128
1134 } // namespace trace_event 1129 } // namespace trace_event
1135 } // namespace base 1130 } // namespace base
1136 1131
1137 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_ 1132 #endif // BASE_TRACE_EVENT_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698