OLD | NEW |
---|---|
(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_PERSISTENT_ASYNC_H_ | |
6 #define BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/time/time.h" | |
10 #include "base/trace_event/trace_event.h" | |
11 | |
12 namespace base { | |
13 | |
14 namespace trace_event { | |
15 | |
16 // Note: The categories and event names must have application lifetime | |
17 // (i.e. literals), as documented in trace_event_common.h. | |
18 // Thus, we must make subclasses that have hard-coded categories | |
19 // and event names, rather than passing these into the PersistentAsyncEvent. | |
20 | |
21 class BASE_EXPORT PersistentAsyncEvent | |
22 : public trace_event::TraceLog::EnabledStateObserver { | |
23 public: | |
24 PersistentAsyncEvent(); | |
25 ~PersistentAsyncEvent() override; | |
26 | |
27 void Begin(); | |
28 void End(); | |
29 | |
30 void OnTraceLogEnabled() override; | |
31 void OnTraceLogDisabled() override; | |
32 | |
33 protected: | |
34 virtual void RecordBeginEvent() = 0; | |
35 virtual void RecordBeginEventWithTimestamp(base::TimeTicks timestamp) = 0; | |
36 virtual void RecordEndEvent() = 0; | |
37 void* id() { return id_; } | |
38 | |
39 private: | |
40 void* id_; | |
41 bool active_; | |
fmeawad
2016/09/02 19:43:25
Should this be atomic, can OnTraceLogEnabled be ca
benjhayden
2016/09/09 21:54:00
If a PersistentAsyncEvent subclass is not on the s
| |
42 base::TimeTicks start_time_; | |
43 }; | |
44 | |
45 } // namespace trace_event | |
46 } // namespace base | |
47 | |
48 #endif // BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_ | |
OLD | NEW |