1 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_EVENT_FILTER_H_ 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_EVENT_FILTER_H_ 7 8 #include "base/base_export.h" 9 #include "base/macros.h" 10 #include "base/trace_event/trace_event_filter.h" 11 12 namespace base { 13 namespace trace_event { 14 15 class TraceEvent; 16 17 // This filter unconditionally accepts all events and pushes/pops them from the 18 // thread-local AllocationContextTracker instance as they are seen. 19 // This is used to cheaply construct the heap profiler pseudo stack without 20 // having to actually record all events. 21 class BASE_EXPORT HeapProfilerEventFilter : public TraceEventFilter { 22 public: 23 static const char kName[]; 24 25 HeapProfilerEventFilter(); 26 ~HeapProfilerEventFilter() override; 27 28 // TraceEventFilter implementation. 29 bool FilterTraceEvent(const TraceEvent& trace_event) const override; 30 void EndEvent(const char* category_name, 31 const char* event_name) const override; 32 33 private: 34 DISALLOW_COPY_AND_ASSIGN(HeapProfilerEventFilter); 35 }; 36 37 } // namespace trace_event 38 } // namespace base 39 40 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_EVENT_FILTER_H_ 41