#ifndef INCLUDE_PERFETTO_TRACING_INTERNAL_WRITE_TRACK_EVENT_ARGS_H_
#define INCLUDE_PERFETTO_TRACING_INTERNAL_WRITE_TRACK_EVENT_ARGS_H_
#include "perfetto/base/compiler.h"
#include "perfetto/tracing/event_context.h"
#include "perfetto/tracing/traced_proto.h"
#include "perfetto/tracing/track_event_args.h"
namespace perfetto {
namespace internal {
PERFETTO_ALWAYS_INLINE inline void WriteTrackEventArgs(EventContext) { … }
namespace {
template <typename T>
static constexpr bool IsValidTraceLambdaImpl(
typename std::enable_if<static_cast<bool>(
sizeof(std::declval<T>()(std::declval<EventContext>()), 0))>::type* =
nullptr) { … }
template <typename T>
static constexpr bool IsValidTraceLambdaImpl(...) { … }
template <typename T>
static constexpr bool IsValidTraceLambda() { … }
template <typename T>
static constexpr bool IsValidTraceLambdaTakingReferenceImpl(
typename std::enable_if<static_cast<bool>(
sizeof(std::declval<T>()(std::declval<EventContext&>()), 0))>::type* =
nullptr) { … }
template <typename T>
static constexpr bool IsValidTraceLambdaTakingReferenceImpl(...) { … }
template <typename T>
static constexpr bool IsValidTraceLambdaTakingReference() { … }
template <typename T>
static constexpr bool IsFieldMetadataTypeImpl(
typename std::enable_if<
std::is_base_of<protozero::proto_utils::FieldMetadataBase,
T>::value>::type* = nullptr) { … }
template <typename T>
static constexpr bool IsFieldMetadataTypeImpl(...) { … }
template <typename T>
static constexpr bool IsFieldMetadataType() { … }
}
template <typename ArgumentFunction,
typename ArgFunctionCheck = typename std::enable_if<
IsValidTraceLambda<ArgumentFunction>()>::type>
PERFETTO_ALWAYS_INLINE void WriteTrackEventArgs(
EventContext event_ctx,
const ArgumentFunction& arg_function) { … }
template <typename ArgValue, typename... Args>
PERFETTO_ALWAYS_INLINE void WriteTrackEventArgs(EventContext event_ctx,
const char* arg_name,
ArgValue&& arg_value,
Args&&... args);
template <typename FieldMetadataType,
typename ArgValue,
typename... Args,
typename FieldMetadataTypeCheck = typename std::enable_if<
IsFieldMetadataType<FieldMetadataType>()>::type>
PERFETTO_ALWAYS_INLINE void WriteTrackEventArgs(EventContext event_ctx,
FieldMetadataType field_name,
ArgValue&& arg_value,
Args&&... args);
template <typename ArgumentFunction,
typename... Args,
typename ArgFunctionCheck = typename std::enable_if<
IsValidTraceLambdaTakingReference<ArgumentFunction>()>::type>
PERFETTO_ALWAYS_INLINE void WriteTrackEventArgs(
EventContext event_ctx,
const ArgumentFunction& arg_function,
Args&&... args) { … }
template <typename FieldMetadataType,
typename ArgValue,
typename... Args,
typename FieldMetadataTypeCheck>
PERFETTO_ALWAYS_INLINE void WriteTrackEventArgs(EventContext event_ctx,
FieldMetadataType field_name,
ArgValue&& arg_value,
Args&&... args) { … }
template <typename ArgValue, typename... Args>
PERFETTO_ALWAYS_INLINE void WriteTrackEventArgs(EventContext event_ctx,
const char* arg_name,
ArgValue&& arg_value,
Args&&... args) { … }
template <typename ArgValue, typename... Args>
PERFETTO_ALWAYS_INLINE void WriteTrackEventArgs(EventContext event_ctx,
DynamicString arg_name,
ArgValue&& arg_value,
Args&&... args) { … }
}
}
#endif