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

Side by Side Diff: base/debug/trace_event_impl.h

Issue 14748003: Allow tracing categories to default to disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_impl.cc » ('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 5
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_
8 8
9 #include <stack> 9 #include <stack>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/gtest_prod_util.h"
14 #include "base/hash_tables.h" 15 #include "base/hash_tables.h"
15 #include "base/memory/ref_counted_memory.h" 16 #include "base/memory/ref_counted_memory.h"
16 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
17 #include "base/observer_list.h" 18 #include "base/observer_list.h"
18 #include "base/string_util.h" 19 #include "base/string_util.h"
19 #include "base/synchronization/condition_variable.h" 20 #include "base/synchronization/condition_variable.h"
20 #include "base/synchronization/lock.h" 21 #include "base/synchronization/lock.h"
21 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
22 #include "base/timer.h" 23 #include "base/timer.h"
23 24
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // categories are distinguished from included categories by the prefix '-'. 227 // categories are distinguished from included categories by the prefix '-'.
227 std::string ToString() const; 228 std::string ToString() const;
228 229
229 // Determines whether category group would be enabled or 230 // Determines whether category group would be enabled or
230 // disabled by this category filter. 231 // disabled by this category filter.
231 bool IsCategoryGroupEnabled(const char* category_group) const; 232 bool IsCategoryGroupEnabled(const char* category_group) const;
232 233
233 // Merges nested_filter with the current CategoryFilter 234 // Merges nested_filter with the current CategoryFilter
234 void Merge(const CategoryFilter& nested_filter); 235 void Merge(const CategoryFilter& nested_filter);
235 236
236 // Determines whether or not we have explicitly allowed category patterns.
237 bool HasIncludedPatterns() const;
238
239 // Clears both included/excluded pattern lists. This would be equivalent to 237 // Clears both included/excluded pattern lists. This would be equivalent to
240 // creating a CategoryFilter with an empty string, through the constructor. 238 // creating a CategoryFilter with an empty string, through the constructor.
241 // i.e: CategoryFilter(""). 239 // i.e: CategoryFilter("").
242 // 240 //
243 // When using an empty filter, all categories are considered included as we 241 // When using an empty filter, all categories are considered included as we
244 // are not excluding anything. 242 // are not excluding anything.
245 void Clear(); 243 void Clear();
246 244
245 private:
246 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, CategoryFilter);
247
247 static bool IsEmptyOrContainsLeadingOrTrailingWhitespace( 248 static bool IsEmptyOrContainsLeadingOrTrailingWhitespace(
248 const std::string& str); 249 const std::string& str);
249 250
250 private: 251 typedef std::vector<std::string> StringList;
252
251 void Initialize(const std::string& filter_string); 253 void Initialize(const std::string& filter_string);
252 void WriteString(std::string* out, bool included) const; 254 void WriteString(const StringList& values,
255 std::string* out,
256 bool included) const;
257 bool HasIncludedPatterns() const;
253 258
254 std::vector<std::string> included_; 259 bool DoesCategoryGroupContainCategory(const char* category_group,
255 std::vector<std::string> excluded_; 260 const char* category) const;
261
262 StringList included_;
263 StringList disabled_;
264 StringList excluded_;
256 }; 265 };
257 266
258 class TraceSamplingThread; 267 class TraceSamplingThread;
259 268
260 class BASE_EXPORT TraceLog { 269 class BASE_EXPORT TraceLog {
261 public: 270 public:
262 // Notification is a mask of one or more of the following events. 271 // Notification is a mask of one or more of the following events.
263 enum Notification { 272 enum Notification {
264 // The trace buffer does not flush dynamically, so when it fills up, 273 // The trace buffer does not flush dynamically, so when it fills up,
265 // subsequent trace events will be dropped. This callback is generated when 274 // subsequent trace events will be dropped. This callback is generated when
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 550
542 CategoryFilter category_filter_; 551 CategoryFilter category_filter_;
543 552
544 DISALLOW_COPY_AND_ASSIGN(TraceLog); 553 DISALLOW_COPY_AND_ASSIGN(TraceLog);
545 }; 554 };
546 555
547 } // namespace debug 556 } // namespace debug
548 } // namespace base 557 } // namespace base
549 558
550 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ 559 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_
OLDNEW
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698