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..eaf2d678d401085496cfe3c38a3b14860e026dc4 |
--- /dev/null |
+++ b/base/trace_event/persistent_async_event.h |
@@ -0,0 +1,50 @@ |
+// 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/threading/thread_checker.h" |
+#include "base/time/time.h" |
+#include "base/trace_event/trace_event.h" |
Primiano Tucci (use gerrit)
2016/09/15 10:08:29
don't think you need to include trace_event here a
Primiano Tucci (use gerrit)
2016/09/15 10:08:29
IWYU (include what you use): add an include base/m
alexandermont
2016/09/15 21:05:13
Done. But you do still need to include trace_event
|
+ |
+namespace base { |
+namespace trace_event { |
+ |
+class BASE_EXPORT PersistentAsyncEvent |
Primiano Tucci (use gerrit)
2016/09/15 10:08:29
Add a comment explaining what this class does and
alexandermont
2016/09/15 21:05:13
Done
|
+ : public trace_event::TraceLog::AsyncEnabledStateObserver { |
Primiano Tucci (use gerrit)
2016/09/15 10:08:30
you don't need trace_event:: here as you are alrea
alexandermont
2016/09/15 21:05:13
Done
|
+ public: |
+ enum Type { |
+ ASYNC |
+ }; |
+ |
+ PersistentAsyncEvent(PersistentAsyncEvent::Type type, |
Primiano Tucci (use gerrit)
2016/09/15 10:08:29
you don't need PersistentAsyncEvent:: here I belie
Primiano Tucci (use gerrit)
2016/09/15 10:08:30
Can you add a comment saying
// As in the rest of
alexandermont
2016/09/15 21:05:13
Done
|
+ const char* category, const char* event_name); |
+ ~PersistentAsyncEvent() override; |
+ |
+ void Begin(); |
+ void End(); |
+ |
+ // EnabledStateObserver implementation |
Primiano Tucci (use gerrit)
2016/09/15 10:08:30
nit, +Async. This is now extending AsyncEnabledSta
alexandermont
2016/09/15 21:05:13
Done
|
+ void OnTraceLogEnabled() override; |
+ void OnTraceLogDisabled() override; |
+ |
+ // TODO(alexandermont): Add in auto-close in OnBeforeTraceLogDisabled once the |
+ // OnBeforeTraceLogDisabled CL lands. |
+ |
+ private: |
+ bool active_; |
+ const char* const category_; |
+ const char* const event_name_; |
+ base::TimeTicks start_time_; |
+ base::ThreadChecker thread_checker_; |
+ WeakPtrFactory<PersistentAsyncEvent> weak_factory_; |
+ DISALLOW_COPY_AND_ASSIGN(PersistentAsyncEvent); |
Primiano Tucci (use gerrit)
2016/09/15 10:08:30
nit: add a blankline between fields and DISALLOW..
alexandermont
2016/09/15 21:05:13
Done
|
+}; |
+ |
+} // namespace trace_event |
+} // namespace base |
+ |
+#endif // BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_ |