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

Unified Diff: base/trace_event/trace_log.h

Issue 1923533004: Tracing pre-filtering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/trace_event_unittest.cc ('k') | base/trace_event/trace_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_log.h
diff --git a/base/trace_event/trace_log.h b/base/trace_event/trace_log.h
index 468160dff07a05702e5a148b3acef08ea5ea2506..8cddf272b26926b57fe7db5e963b5cd5db7994ce 100644
--- a/base/trace_event/trace_log.h
+++ b/base/trace_event/trace_log.h
@@ -60,7 +60,9 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
// Category group enabled by SetEventCallbackEnabled().
ENABLED_FOR_EVENT_CALLBACK = 1 << 2,
// Category group enabled to export events to ETW.
- ENABLED_FOR_ETW_EXPORT = 1 << 3
+ ENABLED_FOR_ETW_EXPORT = 1 << 3,
+ // Category group being filtered before logged.
+ ENABLED_FOR_FILTERING = 1 << 4
};
static TraceLog* GetInstance();
@@ -286,6 +288,10 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
const char* name,
TraceEventHandle handle);
+ void EndFilteredEvent(const unsigned char* category_group_enabled,
+ const char* name,
+ TraceEventHandle handle);
+
// For every matching event, the callback will be called.
typedef base::Callback<void()> WatchEventCallback;
void SetWatchEvent(const std::string& category_name,
@@ -306,6 +312,21 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
// Allows deleting our singleton instance.
static void DeleteForTesting();
+ class TraceEventFilter {
+ public:
+ TraceEventFilter() {}
+ virtual ~TraceEventFilter() {}
+ virtual bool FilterTraceEvent(const TraceEvent& trace_event) const = 0;
+ virtual void EndEvent(const char* category_group, const char* name) {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TraceEventFilter);
+ };
+ typedef std::unique_ptr<TraceEventFilter> (
+ *TraceEventFilterConstructorForTesting)(void);
+ static void SetTraceEventFilterConstructorForTesting(
+ TraceEventFilterConstructorForTesting predicate);
+
// Allow tests to inspect TraceEvents.
TraceEvent* GetEventByHandle(TraceEventHandle handle);
« no previous file with comments | « base/trace_event/trace_event_unittest.cc ('k') | base/trace_event/trace_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698