Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
process_descriptor.pbzero.h
Go to the documentation of this file.
1// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5// IMPORTANT: This file should only ever be modified by modifying the
6// corresponding .proto file and then running
7// `dart runtime/vm/protos/tools/compile_perfetto_protos.dart` from the SDK root
8// directory.
9// Autogenerated by the ProtoZero compiler plugin. DO NOT EDIT.
10
11#ifndef PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACK_EVENT_PROCESS_DESCRIPTOR_PROTO_H_
12#define PERFETTO_PROTOS_PROTOS_PERFETTO_TRACE_TRACK_EVENT_PROCESS_DESCRIPTOR_PROTO_H_
13
14#include <stddef.h>
15#include <stdint.h>
16
17#include "perfetto/protozero/field_writer.h"
18#include "perfetto/protozero/message.h"
19#include "perfetto/protozero/packed_repeated_fields.h"
20#include "perfetto/protozero/proto_decoder.h"
21#include "perfetto/protozero/proto_utils.h"
22
23namespace perfetto {
24namespace protos {
25namespace pbzero {
26
27class ProcessDescriptor_Decoder : public ::protozero::TypedProtoDecoder<
28 /*MAX_FIELD_ID=*/6,
29 /*HAS_NONPACKED_REPEATED_FIELDS=*/false> {
30 public:
31 ProcessDescriptor_Decoder(const uint8_t* data, size_t len)
32 : TypedProtoDecoder(data, len) {}
33 explicit ProcessDescriptor_Decoder(const std::string& raw)
34 : TypedProtoDecoder(reinterpret_cast<const uint8_t*>(raw.data()),
35 raw.size()) {}
36 explicit ProcessDescriptor_Decoder(const ::protozero::ConstBytes& raw)
37 : TypedProtoDecoder(raw.data, raw.size) {}
38 bool has_pid() const { return at<1>().valid(); }
39 int32_t pid() const { return at<1>().as_int32(); }
40 bool has_process_name() const { return at<6>().valid(); }
41 ::protozero::ConstChars process_name() const { return at<6>().as_string(); }
42};
43
44class ProcessDescriptor : public ::protozero::Message {
45 public:
47 enum : int32_t {
50 };
51 static constexpr const char* GetName() {
52 return ".perfetto.protos.ProcessDescriptor";
53 }
54
55 using FieldMetadata_Pid = ::protozero::proto_utils::FieldMetadata<
56 1,
57 ::protozero::proto_utils::RepetitionType::kNotRepeated,
58 ::protozero::proto_utils::ProtoSchemaType::kInt32,
59 int32_t,
61
62 // Ceci n'est pas une pipe.
63 // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
64 // type (and users are expected to use it as such, hence kCamelCase name).
65 // It is declared as a function to keep protozero bindings header-only as
66 // inline constexpr variables are not available until C++17 (while inline
67 // functions are).
68 // TODO(altimin): Use inline variable instead after adopting C++17.
69 static constexpr FieldMetadata_Pid kPid() { return {}; }
70 void set_pid(int32_t value) {
71 static constexpr uint32_t field_id = FieldMetadata_Pid::kFieldId;
72 // Call the appropriate protozero::Message::Append(field_id, ...)
73 // method based on the type of the field.
74 ::protozero::internal::FieldWriter<
75 ::protozero::proto_utils::ProtoSchemaType::kInt32>::Append(*this,
76 field_id,
77 value);
78 }
79
80 using FieldMetadata_ProcessName = ::protozero::proto_utils::FieldMetadata<
81 6,
82 ::protozero::proto_utils::RepetitionType::kNotRepeated,
83 ::protozero::proto_utils::ProtoSchemaType::kString,
84 std::string,
86
87 // Ceci n'est pas une pipe.
88 // This is actually a variable of FieldMetadataHelper<FieldMetadata<...>>
89 // type (and users are expected to use it as such, hence kCamelCase name).
90 // It is declared as a function to keep protozero bindings header-only as
91 // inline constexpr variables are not available until C++17 (while inline
92 // functions are).
93 // TODO(altimin): Use inline variable instead after adopting C++17.
94 static constexpr FieldMetadata_ProcessName kProcessName() { return {}; }
95 void set_process_name(const char* data, size_t size) {
96 AppendBytes(FieldMetadata_ProcessName::kFieldId, data, size);
97 }
98 void set_process_name(::protozero::ConstChars chars) {
99 AppendBytes(FieldMetadata_ProcessName::kFieldId, chars.data, chars.size);
100 }
101 void set_process_name(std::string value) {
102 static constexpr uint32_t field_id = FieldMetadata_ProcessName::kFieldId;
103 // Call the appropriate protozero::Message::Append(field_id, ...)
104 // method based on the type of the field.
105 ::protozero::internal::FieldWriter<
106 ::protozero::proto_utils::ProtoSchemaType::kString>::Append(*this,
107 field_id,
108 value);
109 }
110};
111
112} // namespace pbzero
113} // namespace protos
114} // namespace perfetto
115#endif // Include guard.
ProcessDescriptor_Decoder(const ::protozero::ConstBytes &raw)
::protozero::proto_utils::FieldMetadata< 6, ::protozero::proto_utils::RepetitionType::kNotRepeated, ::protozero::proto_utils::ProtoSchemaType::kString, std::string, ProcessDescriptor > FieldMetadata_ProcessName
void set_process_name(const char *data, size_t size)
static constexpr FieldMetadata_ProcessName kProcessName()
void set_process_name(::protozero::ConstChars chars)
::protozero::proto_utils::FieldMetadata< 1, ::protozero::proto_utils::RepetitionType::kNotRepeated, ::protozero::proto_utils::ProtoSchemaType::kInt32, int32_t, ProcessDescriptor > FieldMetadata_Pid
uint8_t value