| 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_;
|
| + bool active_;
|
| + int64_t start_time_;
|
| +};
|
| +
|
| +} // namespace trace_event
|
| +} // namespace base
|
| +
|
| +#endif // BASE_TRACE_EVENT_PERSISTENT_ASYNC_H_
|
|
|