Index: base/trace_event/persistent_async_event.h |
diff --git a/base/trace_event/persistent_async_event.h b/base/trace_event/persistent_async_event.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..70f9271e3c7484b75d2d82ad46687b6b0b9ac84e |
--- /dev/null |
+++ b/base/trace_event/persistent_async_event.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_ |
+#define BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_ |
+ |
+#include "base/macros.h" |
+#include "base/time/time.h" |
+#include "base/trace_event/trace_event.h" |
+ |
+namespace base { |
+ |
+namespace trace_event { |
+ |
+// Note: The categories and event names must have application lifetime |
+// (i.e. literals), as documented in trace_event_common.h. |
+// Thus, we must make subclasses that have hard-coded categories |
+// and event names, rather than passing these into the PersistentAsyncEvent. |
+ |
+class BASE_EXPORT PersistentAsyncEvent |
+ : public trace_event::TraceLog::EnabledStateObserver { |
+ public: |
+ PersistentAsyncEvent(); |
+ ~PersistentAsyncEvent() override; |
+ |
+ void Start(); |
benjhayden
2016/08/31 03:12:53
Can you change Start to Begin and Stop to End to b
charliea (OOO until 10-5)
2016/08/31 17:30:38
+1
alexandermont
2016/08/31 18:31:59
Done
|
+ void Stop(); |
+ |
+ void OnTraceLogEnabled() override; |
+ void OnTraceLogDisabled() override; |
+ |
+ protected: |
+ virtual void RecordStartEvent() = 0; |
+ virtual void RecordStartEventWithTimestamp(int64_t timestamp) = 0; |
+ virtual void RecordStopEvent() = 0; |
+ |
+ void* id_; |
+ bool active_; |
+ int64_t start_time_; |
charliea (OOO until 10-5)
2016/08/31 17:30:38
As you mentioned, I think this should be stored as
alexandermont
2016/08/31 18:31:59
Done
|
+}; |
+ |
+} // namespace trace_event |
+} // namespace base |
+ |
+#endif // BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_ |