Chromium Code Reviews| 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(); |
| + 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_; |
|
benjhayden
2016/08/30 04:17:23
Fields should be private, with public/protected ac
alexandermont
2016/08/30 19:01:22
I'm not exactly sure what this means. Let's talk a
benjhayden
2016/08/31 03:12:53
https://google.github.io/styleguide/cppguide.html#
|
| + bool active_; |
| + int64_t start_time_; |
| +}; |
| + |
| +} // namespace trace_event |
| +} // namespace base |
| + |
| +#endif // BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_ |