| 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 Start(); |
| 28 void Stop(); |
| 29 |
| 30 void OnTraceLogEnabled() override; |
| 31 void OnTraceLogDisabled() override; |
| 32 |
| 33 protected: |
| 34 virtual void RecordStartEvent() = 0; |
| 35 virtual void RecordStartEventWithTimestamp(int64_t timestamp) = 0; |
| 36 virtual void RecordStopEvent() = 0; |
| 37 |
| 38 void* id_; |
| 39 bool active_; |
| 40 int64_t start_time_; |
| 41 }; |
| 42 |
| 43 } // namespace trace_event |
| 44 } // namespace base |
| 45 |
| 46 #endif // BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_ |
| OLD | NEW |