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

Unified Diff: base/trace_event/trace_log.h

Issue 2549103003: tracing: split trace event filter classes out of TraceLog (Closed)
Patch Set: Add BASE_EXPORT Created 4 years 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 68a7fbbcb1751a54ee590f2e031b4db60b44b672..88b6e588e406e70c064ebaea09918033354e15fc 100644
--- a/base/trace_event/trace_log.h
+++ b/base/trace_event/trace_log.h
@@ -35,6 +35,7 @@ struct TraceCategory;
class TraceBuffer;
class TraceBufferChunk;
class TraceEvent;
+class TraceEventFilter;
class TraceEventMemoryOverhead;
struct BASE_EXPORT TraceLogStatus {
@@ -278,27 +279,16 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
// Exposed for unittesting:
+ // Testing factory for TraceEventFilter.
+ typedef std::unique_ptr<TraceEventFilter> (*FilterFactoryForTesting)(
+ const std::string& /* predicate_name */);
+ void SetFilterFactoryForTesting(FilterFactoryForTesting factory) {
+ filter_factory_for_testing_ = factory;
+ }
+
// Allows deleting our singleton instance.
static void DeleteForTesting();
- class BASE_EXPORT TraceEventFilter {
- public:
- static const char* const kEventWhitelistPredicate;
- static const char* const kHeapProfilerPredicate;
-
- 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);
@@ -506,6 +496,8 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider {
subtle::AtomicWord generation_;
bool use_worker_thread_;
+ FilterFactoryForTesting filter_factory_for_testing_;
+
DISALLOW_COPY_AND_ASSIGN(TraceLog);
};
« 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