#include "src/trace_processor/util/protozero_to_text.h"
#include <optional>
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/protozero/proto_decoder.h"
#include "perfetto/protozero/proto_utils.h"
#include "protos/perfetto/common/descriptor.pbzero.h"
#include "src/trace_processor/util/descriptors.h"
#include "src/trace_processor/importers/proto/track_event.descriptor.h"
namespace perfetto {
namespace trace_processor {
namespace protozero_to_text {
namespace {
ProtoWireType;
FieldDescriptorProto;
std::string QuoteAndEscapeTextProtoString(base::StringView raw) { … }
template <typename T>
void StrAppend(std::string* out, const T& to_add) { … }
template <typename T, typename... strings>
void StrAppend(std::string* out, const T& first, strings... values) { … }
void IncreaseIndents(std::string* out) { … }
void DecreaseIndents(std::string* out) { … }
void PrintUnknownVarIntField(uint32_t id, int64_t value, std::string* out) { … }
void PrintEnumField(const FieldDescriptor& fd,
const DescriptorPool& pool,
uint32_t id,
int32_t enum_value,
std::string* out) { … }
std::string FormattedFieldDescriptorName(
const FieldDescriptor& field_descriptor) { … }
void PrintVarIntField(const FieldDescriptor* fd,
const protozero::Field& field,
const DescriptorPool& pool,
std::string* out) { … }
void PrintFixed32Field(const FieldDescriptor* fd,
const protozero::Field& field,
std::string* out) { … }
void PrintFixed64Field(const FieldDescriptor* fd,
const protozero::Field& field,
std::string* out) { … }
void ProtozeroToTextInternal(const std::string& type,
protozero::ConstBytes protobytes,
NewLinesMode new_lines_mode,
const DescriptorPool& pool,
std::string* indents,
std::string* output);
template <protozero::proto_utils::ProtoWireType wire_type, typename T>
void PrintPackedField(const FieldDescriptor& fd,
const protozero::Field& field,
NewLinesMode new_lines_mode,
const std::string& indents,
const DescriptorPool& pool,
std::string* out) { … }
void PrintLengthDelimitedField(const FieldDescriptor* fd,
const protozero::Field& field,
NewLinesMode new_lines_mode,
std::string* indents,
const DescriptorPool& pool,
std::string* out) { … }
void ProtozeroToTextInternal(const std::string& type,
protozero::ConstBytes protobytes,
NewLinesMode new_lines_mode,
const DescriptorPool& pool,
std::string* indents,
std::string* output) { … }
}
std::string ProtozeroToText(const DescriptorPool& pool,
const std::string& type,
protozero::ConstBytes protobytes,
NewLinesMode new_lines_mode,
uint32_t initial_indent_depth) { … }
std::string DebugTrackEventProtozeroToText(const std::string& type,
protozero::ConstBytes protobytes) { … }
std::string ShortDebugTrackEventProtozeroToText(
const std::string& type,
protozero::ConstBytes protobytes) { … }
std::string ProtozeroEnumToText(const std::string& type, int32_t enum_value) { … }
std::string ProtozeroToText(const DescriptorPool& pool,
const std::string& type,
const std::vector<uint8_t>& protobytes,
NewLinesMode new_lines_mode) { … }
}
}
}