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

Side by Side Diff: base/trace_event/event_name_filter.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 unified diff | Download patch
« no previous file with comments | « base/trace_event/category_registry.h ('k') | base/trace_event/event_name_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_EVENT_NAME_FILTER_H_
6 #define BASE_TRACE_EVENT_EVENT_NAME_FILTER_H_
7
8 #include <memory>
9 #include <string>
10 #include <unordered_set>
11
12 #include "base/base_export.h"
13 #include "base/macros.h"
14 #include "base/trace_event/trace_event_filter.h"
15
16 namespace base {
17 namespace trace_event {
18
19 class TraceEvent;
20
21 // Filters trace events by checking the full name against a whitelist.
22 // The current implementation is quite simple and dumb and just uses a
23 // hashtable which requires char* to std::string conversion. It could be smarter
24 // and use a bloom filter trie. However, today this is used too rarely to
25 // justify that cost.
26 class BASE_EXPORT EventNameFilter : public TraceEventFilter {
27 public:
28 using EventNamesWhitelist = std::unordered_set<std::string>;
29 static const char kName[];
30
31 EventNameFilter(std::unique_ptr<EventNamesWhitelist>);
32 ~EventNameFilter() override;
33
34 // TraceEventFilter implementation.
35 bool FilterTraceEvent(const TraceEvent&) const override;
36
37 private:
38 std::unique_ptr<const EventNamesWhitelist> event_names_whitelist_;
39
40 DISALLOW_COPY_AND_ASSIGN(EventNameFilter);
41 };
42
43 } // namespace trace_event
44 } // namespace base
45
46 #endif // BASE_TRACE_EVENT_EVENT_NAME_FILTER_H_
OLDNEW
« no previous file with comments | « base/trace_event/category_registry.h ('k') | base/trace_event/event_name_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698