#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "services/tracing/public/cpp/perfetto/traced_value_proto_writer.h"
#include <memory>
#include <stack>
#include <string_view>
#include "base/hash/hash.h"
#include "base/json/string_escape.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "third_party/perfetto/include/perfetto/protozero/message_handle.h"
#include "third_party/perfetto/include/perfetto/protozero/root_message.h"
#include "third_party/perfetto/include/perfetto/protozero/scattered_heap_buffer.h"
#include "third_party/perfetto/include/perfetto/protozero/scattered_stream_writer.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/debug_annotation.pbzero.h"
DebugAnnotation;
TracedValue;
TraceEvent;
namespace tracing {
PerfettoProtoAppender::PerfettoProtoAppender(DebugAnnotation* proto)
: … { … }
PerfettoProtoAppender::~PerfettoProtoAppender() = default;
void PerfettoProtoAppender::AddBuffer(uint8_t* begin, uint8_t* end) { … }
size_t PerfettoProtoAppender::Finalize(uint32_t field_id) { … }
namespace {
constexpr size_t kDefaultSliceSize = …;
class ProtoWriter final : public TracedValue::Writer { … };
std::unique_ptr<TracedValue::Writer> CreateNestedValueProtoWriter(
size_t initial_slice_size_bytes) { … }
}
void RegisterTracedValueProtoWriter() { … }
}