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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef BASE_TRACE_EVENT_TRACE_LOG_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_LOG_H_
6 #define BASE_TRACE_EVENT_TRACE_LOG_H_ 6 #define BASE_TRACE_EVENT_TRACE_LOG_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 17 matching lines...) Expand all
28 struct DefaultSingletonTraits; 28 struct DefaultSingletonTraits;
29 class MessageLoop; 29 class MessageLoop;
30 class RefCountedString; 30 class RefCountedString;
31 31
32 namespace trace_event { 32 namespace trace_event {
33 33
34 struct TraceCategory; 34 struct TraceCategory;
35 class TraceBuffer; 35 class TraceBuffer;
36 class TraceBufferChunk; 36 class TraceBufferChunk;
37 class TraceEvent; 37 class TraceEvent;
38 class TraceEventFilter;
38 class TraceEventMemoryOverhead; 39 class TraceEventMemoryOverhead;
39 40
40 struct BASE_EXPORT TraceLogStatus { 41 struct BASE_EXPORT TraceLogStatus {
41 TraceLogStatus(); 42 TraceLogStatus();
42 ~TraceLogStatus(); 43 ~TraceLogStatus();
43 uint32_t event_capacity; 44 uint32_t event_capacity;
44 uint32_t event_count; 45 uint32_t event_count;
45 }; 46 };
46 47
47 class BASE_EXPORT TraceLog : public MemoryDumpProvider { 48 class BASE_EXPORT TraceLog : public MemoryDumpProvider {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void EndFilteredEvent(const unsigned char* category_group_enabled, 272 void EndFilteredEvent(const unsigned char* category_group_enabled,
272 const char* name, 273 const char* name,
273 TraceEventHandle handle); 274 TraceEventHandle handle);
274 275
275 int process_id() const { return process_id_; } 276 int process_id() const { return process_id_; }
276 277
277 uint64_t MangleEventId(uint64_t id); 278 uint64_t MangleEventId(uint64_t id);
278 279
279 // Exposed for unittesting: 280 // Exposed for unittesting:
280 281
282 // Testing factory for TraceEventFilter.
283 typedef std::unique_ptr<TraceEventFilter> (*FilterFactoryForTesting)(
284 const std::string& /* predicate_name */);
285 void SetFilterFactoryForTesting(FilterFactoryForTesting factory) {
286 filter_factory_for_testing_ = factory;
287 }
288
281 // Allows deleting our singleton instance. 289 // Allows deleting our singleton instance.
282 static void DeleteForTesting(); 290 static void DeleteForTesting();
283 291
284 class BASE_EXPORT TraceEventFilter {
285 public:
286 static const char* const kEventWhitelistPredicate;
287 static const char* const kHeapProfilerPredicate;
288
289 TraceEventFilter() {}
290 virtual ~TraceEventFilter() {}
291 virtual bool FilterTraceEvent(const TraceEvent& trace_event) const = 0;
292 virtual void EndEvent(const char* category_group, const char* name) {}
293
294 private:
295 DISALLOW_COPY_AND_ASSIGN(TraceEventFilter);
296 };
297 typedef std::unique_ptr<TraceEventFilter> (
298 *TraceEventFilterConstructorForTesting)(void);
299 static void SetTraceEventFilterConstructorForTesting(
300 TraceEventFilterConstructorForTesting predicate);
301
302 // Allow tests to inspect TraceEvents. 292 // Allow tests to inspect TraceEvents.
303 TraceEvent* GetEventByHandle(TraceEventHandle handle); 293 TraceEvent* GetEventByHandle(TraceEventHandle handle);
304 294
305 void SetProcessID(int process_id); 295 void SetProcessID(int process_id);
306 296
307 // Process sort indices, if set, override the order of a process will appear 297 // Process sort indices, if set, override the order of a process will appear
308 // relative to other processes in the trace viewer. Processes are sorted first 298 // relative to other processes in the trace viewer. Processes are sorted first
309 // on their sort index, ascending, then by their name, and then tid. 299 // on their sort index, ascending, then by their name, and then tid.
310 void SetProcessSortIndex(int sort_index); 300 void SetProcessSortIndex(int sort_index);
311 301
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 std::unique_ptr<TraceBufferChunk> thread_shared_chunk_; 489 std::unique_ptr<TraceBufferChunk> thread_shared_chunk_;
500 size_t thread_shared_chunk_index_; 490 size_t thread_shared_chunk_index_;
501 491
502 // Set when asynchronous Flush is in progress. 492 // Set when asynchronous Flush is in progress.
503 OutputCallback flush_output_callback_; 493 OutputCallback flush_output_callback_;
504 scoped_refptr<SingleThreadTaskRunner> flush_task_runner_; 494 scoped_refptr<SingleThreadTaskRunner> flush_task_runner_;
505 ArgumentFilterPredicate argument_filter_predicate_; 495 ArgumentFilterPredicate argument_filter_predicate_;
506 subtle::AtomicWord generation_; 496 subtle::AtomicWord generation_;
507 bool use_worker_thread_; 497 bool use_worker_thread_;
508 498
499 FilterFactoryForTesting filter_factory_for_testing_;
500
509 DISALLOW_COPY_AND_ASSIGN(TraceLog); 501 DISALLOW_COPY_AND_ASSIGN(TraceLog);
510 }; 502 };
511 503
512 } // namespace trace_event 504 } // namespace trace_event
513 } // namespace base 505 } // namespace base
514 506
515 #endif // BASE_TRACE_EVENT_TRACE_LOG_H_ 507 #endif // BASE_TRACE_EVENT_TRACE_LOG_H_
OLDNEW
« 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