1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: protos/perfetto/trace/profiling/heap_graph.proto
3 
4 #include "protos/perfetto/trace/profiling/heap_graph.pb.h"
5 
6 #include <algorithm>
7 #include <cstdint>
8 
9 #include <google/protobuf/io/coded_stream.h>
10 #include <google/protobuf/extension_set.h>
11 #include <google/protobuf/wire_format_lite.h>
12 #include <google/protobuf/io/zero_copy_stream_impl_lite.h>
13 // @@protoc_insertion_point(includes)
14 #include <google/protobuf/port_def.inc>
15 
16 PROTOBUF_PRAGMA_INIT_SEG
17 
18 namespace _pb = ::PROTOBUF_NAMESPACE_ID;
19 namespace _pbi = _pb::internal;
20 
21 namespace perfetto {
22 namespace protos {
HeapGraphRoot(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR HeapGraphRoot::HeapGraphRoot(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.object_ids_)*/{}
28   , /*decltype(_impl_._object_ids_cached_byte_size_)*/{0}
29   , /*decltype(_impl_.root_type_)*/0} {}
30 struct HeapGraphRootDefaultTypeInternal {
HeapGraphRootDefaultTypeInternalperfetto::protos::HeapGraphRootDefaultTypeInternal31   PROTOBUF_CONSTEXPR HeapGraphRootDefaultTypeInternal()
32       : _instance(::_pbi::ConstantInitialized{}) {}
~HeapGraphRootDefaultTypeInternalperfetto::protos::HeapGraphRootDefaultTypeInternal33   ~HeapGraphRootDefaultTypeInternal() {}
34   union {  // NOLINT(misc-non-private-member-variables-in-classes)
35     HeapGraphRoot _instance;
36   };
37 };
38 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HeapGraphRootDefaultTypeInternal _HeapGraphRoot_default_instance_;
HeapGraphType(::_pbi::ConstantInitialized)39 PROTOBUF_CONSTEXPR HeapGraphType::HeapGraphType(
40     ::_pbi::ConstantInitialized): _impl_{
41     /*decltype(_impl_._has_bits_)*/{}
42   , /*decltype(_impl_._cached_size_)*/{}
43   , /*decltype(_impl_.reference_field_id_)*/{}
44   , /*decltype(_impl_._reference_field_id_cached_byte_size_)*/{0}
45   , /*decltype(_impl_.class_name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
46   , /*decltype(_impl_.id_)*/::uint64_t{0u}
47   , /*decltype(_impl_.location_id_)*/::uint64_t{0u}
48   , /*decltype(_impl_.object_size_)*/::uint64_t{0u}
49   , /*decltype(_impl_.superclass_id_)*/::uint64_t{0u}
50   , /*decltype(_impl_.classloader_id_)*/::uint64_t{0u}
51   , /*decltype(_impl_.kind_)*/0} {}
52 struct HeapGraphTypeDefaultTypeInternal {
HeapGraphTypeDefaultTypeInternalperfetto::protos::HeapGraphTypeDefaultTypeInternal53   PROTOBUF_CONSTEXPR HeapGraphTypeDefaultTypeInternal()
54       : _instance(::_pbi::ConstantInitialized{}) {}
~HeapGraphTypeDefaultTypeInternalperfetto::protos::HeapGraphTypeDefaultTypeInternal55   ~HeapGraphTypeDefaultTypeInternal() {}
56   union {  // NOLINT(misc-non-private-member-variables-in-classes)
57     HeapGraphType _instance;
58   };
59 };
60 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HeapGraphTypeDefaultTypeInternal _HeapGraphType_default_instance_;
HeapGraphObject(::_pbi::ConstantInitialized)61 PROTOBUF_CONSTEXPR HeapGraphObject::HeapGraphObject(
62     ::_pbi::ConstantInitialized): _impl_{
63     /*decltype(_impl_._has_bits_)*/{}
64   , /*decltype(_impl_._cached_size_)*/{}
65   , /*decltype(_impl_.reference_field_id_)*/{}
66   , /*decltype(_impl_._reference_field_id_cached_byte_size_)*/{0}
67   , /*decltype(_impl_.reference_object_id_)*/{}
68   , /*decltype(_impl_._reference_object_id_cached_byte_size_)*/{0}
69   , /*decltype(_impl_.type_id_)*/::uint64_t{0u}
70   , /*decltype(_impl_.self_size_)*/::uint64_t{0u}
71   , /*decltype(_impl_.reference_field_id_base_)*/::uint64_t{0u}
72   , /*decltype(_impl_.native_allocation_registry_size_field_)*/::int64_t{0}
73   , /*decltype(_impl_.heap_type_delta_)*/0
74   , /*decltype(_impl_.identifier_)*/{}
75   , /*decltype(_impl_._oneof_case_)*/{}} {}
76 struct HeapGraphObjectDefaultTypeInternal {
HeapGraphObjectDefaultTypeInternalperfetto::protos::HeapGraphObjectDefaultTypeInternal77   PROTOBUF_CONSTEXPR HeapGraphObjectDefaultTypeInternal()
78       : _instance(::_pbi::ConstantInitialized{}) {}
~HeapGraphObjectDefaultTypeInternalperfetto::protos::HeapGraphObjectDefaultTypeInternal79   ~HeapGraphObjectDefaultTypeInternal() {}
80   union {  // NOLINT(misc-non-private-member-variables-in-classes)
81     HeapGraphObject _instance;
82   };
83 };
84 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HeapGraphObjectDefaultTypeInternal _HeapGraphObject_default_instance_;
HeapGraph(::_pbi::ConstantInitialized)85 PROTOBUF_CONSTEXPR HeapGraph::HeapGraph(
86     ::_pbi::ConstantInitialized): _impl_{
87     /*decltype(_impl_._has_bits_)*/{}
88   , /*decltype(_impl_._cached_size_)*/{}
89   , /*decltype(_impl_.objects_)*/{}
90   , /*decltype(_impl_.field_names_)*/{}
91   , /*decltype(_impl_.roots_)*/{}
92   , /*decltype(_impl_.location_names_)*/{}
93   , /*decltype(_impl_.types_)*/{}
94   , /*decltype(_impl_.pid_)*/0
95   , /*decltype(_impl_.continued_)*/false
96   , /*decltype(_impl_.index_)*/::uint64_t{0u}} {}
97 struct HeapGraphDefaultTypeInternal {
HeapGraphDefaultTypeInternalperfetto::protos::HeapGraphDefaultTypeInternal98   PROTOBUF_CONSTEXPR HeapGraphDefaultTypeInternal()
99       : _instance(::_pbi::ConstantInitialized{}) {}
~HeapGraphDefaultTypeInternalperfetto::protos::HeapGraphDefaultTypeInternal100   ~HeapGraphDefaultTypeInternal() {}
101   union {  // NOLINT(misc-non-private-member-variables-in-classes)
102     HeapGraph _instance;
103   };
104 };
105 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HeapGraphDefaultTypeInternal _HeapGraph_default_instance_;
106 }  // namespace protos
107 }  // namespace perfetto
108 namespace perfetto {
109 namespace protos {
HeapGraphRoot_Type_IsValid(int value)110 bool HeapGraphRoot_Type_IsValid(int value) {
111   switch (value) {
112     case 0:
113     case 1:
114     case 2:
115     case 3:
116     case 4:
117     case 5:
118     case 6:
119     case 7:
120     case 8:
121     case 9:
122     case 10:
123     case 11:
124     case 12:
125     case 13:
126     case 14:
127       return true;
128     default:
129       return false;
130   }
131 }
132 
133 static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> HeapGraphRoot_Type_strings[15] = {};
134 
135 static const char HeapGraphRoot_Type_names[] =
136   "ROOT_DEBUGGER"
137   "ROOT_FINALIZING"
138   "ROOT_INTERNED_STRING"
139   "ROOT_JAVA_FRAME"
140   "ROOT_JNI_GLOBAL"
141   "ROOT_JNI_LOCAL"
142   "ROOT_JNI_MONITOR"
143   "ROOT_MONITOR_USED"
144   "ROOT_NATIVE_STACK"
145   "ROOT_REFERENCE_CLEANUP"
146   "ROOT_STICKY_CLASS"
147   "ROOT_THREAD_BLOCK"
148   "ROOT_THREAD_OBJECT"
149   "ROOT_UNKNOWN"
150   "ROOT_VM_INTERNAL";
151 
152 static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry HeapGraphRoot_Type_entries[] = {
153   { {HeapGraphRoot_Type_names + 0, 13}, 11 },
154   { {HeapGraphRoot_Type_names + 13, 15}, 10 },
155   { {HeapGraphRoot_Type_names + 28, 20}, 9 },
156   { {HeapGraphRoot_Type_names + 48, 15}, 3 },
157   { {HeapGraphRoot_Type_names + 63, 15}, 1 },
158   { {HeapGraphRoot_Type_names + 78, 14}, 2 },
159   { {HeapGraphRoot_Type_names + 92, 16}, 14 },
160   { {HeapGraphRoot_Type_names + 108, 17}, 7 },
161   { {HeapGraphRoot_Type_names + 125, 17}, 4 },
162   { {HeapGraphRoot_Type_names + 142, 22}, 12 },
163   { {HeapGraphRoot_Type_names + 164, 17}, 5 },
164   { {HeapGraphRoot_Type_names + 181, 17}, 6 },
165   { {HeapGraphRoot_Type_names + 198, 18}, 8 },
166   { {HeapGraphRoot_Type_names + 216, 12}, 0 },
167   { {HeapGraphRoot_Type_names + 228, 16}, 13 },
168 };
169 
170 static const int HeapGraphRoot_Type_entries_by_number[] = {
171   13, // 0 -> ROOT_UNKNOWN
172   4, // 1 -> ROOT_JNI_GLOBAL
173   5, // 2 -> ROOT_JNI_LOCAL
174   3, // 3 -> ROOT_JAVA_FRAME
175   8, // 4 -> ROOT_NATIVE_STACK
176   10, // 5 -> ROOT_STICKY_CLASS
177   11, // 6 -> ROOT_THREAD_BLOCK
178   7, // 7 -> ROOT_MONITOR_USED
179   12, // 8 -> ROOT_THREAD_OBJECT
180   2, // 9 -> ROOT_INTERNED_STRING
181   1, // 10 -> ROOT_FINALIZING
182   0, // 11 -> ROOT_DEBUGGER
183   9, // 12 -> ROOT_REFERENCE_CLEANUP
184   14, // 13 -> ROOT_VM_INTERNAL
185   6, // 14 -> ROOT_JNI_MONITOR
186 };
187 
HeapGraphRoot_Type_Name(HeapGraphRoot_Type value)188 const std::string& HeapGraphRoot_Type_Name(
189     HeapGraphRoot_Type value) {
190   static const bool dummy =
191       ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
192           HeapGraphRoot_Type_entries,
193           HeapGraphRoot_Type_entries_by_number,
194           15, HeapGraphRoot_Type_strings);
195   (void) dummy;
196   int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
197       HeapGraphRoot_Type_entries,
198       HeapGraphRoot_Type_entries_by_number,
199       15, value);
200   return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
201                      HeapGraphRoot_Type_strings[idx].get();
202 }
HeapGraphRoot_Type_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,HeapGraphRoot_Type * value)203 bool HeapGraphRoot_Type_Parse(
204     ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, HeapGraphRoot_Type* value) {
205   int int_value;
206   bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
207       HeapGraphRoot_Type_entries, 15, name, &int_value);
208   if (success) {
209     *value = static_cast<HeapGraphRoot_Type>(int_value);
210   }
211   return success;
212 }
213 #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
214 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_UNKNOWN;
215 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_JNI_GLOBAL;
216 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_JNI_LOCAL;
217 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_JAVA_FRAME;
218 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_NATIVE_STACK;
219 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_STICKY_CLASS;
220 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_THREAD_BLOCK;
221 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_MONITOR_USED;
222 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_THREAD_OBJECT;
223 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_INTERNED_STRING;
224 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_FINALIZING;
225 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_DEBUGGER;
226 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_REFERENCE_CLEANUP;
227 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_VM_INTERNAL;
228 constexpr HeapGraphRoot_Type HeapGraphRoot::ROOT_JNI_MONITOR;
229 constexpr HeapGraphRoot_Type HeapGraphRoot::Type_MIN;
230 constexpr HeapGraphRoot_Type HeapGraphRoot::Type_MAX;
231 constexpr int HeapGraphRoot::Type_ARRAYSIZE;
232 #endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
HeapGraphType_Kind_IsValid(int value)233 bool HeapGraphType_Kind_IsValid(int value) {
234   switch (value) {
235     case 0:
236     case 1:
237     case 2:
238     case 3:
239     case 4:
240     case 5:
241     case 6:
242     case 7:
243     case 8:
244     case 9:
245     case 10:
246     case 11:
247       return true;
248     default:
249       return false;
250   }
251 }
252 
253 static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> HeapGraphType_Kind_strings[12] = {};
254 
255 static const char HeapGraphType_Kind_names[] =
256   "KIND_ARRAY"
257   "KIND_CLASS"
258   "KIND_CLASSLOADER"
259   "KIND_DEXCACHE"
260   "KIND_FINALIZER_REFERENCE"
261   "KIND_NOREFERENCES"
262   "KIND_NORMAL"
263   "KIND_PHANTOM_REFERENCE"
264   "KIND_SOFT_REFERENCE"
265   "KIND_STRING"
266   "KIND_UNKNOWN"
267   "KIND_WEAK_REFERENCE";
268 
269 static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry HeapGraphType_Kind_entries[] = {
270   { {HeapGraphType_Kind_names + 0, 10}, 4 },
271   { {HeapGraphType_Kind_names + 10, 10}, 5 },
272   { {HeapGraphType_Kind_names + 20, 16}, 6 },
273   { {HeapGraphType_Kind_names + 36, 13}, 7 },
274   { {HeapGraphType_Kind_names + 49, 24}, 10 },
275   { {HeapGraphType_Kind_names + 73, 17}, 2 },
276   { {HeapGraphType_Kind_names + 90, 11}, 1 },
277   { {HeapGraphType_Kind_names + 101, 22}, 11 },
278   { {HeapGraphType_Kind_names + 123, 19}, 8 },
279   { {HeapGraphType_Kind_names + 142, 11}, 3 },
280   { {HeapGraphType_Kind_names + 153, 12}, 0 },
281   { {HeapGraphType_Kind_names + 165, 19}, 9 },
282 };
283 
284 static const int HeapGraphType_Kind_entries_by_number[] = {
285   10, // 0 -> KIND_UNKNOWN
286   6, // 1 -> KIND_NORMAL
287   5, // 2 -> KIND_NOREFERENCES
288   9, // 3 -> KIND_STRING
289   0, // 4 -> KIND_ARRAY
290   1, // 5 -> KIND_CLASS
291   2, // 6 -> KIND_CLASSLOADER
292   3, // 7 -> KIND_DEXCACHE
293   8, // 8 -> KIND_SOFT_REFERENCE
294   11, // 9 -> KIND_WEAK_REFERENCE
295   4, // 10 -> KIND_FINALIZER_REFERENCE
296   7, // 11 -> KIND_PHANTOM_REFERENCE
297 };
298 
HeapGraphType_Kind_Name(HeapGraphType_Kind value)299 const std::string& HeapGraphType_Kind_Name(
300     HeapGraphType_Kind value) {
301   static const bool dummy =
302       ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
303           HeapGraphType_Kind_entries,
304           HeapGraphType_Kind_entries_by_number,
305           12, HeapGraphType_Kind_strings);
306   (void) dummy;
307   int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
308       HeapGraphType_Kind_entries,
309       HeapGraphType_Kind_entries_by_number,
310       12, value);
311   return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
312                      HeapGraphType_Kind_strings[idx].get();
313 }
HeapGraphType_Kind_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,HeapGraphType_Kind * value)314 bool HeapGraphType_Kind_Parse(
315     ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, HeapGraphType_Kind* value) {
316   int int_value;
317   bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
318       HeapGraphType_Kind_entries, 12, name, &int_value);
319   if (success) {
320     *value = static_cast<HeapGraphType_Kind>(int_value);
321   }
322   return success;
323 }
324 #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
325 constexpr HeapGraphType_Kind HeapGraphType::KIND_UNKNOWN;
326 constexpr HeapGraphType_Kind HeapGraphType::KIND_NORMAL;
327 constexpr HeapGraphType_Kind HeapGraphType::KIND_NOREFERENCES;
328 constexpr HeapGraphType_Kind HeapGraphType::KIND_STRING;
329 constexpr HeapGraphType_Kind HeapGraphType::KIND_ARRAY;
330 constexpr HeapGraphType_Kind HeapGraphType::KIND_CLASS;
331 constexpr HeapGraphType_Kind HeapGraphType::KIND_CLASSLOADER;
332 constexpr HeapGraphType_Kind HeapGraphType::KIND_DEXCACHE;
333 constexpr HeapGraphType_Kind HeapGraphType::KIND_SOFT_REFERENCE;
334 constexpr HeapGraphType_Kind HeapGraphType::KIND_WEAK_REFERENCE;
335 constexpr HeapGraphType_Kind HeapGraphType::KIND_FINALIZER_REFERENCE;
336 constexpr HeapGraphType_Kind HeapGraphType::KIND_PHANTOM_REFERENCE;
337 constexpr HeapGraphType_Kind HeapGraphType::Kind_MIN;
338 constexpr HeapGraphType_Kind HeapGraphType::Kind_MAX;
339 constexpr int HeapGraphType::Kind_ARRAYSIZE;
340 #endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
HeapGraphObject_HeapType_IsValid(int value)341 bool HeapGraphObject_HeapType_IsValid(int value) {
342   switch (value) {
343     case 0:
344     case 1:
345     case 2:
346     case 3:
347       return true;
348     default:
349       return false;
350   }
351 }
352 
353 static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> HeapGraphObject_HeapType_strings[4] = {};
354 
355 static const char HeapGraphObject_HeapType_names[] =
356   "HEAP_TYPE_APP"
357   "HEAP_TYPE_BOOT_IMAGE"
358   "HEAP_TYPE_UNKNOWN"
359   "HEAP_TYPE_ZYGOTE";
360 
361 static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry HeapGraphObject_HeapType_entries[] = {
362   { {HeapGraphObject_HeapType_names + 0, 13}, 1 },
363   { {HeapGraphObject_HeapType_names + 13, 20}, 3 },
364   { {HeapGraphObject_HeapType_names + 33, 17}, 0 },
365   { {HeapGraphObject_HeapType_names + 50, 16}, 2 },
366 };
367 
368 static const int HeapGraphObject_HeapType_entries_by_number[] = {
369   2, // 0 -> HEAP_TYPE_UNKNOWN
370   0, // 1 -> HEAP_TYPE_APP
371   3, // 2 -> HEAP_TYPE_ZYGOTE
372   1, // 3 -> HEAP_TYPE_BOOT_IMAGE
373 };
374 
HeapGraphObject_HeapType_Name(HeapGraphObject_HeapType value)375 const std::string& HeapGraphObject_HeapType_Name(
376     HeapGraphObject_HeapType value) {
377   static const bool dummy =
378       ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
379           HeapGraphObject_HeapType_entries,
380           HeapGraphObject_HeapType_entries_by_number,
381           4, HeapGraphObject_HeapType_strings);
382   (void) dummy;
383   int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
384       HeapGraphObject_HeapType_entries,
385       HeapGraphObject_HeapType_entries_by_number,
386       4, value);
387   return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
388                      HeapGraphObject_HeapType_strings[idx].get();
389 }
HeapGraphObject_HeapType_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,HeapGraphObject_HeapType * value)390 bool HeapGraphObject_HeapType_Parse(
391     ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, HeapGraphObject_HeapType* value) {
392   int int_value;
393   bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
394       HeapGraphObject_HeapType_entries, 4, name, &int_value);
395   if (success) {
396     *value = static_cast<HeapGraphObject_HeapType>(int_value);
397   }
398   return success;
399 }
400 #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
401 constexpr HeapGraphObject_HeapType HeapGraphObject::HEAP_TYPE_UNKNOWN;
402 constexpr HeapGraphObject_HeapType HeapGraphObject::HEAP_TYPE_APP;
403 constexpr HeapGraphObject_HeapType HeapGraphObject::HEAP_TYPE_ZYGOTE;
404 constexpr HeapGraphObject_HeapType HeapGraphObject::HEAP_TYPE_BOOT_IMAGE;
405 constexpr HeapGraphObject_HeapType HeapGraphObject::HeapType_MIN;
406 constexpr HeapGraphObject_HeapType HeapGraphObject::HeapType_MAX;
407 constexpr int HeapGraphObject::HeapType_ARRAYSIZE;
408 #endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
409 
410 // ===================================================================
411 
412 class HeapGraphRoot::_Internal {
413  public:
414   using HasBits = decltype(std::declval<HeapGraphRoot>()._impl_._has_bits_);
set_has_root_type(HasBits * has_bits)415   static void set_has_root_type(HasBits* has_bits) {
416     (*has_bits)[0] |= 1u;
417   }
418 };
419 
HeapGraphRoot(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)420 HeapGraphRoot::HeapGraphRoot(::PROTOBUF_NAMESPACE_ID::Arena* arena,
421                          bool is_message_owned)
422   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
423   SharedCtor(arena, is_message_owned);
424   // @@protoc_insertion_point(arena_constructor:perfetto.protos.HeapGraphRoot)
425 }
HeapGraphRoot(const HeapGraphRoot & from)426 HeapGraphRoot::HeapGraphRoot(const HeapGraphRoot& from)
427   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
428   HeapGraphRoot* const _this = this; (void)_this;
429   new (&_impl_) Impl_{
430       decltype(_impl_._has_bits_){from._impl_._has_bits_}
431     , /*decltype(_impl_._cached_size_)*/{}
432     , decltype(_impl_.object_ids_){from._impl_.object_ids_}
433     , /*decltype(_impl_._object_ids_cached_byte_size_)*/{0}
434     , decltype(_impl_.root_type_){}};
435 
436   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
437   _this->_impl_.root_type_ = from._impl_.root_type_;
438   // @@protoc_insertion_point(copy_constructor:perfetto.protos.HeapGraphRoot)
439 }
440 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)441 inline void HeapGraphRoot::SharedCtor(
442     ::_pb::Arena* arena, bool is_message_owned) {
443   (void)arena;
444   (void)is_message_owned;
445   new (&_impl_) Impl_{
446       decltype(_impl_._has_bits_){}
447     , /*decltype(_impl_._cached_size_)*/{}
448     , decltype(_impl_.object_ids_){arena}
449     , /*decltype(_impl_._object_ids_cached_byte_size_)*/{0}
450     , decltype(_impl_.root_type_){0}
451   };
452 }
453 
~HeapGraphRoot()454 HeapGraphRoot::~HeapGraphRoot() {
455   // @@protoc_insertion_point(destructor:perfetto.protos.HeapGraphRoot)
456   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
457   (void)arena;
458     return;
459   }
460   SharedDtor();
461 }
462 
SharedDtor()463 inline void HeapGraphRoot::SharedDtor() {
464   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
465   _impl_.object_ids_.~RepeatedField();
466 }
467 
SetCachedSize(int size) const468 void HeapGraphRoot::SetCachedSize(int size) const {
469   _impl_._cached_size_.Set(size);
470 }
471 
Clear()472 void HeapGraphRoot::Clear() {
473 // @@protoc_insertion_point(message_clear_start:perfetto.protos.HeapGraphRoot)
474   ::uint32_t cached_has_bits = 0;
475   // Prevent compiler warnings about cached_has_bits being unused
476   (void) cached_has_bits;
477 
478   _impl_.object_ids_.Clear();
479   _impl_.root_type_ = 0;
480   _impl_._has_bits_.Clear();
481   _internal_metadata_.Clear<std::string>();
482 }
483 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)484 const char* HeapGraphRoot::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
485 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
486   _Internal::HasBits has_bits{};
487   while (!ctx->Done(&ptr)) {
488     ::uint32_t tag;
489     ptr = ::_pbi::ReadTag(ptr, &tag);
490     switch (tag >> 3) {
491       // repeated uint64 object_ids = 1 [packed = true];
492       case 1:
493         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 10)) {
494           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedUInt64Parser(_internal_mutable_object_ids(), ptr, ctx);
495           CHK_(ptr);
496         } else if (static_cast<::uint8_t>(tag) == 8) {
497           _internal_add_object_ids(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
498           CHK_(ptr);
499         } else {
500           goto handle_unusual;
501         }
502         continue;
503       // optional .perfetto.protos.HeapGraphRoot.Type root_type = 2;
504       case 2:
505         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
506           ::uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
507           CHK_(ptr);
508           if (PROTOBUF_PREDICT_TRUE(::perfetto::protos::HeapGraphRoot_Type_IsValid(val))) {
509             _internal_set_root_type(static_cast<::perfetto::protos::HeapGraphRoot_Type>(val));
510           } else {
511             ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields());
512           }
513         } else {
514           goto handle_unusual;
515         }
516         continue;
517       default:
518         goto handle_unusual;
519     }  // switch
520   handle_unusual:
521     if ((tag == 0) || ((tag & 7) == 4)) {
522       CHK_(ptr);
523       ctx->SetLastTag(tag);
524       goto message_done;
525     }
526     ptr = UnknownFieldParse(
527         tag,
528         _internal_metadata_.mutable_unknown_fields<std::string>(),
529         ptr, ctx);
530     CHK_(ptr != nullptr);
531   }  // while
532 message_done:
533   _impl_._has_bits_.Or(has_bits);
534   return ptr;
535 failure:
536   ptr = nullptr;
537   goto message_done;
538 #undef CHK_
539 }
540 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const541 ::uint8_t* HeapGraphRoot::_InternalSerialize(
542     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
543   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.HeapGraphRoot)
544   ::uint32_t cached_has_bits = 0;
545   (void) cached_has_bits;
546 
547   // repeated uint64 object_ids = 1 [packed = true];
548   {
549     int byte_size = _impl_._object_ids_cached_byte_size_.load(std::memory_order_relaxed);
550     if (byte_size > 0) {
551       target = stream->WriteUInt64Packed(
552           1, _internal_object_ids(), byte_size, target);
553     }
554   }
555 
556   cached_has_bits = _impl_._has_bits_[0];
557   // optional .perfetto.protos.HeapGraphRoot.Type root_type = 2;
558   if (cached_has_bits & 0x00000001u) {
559     target = stream->EnsureSpace(target);
560     target = ::_pbi::WireFormatLite::WriteEnumToArray(
561       2, this->_internal_root_type(), target);
562   }
563 
564   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
565     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
566         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
567   }
568   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.HeapGraphRoot)
569   return target;
570 }
571 
ByteSizeLong() const572 size_t HeapGraphRoot::ByteSizeLong() const {
573 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.HeapGraphRoot)
574   size_t total_size = 0;
575 
576   ::uint32_t cached_has_bits = 0;
577   // Prevent compiler warnings about cached_has_bits being unused
578   (void) cached_has_bits;
579 
580   // repeated uint64 object_ids = 1 [packed = true];
581   {
582     size_t data_size = ::_pbi::WireFormatLite::
583       UInt64Size(this->_impl_.object_ids_);
584     if (data_size > 0) {
585       total_size += 1 +
586         ::_pbi::WireFormatLite::Int32Size(static_cast<::int32_t>(data_size));
587     }
588     int cached_size = ::_pbi::ToCachedSize(data_size);
589     _impl_._object_ids_cached_byte_size_.store(cached_size,
590                                     std::memory_order_relaxed);
591     total_size += data_size;
592   }
593 
594   // optional .perfetto.protos.HeapGraphRoot.Type root_type = 2;
595   cached_has_bits = _impl_._has_bits_[0];
596   if (cached_has_bits & 0x00000001u) {
597     total_size += 1 +
598       ::_pbi::WireFormatLite::EnumSize(this->_internal_root_type());
599   }
600 
601   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
602     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
603   }
604   int cached_size = ::_pbi::ToCachedSize(total_size);
605   SetCachedSize(cached_size);
606   return total_size;
607 }
608 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)609 void HeapGraphRoot::CheckTypeAndMergeFrom(
610     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
611   MergeFrom(*::_pbi::DownCast<const HeapGraphRoot*>(
612       &from));
613 }
614 
MergeFrom(const HeapGraphRoot & from)615 void HeapGraphRoot::MergeFrom(const HeapGraphRoot& from) {
616   HeapGraphRoot* const _this = this;
617   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.HeapGraphRoot)
618   GOOGLE_DCHECK_NE(&from, _this);
619   ::uint32_t cached_has_bits = 0;
620   (void) cached_has_bits;
621 
622   _this->_impl_.object_ids_.MergeFrom(from._impl_.object_ids_);
623   if (from._internal_has_root_type()) {
624     _this->_internal_set_root_type(from._internal_root_type());
625   }
626   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
627 }
628 
CopyFrom(const HeapGraphRoot & from)629 void HeapGraphRoot::CopyFrom(const HeapGraphRoot& from) {
630 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.HeapGraphRoot)
631   if (&from == this) return;
632   Clear();
633   MergeFrom(from);
634 }
635 
IsInitialized() const636 bool HeapGraphRoot::IsInitialized() const {
637   return true;
638 }
639 
InternalSwap(HeapGraphRoot * other)640 void HeapGraphRoot::InternalSwap(HeapGraphRoot* other) {
641   using std::swap;
642   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
643   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
644   _impl_.object_ids_.InternalSwap(&other->_impl_.object_ids_);
645   swap(_impl_.root_type_, other->_impl_.root_type_);
646 }
647 
GetTypeName() const648 std::string HeapGraphRoot::GetTypeName() const {
649   return "perfetto.protos.HeapGraphRoot";
650 }
651 
652 
653 // ===================================================================
654 
655 class HeapGraphType::_Internal {
656  public:
657   using HasBits = decltype(std::declval<HeapGraphType>()._impl_._has_bits_);
set_has_id(HasBits * has_bits)658   static void set_has_id(HasBits* has_bits) {
659     (*has_bits)[0] |= 2u;
660   }
set_has_location_id(HasBits * has_bits)661   static void set_has_location_id(HasBits* has_bits) {
662     (*has_bits)[0] |= 4u;
663   }
set_has_class_name(HasBits * has_bits)664   static void set_has_class_name(HasBits* has_bits) {
665     (*has_bits)[0] |= 1u;
666   }
set_has_object_size(HasBits * has_bits)667   static void set_has_object_size(HasBits* has_bits) {
668     (*has_bits)[0] |= 8u;
669   }
set_has_superclass_id(HasBits * has_bits)670   static void set_has_superclass_id(HasBits* has_bits) {
671     (*has_bits)[0] |= 16u;
672   }
set_has_kind(HasBits * has_bits)673   static void set_has_kind(HasBits* has_bits) {
674     (*has_bits)[0] |= 64u;
675   }
set_has_classloader_id(HasBits * has_bits)676   static void set_has_classloader_id(HasBits* has_bits) {
677     (*has_bits)[0] |= 32u;
678   }
679 };
680 
HeapGraphType(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)681 HeapGraphType::HeapGraphType(::PROTOBUF_NAMESPACE_ID::Arena* arena,
682                          bool is_message_owned)
683   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
684   SharedCtor(arena, is_message_owned);
685   // @@protoc_insertion_point(arena_constructor:perfetto.protos.HeapGraphType)
686 }
HeapGraphType(const HeapGraphType & from)687 HeapGraphType::HeapGraphType(const HeapGraphType& from)
688   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
689   HeapGraphType* const _this = this; (void)_this;
690   new (&_impl_) Impl_{
691       decltype(_impl_._has_bits_){from._impl_._has_bits_}
692     , /*decltype(_impl_._cached_size_)*/{}
693     , decltype(_impl_.reference_field_id_){from._impl_.reference_field_id_}
694     , /*decltype(_impl_._reference_field_id_cached_byte_size_)*/{0}
695     , decltype(_impl_.class_name_){}
696     , decltype(_impl_.id_){}
697     , decltype(_impl_.location_id_){}
698     , decltype(_impl_.object_size_){}
699     , decltype(_impl_.superclass_id_){}
700     , decltype(_impl_.classloader_id_){}
701     , decltype(_impl_.kind_){}};
702 
703   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
704   _impl_.class_name_.InitDefault();
705   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
706     _impl_.class_name_.Set("", GetArenaForAllocation());
707   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
708   if (from._internal_has_class_name()) {
709     _this->_impl_.class_name_.Set(from._internal_class_name(),
710       _this->GetArenaForAllocation());
711   }
712   ::memcpy(&_impl_.id_, &from._impl_.id_,
713     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.kind_) -
714     reinterpret_cast<char*>(&_impl_.id_)) + sizeof(_impl_.kind_));
715   // @@protoc_insertion_point(copy_constructor:perfetto.protos.HeapGraphType)
716 }
717 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)718 inline void HeapGraphType::SharedCtor(
719     ::_pb::Arena* arena, bool is_message_owned) {
720   (void)arena;
721   (void)is_message_owned;
722   new (&_impl_) Impl_{
723       decltype(_impl_._has_bits_){}
724     , /*decltype(_impl_._cached_size_)*/{}
725     , decltype(_impl_.reference_field_id_){arena}
726     , /*decltype(_impl_._reference_field_id_cached_byte_size_)*/{0}
727     , decltype(_impl_.class_name_){}
728     , decltype(_impl_.id_){::uint64_t{0u}}
729     , decltype(_impl_.location_id_){::uint64_t{0u}}
730     , decltype(_impl_.object_size_){::uint64_t{0u}}
731     , decltype(_impl_.superclass_id_){::uint64_t{0u}}
732     , decltype(_impl_.classloader_id_){::uint64_t{0u}}
733     , decltype(_impl_.kind_){0}
734   };
735   _impl_.class_name_.InitDefault();
736   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
737     _impl_.class_name_.Set("", GetArenaForAllocation());
738   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
739 }
740 
~HeapGraphType()741 HeapGraphType::~HeapGraphType() {
742   // @@protoc_insertion_point(destructor:perfetto.protos.HeapGraphType)
743   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
744   (void)arena;
745     return;
746   }
747   SharedDtor();
748 }
749 
SharedDtor()750 inline void HeapGraphType::SharedDtor() {
751   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
752   _impl_.reference_field_id_.~RepeatedField();
753   _impl_.class_name_.Destroy();
754 }
755 
SetCachedSize(int size) const756 void HeapGraphType::SetCachedSize(int size) const {
757   _impl_._cached_size_.Set(size);
758 }
759 
Clear()760 void HeapGraphType::Clear() {
761 // @@protoc_insertion_point(message_clear_start:perfetto.protos.HeapGraphType)
762   ::uint32_t cached_has_bits = 0;
763   // Prevent compiler warnings about cached_has_bits being unused
764   (void) cached_has_bits;
765 
766   _impl_.reference_field_id_.Clear();
767   cached_has_bits = _impl_._has_bits_[0];
768   if (cached_has_bits & 0x00000001u) {
769     _impl_.class_name_.ClearNonDefaultToEmpty();
770   }
771   if (cached_has_bits & 0x0000007eu) {
772     ::memset(&_impl_.id_, 0, static_cast<size_t>(
773         reinterpret_cast<char*>(&_impl_.kind_) -
774         reinterpret_cast<char*>(&_impl_.id_)) + sizeof(_impl_.kind_));
775   }
776   _impl_._has_bits_.Clear();
777   _internal_metadata_.Clear<std::string>();
778 }
779 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)780 const char* HeapGraphType::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
781 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
782   _Internal::HasBits has_bits{};
783   while (!ctx->Done(&ptr)) {
784     ::uint32_t tag;
785     ptr = ::_pbi::ReadTag(ptr, &tag);
786     switch (tag >> 3) {
787       // optional uint64 id = 1;
788       case 1:
789         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
790           _Internal::set_has_id(&has_bits);
791           _impl_.id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
792           CHK_(ptr);
793         } else {
794           goto handle_unusual;
795         }
796         continue;
797       // optional uint64 location_id = 2;
798       case 2:
799         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
800           _Internal::set_has_location_id(&has_bits);
801           _impl_.location_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
802           CHK_(ptr);
803         } else {
804           goto handle_unusual;
805         }
806         continue;
807       // optional string class_name = 3;
808       case 3:
809         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 26)) {
810           auto str = _internal_mutable_class_name();
811           ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
812           CHK_(ptr);
813         } else {
814           goto handle_unusual;
815         }
816         continue;
817       // optional uint64 object_size = 4;
818       case 4:
819         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 32)) {
820           _Internal::set_has_object_size(&has_bits);
821           _impl_.object_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
822           CHK_(ptr);
823         } else {
824           goto handle_unusual;
825         }
826         continue;
827       // optional uint64 superclass_id = 5;
828       case 5:
829         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 40)) {
830           _Internal::set_has_superclass_id(&has_bits);
831           _impl_.superclass_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
832           CHK_(ptr);
833         } else {
834           goto handle_unusual;
835         }
836         continue;
837       // repeated uint64 reference_field_id = 6 [packed = true];
838       case 6:
839         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 50)) {
840           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedUInt64Parser(_internal_mutable_reference_field_id(), ptr, ctx);
841           CHK_(ptr);
842         } else if (static_cast<::uint8_t>(tag) == 48) {
843           _internal_add_reference_field_id(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
844           CHK_(ptr);
845         } else {
846           goto handle_unusual;
847         }
848         continue;
849       // optional .perfetto.protos.HeapGraphType.Kind kind = 7;
850       case 7:
851         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 56)) {
852           ::uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
853           CHK_(ptr);
854           if (PROTOBUF_PREDICT_TRUE(::perfetto::protos::HeapGraphType_Kind_IsValid(val))) {
855             _internal_set_kind(static_cast<::perfetto::protos::HeapGraphType_Kind>(val));
856           } else {
857             ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(7, val, mutable_unknown_fields());
858           }
859         } else {
860           goto handle_unusual;
861         }
862         continue;
863       // optional uint64 classloader_id = 8;
864       case 8:
865         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 64)) {
866           _Internal::set_has_classloader_id(&has_bits);
867           _impl_.classloader_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
868           CHK_(ptr);
869         } else {
870           goto handle_unusual;
871         }
872         continue;
873       default:
874         goto handle_unusual;
875     }  // switch
876   handle_unusual:
877     if ((tag == 0) || ((tag & 7) == 4)) {
878       CHK_(ptr);
879       ctx->SetLastTag(tag);
880       goto message_done;
881     }
882     ptr = UnknownFieldParse(
883         tag,
884         _internal_metadata_.mutable_unknown_fields<std::string>(),
885         ptr, ctx);
886     CHK_(ptr != nullptr);
887   }  // while
888 message_done:
889   _impl_._has_bits_.Or(has_bits);
890   return ptr;
891 failure:
892   ptr = nullptr;
893   goto message_done;
894 #undef CHK_
895 }
896 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const897 ::uint8_t* HeapGraphType::_InternalSerialize(
898     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
899   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.HeapGraphType)
900   ::uint32_t cached_has_bits = 0;
901   (void) cached_has_bits;
902 
903   cached_has_bits = _impl_._has_bits_[0];
904   // optional uint64 id = 1;
905   if (cached_has_bits & 0x00000002u) {
906     target = stream->EnsureSpace(target);
907     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_id(), target);
908   }
909 
910   // optional uint64 location_id = 2;
911   if (cached_has_bits & 0x00000004u) {
912     target = stream->EnsureSpace(target);
913     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_location_id(), target);
914   }
915 
916   // optional string class_name = 3;
917   if (cached_has_bits & 0x00000001u) {
918     target = stream->WriteStringMaybeAliased(
919         3, this->_internal_class_name(), target);
920   }
921 
922   // optional uint64 object_size = 4;
923   if (cached_has_bits & 0x00000008u) {
924     target = stream->EnsureSpace(target);
925     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(4, this->_internal_object_size(), target);
926   }
927 
928   // optional uint64 superclass_id = 5;
929   if (cached_has_bits & 0x00000010u) {
930     target = stream->EnsureSpace(target);
931     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(5, this->_internal_superclass_id(), target);
932   }
933 
934   // repeated uint64 reference_field_id = 6 [packed = true];
935   {
936     int byte_size = _impl_._reference_field_id_cached_byte_size_.load(std::memory_order_relaxed);
937     if (byte_size > 0) {
938       target = stream->WriteUInt64Packed(
939           6, _internal_reference_field_id(), byte_size, target);
940     }
941   }
942 
943   // optional .perfetto.protos.HeapGraphType.Kind kind = 7;
944   if (cached_has_bits & 0x00000040u) {
945     target = stream->EnsureSpace(target);
946     target = ::_pbi::WireFormatLite::WriteEnumToArray(
947       7, this->_internal_kind(), target);
948   }
949 
950   // optional uint64 classloader_id = 8;
951   if (cached_has_bits & 0x00000020u) {
952     target = stream->EnsureSpace(target);
953     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(8, this->_internal_classloader_id(), target);
954   }
955 
956   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
957     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
958         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
959   }
960   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.HeapGraphType)
961   return target;
962 }
963 
ByteSizeLong() const964 size_t HeapGraphType::ByteSizeLong() const {
965 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.HeapGraphType)
966   size_t total_size = 0;
967 
968   ::uint32_t cached_has_bits = 0;
969   // Prevent compiler warnings about cached_has_bits being unused
970   (void) cached_has_bits;
971 
972   // repeated uint64 reference_field_id = 6 [packed = true];
973   {
974     size_t data_size = ::_pbi::WireFormatLite::
975       UInt64Size(this->_impl_.reference_field_id_);
976     if (data_size > 0) {
977       total_size += 1 +
978         ::_pbi::WireFormatLite::Int32Size(static_cast<::int32_t>(data_size));
979     }
980     int cached_size = ::_pbi::ToCachedSize(data_size);
981     _impl_._reference_field_id_cached_byte_size_.store(cached_size,
982                                     std::memory_order_relaxed);
983     total_size += data_size;
984   }
985 
986   cached_has_bits = _impl_._has_bits_[0];
987   if (cached_has_bits & 0x0000007fu) {
988     // optional string class_name = 3;
989     if (cached_has_bits & 0x00000001u) {
990       total_size += 1 +
991         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
992           this->_internal_class_name());
993     }
994 
995     // optional uint64 id = 1;
996     if (cached_has_bits & 0x00000002u) {
997       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_id());
998     }
999 
1000     // optional uint64 location_id = 2;
1001     if (cached_has_bits & 0x00000004u) {
1002       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_location_id());
1003     }
1004 
1005     // optional uint64 object_size = 4;
1006     if (cached_has_bits & 0x00000008u) {
1007       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_object_size());
1008     }
1009 
1010     // optional uint64 superclass_id = 5;
1011     if (cached_has_bits & 0x00000010u) {
1012       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_superclass_id());
1013     }
1014 
1015     // optional uint64 classloader_id = 8;
1016     if (cached_has_bits & 0x00000020u) {
1017       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_classloader_id());
1018     }
1019 
1020     // optional .perfetto.protos.HeapGraphType.Kind kind = 7;
1021     if (cached_has_bits & 0x00000040u) {
1022       total_size += 1 +
1023         ::_pbi::WireFormatLite::EnumSize(this->_internal_kind());
1024     }
1025 
1026   }
1027   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
1028     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
1029   }
1030   int cached_size = ::_pbi::ToCachedSize(total_size);
1031   SetCachedSize(cached_size);
1032   return total_size;
1033 }
1034 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)1035 void HeapGraphType::CheckTypeAndMergeFrom(
1036     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
1037   MergeFrom(*::_pbi::DownCast<const HeapGraphType*>(
1038       &from));
1039 }
1040 
MergeFrom(const HeapGraphType & from)1041 void HeapGraphType::MergeFrom(const HeapGraphType& from) {
1042   HeapGraphType* const _this = this;
1043   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.HeapGraphType)
1044   GOOGLE_DCHECK_NE(&from, _this);
1045   ::uint32_t cached_has_bits = 0;
1046   (void) cached_has_bits;
1047 
1048   _this->_impl_.reference_field_id_.MergeFrom(from._impl_.reference_field_id_);
1049   cached_has_bits = from._impl_._has_bits_[0];
1050   if (cached_has_bits & 0x0000007fu) {
1051     if (cached_has_bits & 0x00000001u) {
1052       _this->_internal_set_class_name(from._internal_class_name());
1053     }
1054     if (cached_has_bits & 0x00000002u) {
1055       _this->_impl_.id_ = from._impl_.id_;
1056     }
1057     if (cached_has_bits & 0x00000004u) {
1058       _this->_impl_.location_id_ = from._impl_.location_id_;
1059     }
1060     if (cached_has_bits & 0x00000008u) {
1061       _this->_impl_.object_size_ = from._impl_.object_size_;
1062     }
1063     if (cached_has_bits & 0x00000010u) {
1064       _this->_impl_.superclass_id_ = from._impl_.superclass_id_;
1065     }
1066     if (cached_has_bits & 0x00000020u) {
1067       _this->_impl_.classloader_id_ = from._impl_.classloader_id_;
1068     }
1069     if (cached_has_bits & 0x00000040u) {
1070       _this->_impl_.kind_ = from._impl_.kind_;
1071     }
1072     _this->_impl_._has_bits_[0] |= cached_has_bits;
1073   }
1074   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
1075 }
1076 
CopyFrom(const HeapGraphType & from)1077 void HeapGraphType::CopyFrom(const HeapGraphType& from) {
1078 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.HeapGraphType)
1079   if (&from == this) return;
1080   Clear();
1081   MergeFrom(from);
1082 }
1083 
IsInitialized() const1084 bool HeapGraphType::IsInitialized() const {
1085   return true;
1086 }
1087 
InternalSwap(HeapGraphType * other)1088 void HeapGraphType::InternalSwap(HeapGraphType* other) {
1089   using std::swap;
1090   auto* lhs_arena = GetArenaForAllocation();
1091   auto* rhs_arena = other->GetArenaForAllocation();
1092   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
1093   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
1094   _impl_.reference_field_id_.InternalSwap(&other->_impl_.reference_field_id_);
1095   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
1096       &_impl_.class_name_, lhs_arena,
1097       &other->_impl_.class_name_, rhs_arena
1098   );
1099   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
1100       PROTOBUF_FIELD_OFFSET(HeapGraphType, _impl_.kind_)
1101       + sizeof(HeapGraphType::_impl_.kind_)  // NOLINT
1102       - PROTOBUF_FIELD_OFFSET(HeapGraphType, _impl_.id_)>(
1103           reinterpret_cast<char*>(&_impl_.id_),
1104           reinterpret_cast<char*>(&other->_impl_.id_));
1105 }
1106 
GetTypeName() const1107 std::string HeapGraphType::GetTypeName() const {
1108   return "perfetto.protos.HeapGraphType";
1109 }
1110 
1111 
1112 // ===================================================================
1113 
1114 class HeapGraphObject::_Internal {
1115  public:
1116   using HasBits = decltype(std::declval<HeapGraphObject>()._impl_._has_bits_);
set_has_type_id(HasBits * has_bits)1117   static void set_has_type_id(HasBits* has_bits) {
1118     (*has_bits)[0] |= 1u;
1119   }
set_has_self_size(HasBits * has_bits)1120   static void set_has_self_size(HasBits* has_bits) {
1121     (*has_bits)[0] |= 2u;
1122   }
set_has_reference_field_id_base(HasBits * has_bits)1123   static void set_has_reference_field_id_base(HasBits* has_bits) {
1124     (*has_bits)[0] |= 4u;
1125   }
set_has_native_allocation_registry_size_field(HasBits * has_bits)1126   static void set_has_native_allocation_registry_size_field(HasBits* has_bits) {
1127     (*has_bits)[0] |= 8u;
1128   }
set_has_heap_type_delta(HasBits * has_bits)1129   static void set_has_heap_type_delta(HasBits* has_bits) {
1130     (*has_bits)[0] |= 16u;
1131   }
1132 };
1133 
HeapGraphObject(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)1134 HeapGraphObject::HeapGraphObject(::PROTOBUF_NAMESPACE_ID::Arena* arena,
1135                          bool is_message_owned)
1136   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
1137   SharedCtor(arena, is_message_owned);
1138   // @@protoc_insertion_point(arena_constructor:perfetto.protos.HeapGraphObject)
1139 }
HeapGraphObject(const HeapGraphObject & from)1140 HeapGraphObject::HeapGraphObject(const HeapGraphObject& from)
1141   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
1142   HeapGraphObject* const _this = this; (void)_this;
1143   new (&_impl_) Impl_{
1144       decltype(_impl_._has_bits_){from._impl_._has_bits_}
1145     , /*decltype(_impl_._cached_size_)*/{}
1146     , decltype(_impl_.reference_field_id_){from._impl_.reference_field_id_}
1147     , /*decltype(_impl_._reference_field_id_cached_byte_size_)*/{0}
1148     , decltype(_impl_.reference_object_id_){from._impl_.reference_object_id_}
1149     , /*decltype(_impl_._reference_object_id_cached_byte_size_)*/{0}
1150     , decltype(_impl_.type_id_){}
1151     , decltype(_impl_.self_size_){}
1152     , decltype(_impl_.reference_field_id_base_){}
1153     , decltype(_impl_.native_allocation_registry_size_field_){}
1154     , decltype(_impl_.heap_type_delta_){}
1155     , decltype(_impl_.identifier_){}
1156     , /*decltype(_impl_._oneof_case_)*/{}};
1157 
1158   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
1159   ::memcpy(&_impl_.type_id_, &from._impl_.type_id_,
1160     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.heap_type_delta_) -
1161     reinterpret_cast<char*>(&_impl_.type_id_)) + sizeof(_impl_.heap_type_delta_));
1162   clear_has_identifier();
1163   switch (from.identifier_case()) {
1164     case kId: {
1165       _this->_internal_set_id(from._internal_id());
1166       break;
1167     }
1168     case kIdDelta: {
1169       _this->_internal_set_id_delta(from._internal_id_delta());
1170       break;
1171     }
1172     case IDENTIFIER_NOT_SET: {
1173       break;
1174     }
1175   }
1176   // @@protoc_insertion_point(copy_constructor:perfetto.protos.HeapGraphObject)
1177 }
1178 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)1179 inline void HeapGraphObject::SharedCtor(
1180     ::_pb::Arena* arena, bool is_message_owned) {
1181   (void)arena;
1182   (void)is_message_owned;
1183   new (&_impl_) Impl_{
1184       decltype(_impl_._has_bits_){}
1185     , /*decltype(_impl_._cached_size_)*/{}
1186     , decltype(_impl_.reference_field_id_){arena}
1187     , /*decltype(_impl_._reference_field_id_cached_byte_size_)*/{0}
1188     , decltype(_impl_.reference_object_id_){arena}
1189     , /*decltype(_impl_._reference_object_id_cached_byte_size_)*/{0}
1190     , decltype(_impl_.type_id_){::uint64_t{0u}}
1191     , decltype(_impl_.self_size_){::uint64_t{0u}}
1192     , decltype(_impl_.reference_field_id_base_){::uint64_t{0u}}
1193     , decltype(_impl_.native_allocation_registry_size_field_){::int64_t{0}}
1194     , decltype(_impl_.heap_type_delta_){0}
1195     , decltype(_impl_.identifier_){}
1196     , /*decltype(_impl_._oneof_case_)*/{}
1197   };
1198   clear_has_identifier();
1199 }
1200 
~HeapGraphObject()1201 HeapGraphObject::~HeapGraphObject() {
1202   // @@protoc_insertion_point(destructor:perfetto.protos.HeapGraphObject)
1203   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
1204   (void)arena;
1205     return;
1206   }
1207   SharedDtor();
1208 }
1209 
SharedDtor()1210 inline void HeapGraphObject::SharedDtor() {
1211   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
1212   _impl_.reference_field_id_.~RepeatedField();
1213   _impl_.reference_object_id_.~RepeatedField();
1214   if (has_identifier()) {
1215     clear_identifier();
1216   }
1217 }
1218 
SetCachedSize(int size) const1219 void HeapGraphObject::SetCachedSize(int size) const {
1220   _impl_._cached_size_.Set(size);
1221 }
1222 
clear_identifier()1223 void HeapGraphObject::clear_identifier() {
1224 // @@protoc_insertion_point(one_of_clear_start:perfetto.protos.HeapGraphObject)
1225   switch (identifier_case()) {
1226     case kId: {
1227       // No need to clear
1228       break;
1229     }
1230     case kIdDelta: {
1231       // No need to clear
1232       break;
1233     }
1234     case IDENTIFIER_NOT_SET: {
1235       break;
1236     }
1237   }
1238   _impl_._oneof_case_[0] = IDENTIFIER_NOT_SET;
1239 }
1240 
1241 
Clear()1242 void HeapGraphObject::Clear() {
1243 // @@protoc_insertion_point(message_clear_start:perfetto.protos.HeapGraphObject)
1244   ::uint32_t cached_has_bits = 0;
1245   // Prevent compiler warnings about cached_has_bits being unused
1246   (void) cached_has_bits;
1247 
1248   _impl_.reference_field_id_.Clear();
1249   _impl_.reference_object_id_.Clear();
1250   cached_has_bits = _impl_._has_bits_[0];
1251   if (cached_has_bits & 0x0000001fu) {
1252     ::memset(&_impl_.type_id_, 0, static_cast<size_t>(
1253         reinterpret_cast<char*>(&_impl_.heap_type_delta_) -
1254         reinterpret_cast<char*>(&_impl_.type_id_)) + sizeof(_impl_.heap_type_delta_));
1255   }
1256   clear_identifier();
1257   _impl_._has_bits_.Clear();
1258   _internal_metadata_.Clear<std::string>();
1259 }
1260 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)1261 const char* HeapGraphObject::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
1262 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
1263   _Internal::HasBits has_bits{};
1264   while (!ctx->Done(&ptr)) {
1265     ::uint32_t tag;
1266     ptr = ::_pbi::ReadTag(ptr, &tag);
1267     switch (tag >> 3) {
1268       // uint64 id = 1;
1269       case 1:
1270         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
1271           _internal_set_id(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1272           CHK_(ptr);
1273         } else {
1274           goto handle_unusual;
1275         }
1276         continue;
1277       // optional uint64 type_id = 2;
1278       case 2:
1279         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
1280           _Internal::set_has_type_id(&has_bits);
1281           _impl_.type_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1282           CHK_(ptr);
1283         } else {
1284           goto handle_unusual;
1285         }
1286         continue;
1287       // optional uint64 self_size = 3;
1288       case 3:
1289         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 24)) {
1290           _Internal::set_has_self_size(&has_bits);
1291           _impl_.self_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1292           CHK_(ptr);
1293         } else {
1294           goto handle_unusual;
1295         }
1296         continue;
1297       // repeated uint64 reference_field_id = 4 [packed = true];
1298       case 4:
1299         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 34)) {
1300           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedUInt64Parser(_internal_mutable_reference_field_id(), ptr, ctx);
1301           CHK_(ptr);
1302         } else if (static_cast<::uint8_t>(tag) == 32) {
1303           _internal_add_reference_field_id(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1304           CHK_(ptr);
1305         } else {
1306           goto handle_unusual;
1307         }
1308         continue;
1309       // repeated uint64 reference_object_id = 5 [packed = true];
1310       case 5:
1311         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 42)) {
1312           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedUInt64Parser(_internal_mutable_reference_object_id(), ptr, ctx);
1313           CHK_(ptr);
1314         } else if (static_cast<::uint8_t>(tag) == 40) {
1315           _internal_add_reference_object_id(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1316           CHK_(ptr);
1317         } else {
1318           goto handle_unusual;
1319         }
1320         continue;
1321       // optional uint64 reference_field_id_base = 6;
1322       case 6:
1323         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 48)) {
1324           _Internal::set_has_reference_field_id_base(&has_bits);
1325           _impl_.reference_field_id_base_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1326           CHK_(ptr);
1327         } else {
1328           goto handle_unusual;
1329         }
1330         continue;
1331       // uint64 id_delta = 7;
1332       case 7:
1333         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 56)) {
1334           _internal_set_id_delta(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
1335           CHK_(ptr);
1336         } else {
1337           goto handle_unusual;
1338         }
1339         continue;
1340       // optional int64 native_allocation_registry_size_field = 8;
1341       case 8:
1342         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 64)) {
1343           _Internal::set_has_native_allocation_registry_size_field(&has_bits);
1344           _impl_.native_allocation_registry_size_field_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1345           CHK_(ptr);
1346         } else {
1347           goto handle_unusual;
1348         }
1349         continue;
1350       // optional .perfetto.protos.HeapGraphObject.HeapType heap_type_delta = 9;
1351       case 9:
1352         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 72)) {
1353           ::uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1354           CHK_(ptr);
1355           if (PROTOBUF_PREDICT_TRUE(::perfetto::protos::HeapGraphObject_HeapType_IsValid(val))) {
1356             _internal_set_heap_type_delta(static_cast<::perfetto::protos::HeapGraphObject_HeapType>(val));
1357           } else {
1358             ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(9, val, mutable_unknown_fields());
1359           }
1360         } else {
1361           goto handle_unusual;
1362         }
1363         continue;
1364       default:
1365         goto handle_unusual;
1366     }  // switch
1367   handle_unusual:
1368     if ((tag == 0) || ((tag & 7) == 4)) {
1369       CHK_(ptr);
1370       ctx->SetLastTag(tag);
1371       goto message_done;
1372     }
1373     ptr = UnknownFieldParse(
1374         tag,
1375         _internal_metadata_.mutable_unknown_fields<std::string>(),
1376         ptr, ctx);
1377     CHK_(ptr != nullptr);
1378   }  // while
1379 message_done:
1380   _impl_._has_bits_.Or(has_bits);
1381   return ptr;
1382 failure:
1383   ptr = nullptr;
1384   goto message_done;
1385 #undef CHK_
1386 }
1387 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const1388 ::uint8_t* HeapGraphObject::_InternalSerialize(
1389     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
1390   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.HeapGraphObject)
1391   ::uint32_t cached_has_bits = 0;
1392   (void) cached_has_bits;
1393 
1394   // uint64 id = 1;
1395   if (_internal_has_id()) {
1396     target = stream->EnsureSpace(target);
1397     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(1, this->_internal_id(), target);
1398   }
1399 
1400   cached_has_bits = _impl_._has_bits_[0];
1401   // optional uint64 type_id = 2;
1402   if (cached_has_bits & 0x00000001u) {
1403     target = stream->EnsureSpace(target);
1404     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(2, this->_internal_type_id(), target);
1405   }
1406 
1407   // optional uint64 self_size = 3;
1408   if (cached_has_bits & 0x00000002u) {
1409     target = stream->EnsureSpace(target);
1410     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(3, this->_internal_self_size(), target);
1411   }
1412 
1413   // repeated uint64 reference_field_id = 4 [packed = true];
1414   {
1415     int byte_size = _impl_._reference_field_id_cached_byte_size_.load(std::memory_order_relaxed);
1416     if (byte_size > 0) {
1417       target = stream->WriteUInt64Packed(
1418           4, _internal_reference_field_id(), byte_size, target);
1419     }
1420   }
1421 
1422   // repeated uint64 reference_object_id = 5 [packed = true];
1423   {
1424     int byte_size = _impl_._reference_object_id_cached_byte_size_.load(std::memory_order_relaxed);
1425     if (byte_size > 0) {
1426       target = stream->WriteUInt64Packed(
1427           5, _internal_reference_object_id(), byte_size, target);
1428     }
1429   }
1430 
1431   // optional uint64 reference_field_id_base = 6;
1432   if (cached_has_bits & 0x00000004u) {
1433     target = stream->EnsureSpace(target);
1434     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(6, this->_internal_reference_field_id_base(), target);
1435   }
1436 
1437   // uint64 id_delta = 7;
1438   if (_internal_has_id_delta()) {
1439     target = stream->EnsureSpace(target);
1440     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(7, this->_internal_id_delta(), target);
1441   }
1442 
1443   // optional int64 native_allocation_registry_size_field = 8;
1444   if (cached_has_bits & 0x00000008u) {
1445     target = stream->EnsureSpace(target);
1446     target = ::_pbi::WireFormatLite::WriteInt64ToArray(8, this->_internal_native_allocation_registry_size_field(), target);
1447   }
1448 
1449   // optional .perfetto.protos.HeapGraphObject.HeapType heap_type_delta = 9;
1450   if (cached_has_bits & 0x00000010u) {
1451     target = stream->EnsureSpace(target);
1452     target = ::_pbi::WireFormatLite::WriteEnumToArray(
1453       9, this->_internal_heap_type_delta(), target);
1454   }
1455 
1456   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
1457     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
1458         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
1459   }
1460   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.HeapGraphObject)
1461   return target;
1462 }
1463 
ByteSizeLong() const1464 size_t HeapGraphObject::ByteSizeLong() const {
1465 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.HeapGraphObject)
1466   size_t total_size = 0;
1467 
1468   ::uint32_t cached_has_bits = 0;
1469   // Prevent compiler warnings about cached_has_bits being unused
1470   (void) cached_has_bits;
1471 
1472   // repeated uint64 reference_field_id = 4 [packed = true];
1473   {
1474     size_t data_size = ::_pbi::WireFormatLite::
1475       UInt64Size(this->_impl_.reference_field_id_);
1476     if (data_size > 0) {
1477       total_size += 1 +
1478         ::_pbi::WireFormatLite::Int32Size(static_cast<::int32_t>(data_size));
1479     }
1480     int cached_size = ::_pbi::ToCachedSize(data_size);
1481     _impl_._reference_field_id_cached_byte_size_.store(cached_size,
1482                                     std::memory_order_relaxed);
1483     total_size += data_size;
1484   }
1485 
1486   // repeated uint64 reference_object_id = 5 [packed = true];
1487   {
1488     size_t data_size = ::_pbi::WireFormatLite::
1489       UInt64Size(this->_impl_.reference_object_id_);
1490     if (data_size > 0) {
1491       total_size += 1 +
1492         ::_pbi::WireFormatLite::Int32Size(static_cast<::int32_t>(data_size));
1493     }
1494     int cached_size = ::_pbi::ToCachedSize(data_size);
1495     _impl_._reference_object_id_cached_byte_size_.store(cached_size,
1496                                     std::memory_order_relaxed);
1497     total_size += data_size;
1498   }
1499 
1500   cached_has_bits = _impl_._has_bits_[0];
1501   if (cached_has_bits & 0x0000001fu) {
1502     // optional uint64 type_id = 2;
1503     if (cached_has_bits & 0x00000001u) {
1504       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_type_id());
1505     }
1506 
1507     // optional uint64 self_size = 3;
1508     if (cached_has_bits & 0x00000002u) {
1509       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_self_size());
1510     }
1511 
1512     // optional uint64 reference_field_id_base = 6;
1513     if (cached_has_bits & 0x00000004u) {
1514       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_reference_field_id_base());
1515     }
1516 
1517     // optional int64 native_allocation_registry_size_field = 8;
1518     if (cached_has_bits & 0x00000008u) {
1519       total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_native_allocation_registry_size_field());
1520     }
1521 
1522     // optional .perfetto.protos.HeapGraphObject.HeapType heap_type_delta = 9;
1523     if (cached_has_bits & 0x00000010u) {
1524       total_size += 1 +
1525         ::_pbi::WireFormatLite::EnumSize(this->_internal_heap_type_delta());
1526     }
1527 
1528   }
1529   switch (identifier_case()) {
1530     // uint64 id = 1;
1531     case kId: {
1532       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_id());
1533       break;
1534     }
1535     // uint64 id_delta = 7;
1536     case kIdDelta: {
1537       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_id_delta());
1538       break;
1539     }
1540     case IDENTIFIER_NOT_SET: {
1541       break;
1542     }
1543   }
1544   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
1545     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
1546   }
1547   int cached_size = ::_pbi::ToCachedSize(total_size);
1548   SetCachedSize(cached_size);
1549   return total_size;
1550 }
1551 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)1552 void HeapGraphObject::CheckTypeAndMergeFrom(
1553     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
1554   MergeFrom(*::_pbi::DownCast<const HeapGraphObject*>(
1555       &from));
1556 }
1557 
MergeFrom(const HeapGraphObject & from)1558 void HeapGraphObject::MergeFrom(const HeapGraphObject& from) {
1559   HeapGraphObject* const _this = this;
1560   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.HeapGraphObject)
1561   GOOGLE_DCHECK_NE(&from, _this);
1562   ::uint32_t cached_has_bits = 0;
1563   (void) cached_has_bits;
1564 
1565   _this->_impl_.reference_field_id_.MergeFrom(from._impl_.reference_field_id_);
1566   _this->_impl_.reference_object_id_.MergeFrom(from._impl_.reference_object_id_);
1567   cached_has_bits = from._impl_._has_bits_[0];
1568   if (cached_has_bits & 0x0000001fu) {
1569     if (cached_has_bits & 0x00000001u) {
1570       _this->_impl_.type_id_ = from._impl_.type_id_;
1571     }
1572     if (cached_has_bits & 0x00000002u) {
1573       _this->_impl_.self_size_ = from._impl_.self_size_;
1574     }
1575     if (cached_has_bits & 0x00000004u) {
1576       _this->_impl_.reference_field_id_base_ = from._impl_.reference_field_id_base_;
1577     }
1578     if (cached_has_bits & 0x00000008u) {
1579       _this->_impl_.native_allocation_registry_size_field_ = from._impl_.native_allocation_registry_size_field_;
1580     }
1581     if (cached_has_bits & 0x00000010u) {
1582       _this->_impl_.heap_type_delta_ = from._impl_.heap_type_delta_;
1583     }
1584     _this->_impl_._has_bits_[0] |= cached_has_bits;
1585   }
1586   switch (from.identifier_case()) {
1587     case kId: {
1588       _this->_internal_set_id(from._internal_id());
1589       break;
1590     }
1591     case kIdDelta: {
1592       _this->_internal_set_id_delta(from._internal_id_delta());
1593       break;
1594     }
1595     case IDENTIFIER_NOT_SET: {
1596       break;
1597     }
1598   }
1599   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
1600 }
1601 
CopyFrom(const HeapGraphObject & from)1602 void HeapGraphObject::CopyFrom(const HeapGraphObject& from) {
1603 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.HeapGraphObject)
1604   if (&from == this) return;
1605   Clear();
1606   MergeFrom(from);
1607 }
1608 
IsInitialized() const1609 bool HeapGraphObject::IsInitialized() const {
1610   return true;
1611 }
1612 
InternalSwap(HeapGraphObject * other)1613 void HeapGraphObject::InternalSwap(HeapGraphObject* other) {
1614   using std::swap;
1615   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
1616   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
1617   _impl_.reference_field_id_.InternalSwap(&other->_impl_.reference_field_id_);
1618   _impl_.reference_object_id_.InternalSwap(&other->_impl_.reference_object_id_);
1619   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
1620       PROTOBUF_FIELD_OFFSET(HeapGraphObject, _impl_.heap_type_delta_)
1621       + sizeof(HeapGraphObject::_impl_.heap_type_delta_)  // NOLINT
1622       - PROTOBUF_FIELD_OFFSET(HeapGraphObject, _impl_.type_id_)>(
1623           reinterpret_cast<char*>(&_impl_.type_id_),
1624           reinterpret_cast<char*>(&other->_impl_.type_id_));
1625   swap(_impl_.identifier_, other->_impl_.identifier_);
1626   swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
1627 }
1628 
GetTypeName() const1629 std::string HeapGraphObject::GetTypeName() const {
1630   return "perfetto.protos.HeapGraphObject";
1631 }
1632 
1633 
1634 // ===================================================================
1635 
1636 class HeapGraph::_Internal {
1637  public:
1638   using HasBits = decltype(std::declval<HeapGraph>()._impl_._has_bits_);
set_has_pid(HasBits * has_bits)1639   static void set_has_pid(HasBits* has_bits) {
1640     (*has_bits)[0] |= 1u;
1641   }
set_has_continued(HasBits * has_bits)1642   static void set_has_continued(HasBits* has_bits) {
1643     (*has_bits)[0] |= 2u;
1644   }
set_has_index(HasBits * has_bits)1645   static void set_has_index(HasBits* has_bits) {
1646     (*has_bits)[0] |= 4u;
1647   }
1648 };
1649 
clear_field_names()1650 void HeapGraph::clear_field_names() {
1651   _impl_.field_names_.Clear();
1652 }
clear_location_names()1653 void HeapGraph::clear_location_names() {
1654   _impl_.location_names_.Clear();
1655 }
HeapGraph(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)1656 HeapGraph::HeapGraph(::PROTOBUF_NAMESPACE_ID::Arena* arena,
1657                          bool is_message_owned)
1658   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
1659   SharedCtor(arena, is_message_owned);
1660   // @@protoc_insertion_point(arena_constructor:perfetto.protos.HeapGraph)
1661 }
HeapGraph(const HeapGraph & from)1662 HeapGraph::HeapGraph(const HeapGraph& from)
1663   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
1664   HeapGraph* const _this = this; (void)_this;
1665   new (&_impl_) Impl_{
1666       decltype(_impl_._has_bits_){from._impl_._has_bits_}
1667     , /*decltype(_impl_._cached_size_)*/{}
1668     , decltype(_impl_.objects_){from._impl_.objects_}
1669     , decltype(_impl_.field_names_){from._impl_.field_names_}
1670     , decltype(_impl_.roots_){from._impl_.roots_}
1671     , decltype(_impl_.location_names_){from._impl_.location_names_}
1672     , decltype(_impl_.types_){from._impl_.types_}
1673     , decltype(_impl_.pid_){}
1674     , decltype(_impl_.continued_){}
1675     , decltype(_impl_.index_){}};
1676 
1677   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
1678   ::memcpy(&_impl_.pid_, &from._impl_.pid_,
1679     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.index_) -
1680     reinterpret_cast<char*>(&_impl_.pid_)) + sizeof(_impl_.index_));
1681   // @@protoc_insertion_point(copy_constructor:perfetto.protos.HeapGraph)
1682 }
1683 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)1684 inline void HeapGraph::SharedCtor(
1685     ::_pb::Arena* arena, bool is_message_owned) {
1686   (void)arena;
1687   (void)is_message_owned;
1688   new (&_impl_) Impl_{
1689       decltype(_impl_._has_bits_){}
1690     , /*decltype(_impl_._cached_size_)*/{}
1691     , decltype(_impl_.objects_){arena}
1692     , decltype(_impl_.field_names_){arena}
1693     , decltype(_impl_.roots_){arena}
1694     , decltype(_impl_.location_names_){arena}
1695     , decltype(_impl_.types_){arena}
1696     , decltype(_impl_.pid_){0}
1697     , decltype(_impl_.continued_){false}
1698     , decltype(_impl_.index_){::uint64_t{0u}}
1699   };
1700 }
1701 
~HeapGraph()1702 HeapGraph::~HeapGraph() {
1703   // @@protoc_insertion_point(destructor:perfetto.protos.HeapGraph)
1704   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
1705   (void)arena;
1706     return;
1707   }
1708   SharedDtor();
1709 }
1710 
SharedDtor()1711 inline void HeapGraph::SharedDtor() {
1712   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
1713   _impl_.objects_.~RepeatedPtrField();
1714   _impl_.field_names_.~RepeatedPtrField();
1715   _impl_.roots_.~RepeatedPtrField();
1716   _impl_.location_names_.~RepeatedPtrField();
1717   _impl_.types_.~RepeatedPtrField();
1718 }
1719 
SetCachedSize(int size) const1720 void HeapGraph::SetCachedSize(int size) const {
1721   _impl_._cached_size_.Set(size);
1722 }
1723 
Clear()1724 void HeapGraph::Clear() {
1725 // @@protoc_insertion_point(message_clear_start:perfetto.protos.HeapGraph)
1726   ::uint32_t cached_has_bits = 0;
1727   // Prevent compiler warnings about cached_has_bits being unused
1728   (void) cached_has_bits;
1729 
1730   _impl_.objects_.Clear();
1731   _impl_.field_names_.Clear();
1732   _impl_.roots_.Clear();
1733   _impl_.location_names_.Clear();
1734   _impl_.types_.Clear();
1735   cached_has_bits = _impl_._has_bits_[0];
1736   if (cached_has_bits & 0x00000007u) {
1737     ::memset(&_impl_.pid_, 0, static_cast<size_t>(
1738         reinterpret_cast<char*>(&_impl_.index_) -
1739         reinterpret_cast<char*>(&_impl_.pid_)) + sizeof(_impl_.index_));
1740   }
1741   _impl_._has_bits_.Clear();
1742   _internal_metadata_.Clear<std::string>();
1743 }
1744 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)1745 const char* HeapGraph::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
1746 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
1747   _Internal::HasBits has_bits{};
1748   while (!ctx->Done(&ptr)) {
1749     ::uint32_t tag;
1750     ptr = ::_pbi::ReadTag(ptr, &tag);
1751     switch (tag >> 3) {
1752       // optional int32 pid = 1;
1753       case 1:
1754         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
1755           _Internal::set_has_pid(&has_bits);
1756           _impl_.pid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
1757           CHK_(ptr);
1758         } else {
1759           goto handle_unusual;
1760         }
1761         continue;
1762       // repeated .perfetto.protos.HeapGraphObject objects = 2;
1763       case 2:
1764         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 18)) {
1765           ptr -= 1;
1766           do {
1767             ptr += 1;
1768             ptr = ctx->ParseMessage(_internal_add_objects(), ptr);
1769             CHK_(ptr);
1770             if (!ctx->DataAvailable(ptr)) break;
1771           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
1772         } else {
1773           goto handle_unusual;
1774         }
1775         continue;
1776       // repeated .perfetto.protos.InternedString field_names = 4;
1777       case 4:
1778         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 34)) {
1779           ptr -= 1;
1780           do {
1781             ptr += 1;
1782             ptr = ctx->ParseMessage(_internal_add_field_names(), ptr);
1783             CHK_(ptr);
1784             if (!ctx->DataAvailable(ptr)) break;
1785           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr));
1786         } else {
1787           goto handle_unusual;
1788         }
1789         continue;
1790       // optional bool continued = 5;
1791       case 5:
1792         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 40)) {
1793           _Internal::set_has_continued(&has_bits);
1794           _impl_.continued_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1795           CHK_(ptr);
1796         } else {
1797           goto handle_unusual;
1798         }
1799         continue;
1800       // optional uint64 index = 6;
1801       case 6:
1802         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 48)) {
1803           _Internal::set_has_index(&has_bits);
1804           _impl_.index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
1805           CHK_(ptr);
1806         } else {
1807           goto handle_unusual;
1808         }
1809         continue;
1810       // repeated .perfetto.protos.HeapGraphRoot roots = 7;
1811       case 7:
1812         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 58)) {
1813           ptr -= 1;
1814           do {
1815             ptr += 1;
1816             ptr = ctx->ParseMessage(_internal_add_roots(), ptr);
1817             CHK_(ptr);
1818             if (!ctx->DataAvailable(ptr)) break;
1819           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<58>(ptr));
1820         } else {
1821           goto handle_unusual;
1822         }
1823         continue;
1824       // repeated .perfetto.protos.InternedString location_names = 8;
1825       case 8:
1826         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 66)) {
1827           ptr -= 1;
1828           do {
1829             ptr += 1;
1830             ptr = ctx->ParseMessage(_internal_add_location_names(), ptr);
1831             CHK_(ptr);
1832             if (!ctx->DataAvailable(ptr)) break;
1833           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<66>(ptr));
1834         } else {
1835           goto handle_unusual;
1836         }
1837         continue;
1838       // repeated .perfetto.protos.HeapGraphType types = 9;
1839       case 9:
1840         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 74)) {
1841           ptr -= 1;
1842           do {
1843             ptr += 1;
1844             ptr = ctx->ParseMessage(_internal_add_types(), ptr);
1845             CHK_(ptr);
1846             if (!ctx->DataAvailable(ptr)) break;
1847           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<74>(ptr));
1848         } else {
1849           goto handle_unusual;
1850         }
1851         continue;
1852       default:
1853         goto handle_unusual;
1854     }  // switch
1855   handle_unusual:
1856     if ((tag == 0) || ((tag & 7) == 4)) {
1857       CHK_(ptr);
1858       ctx->SetLastTag(tag);
1859       goto message_done;
1860     }
1861     ptr = UnknownFieldParse(
1862         tag,
1863         _internal_metadata_.mutable_unknown_fields<std::string>(),
1864         ptr, ctx);
1865     CHK_(ptr != nullptr);
1866   }  // while
1867 message_done:
1868   _impl_._has_bits_.Or(has_bits);
1869   return ptr;
1870 failure:
1871   ptr = nullptr;
1872   goto message_done;
1873 #undef CHK_
1874 }
1875 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const1876 ::uint8_t* HeapGraph::_InternalSerialize(
1877     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
1878   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.HeapGraph)
1879   ::uint32_t cached_has_bits = 0;
1880   (void) cached_has_bits;
1881 
1882   cached_has_bits = _impl_._has_bits_[0];
1883   // optional int32 pid = 1;
1884   if (cached_has_bits & 0x00000001u) {
1885     target = stream->EnsureSpace(target);
1886     target = ::_pbi::WireFormatLite::WriteInt32ToArray(1, this->_internal_pid(), target);
1887   }
1888 
1889   // repeated .perfetto.protos.HeapGraphObject objects = 2;
1890   for (unsigned i = 0,
1891       n = static_cast<unsigned>(this->_internal_objects_size()); i < n; i++) {
1892     const auto& repfield = this->_internal_objects(i);
1893     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1894         InternalWriteMessage(2, repfield, repfield.GetCachedSize(), target, stream);
1895   }
1896 
1897   // repeated .perfetto.protos.InternedString field_names = 4;
1898   for (unsigned i = 0,
1899       n = static_cast<unsigned>(this->_internal_field_names_size()); i < n; i++) {
1900     const auto& repfield = this->_internal_field_names(i);
1901     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1902         InternalWriteMessage(4, repfield, repfield.GetCachedSize(), target, stream);
1903   }
1904 
1905   // optional bool continued = 5;
1906   if (cached_has_bits & 0x00000002u) {
1907     target = stream->EnsureSpace(target);
1908     target = ::_pbi::WireFormatLite::WriteBoolToArray(5, this->_internal_continued(), target);
1909   }
1910 
1911   // optional uint64 index = 6;
1912   if (cached_has_bits & 0x00000004u) {
1913     target = stream->EnsureSpace(target);
1914     target = ::_pbi::WireFormatLite::WriteUInt64ToArray(6, this->_internal_index(), target);
1915   }
1916 
1917   // repeated .perfetto.protos.HeapGraphRoot roots = 7;
1918   for (unsigned i = 0,
1919       n = static_cast<unsigned>(this->_internal_roots_size()); i < n; i++) {
1920     const auto& repfield = this->_internal_roots(i);
1921     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1922         InternalWriteMessage(7, repfield, repfield.GetCachedSize(), target, stream);
1923   }
1924 
1925   // repeated .perfetto.protos.InternedString location_names = 8;
1926   for (unsigned i = 0,
1927       n = static_cast<unsigned>(this->_internal_location_names_size()); i < n; i++) {
1928     const auto& repfield = this->_internal_location_names(i);
1929     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1930         InternalWriteMessage(8, repfield, repfield.GetCachedSize(), target, stream);
1931   }
1932 
1933   // repeated .perfetto.protos.HeapGraphType types = 9;
1934   for (unsigned i = 0,
1935       n = static_cast<unsigned>(this->_internal_types_size()); i < n; i++) {
1936     const auto& repfield = this->_internal_types(i);
1937     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
1938         InternalWriteMessage(9, repfield, repfield.GetCachedSize(), target, stream);
1939   }
1940 
1941   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
1942     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
1943         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
1944   }
1945   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.HeapGraph)
1946   return target;
1947 }
1948 
ByteSizeLong() const1949 size_t HeapGraph::ByteSizeLong() const {
1950 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.HeapGraph)
1951   size_t total_size = 0;
1952 
1953   ::uint32_t cached_has_bits = 0;
1954   // Prevent compiler warnings about cached_has_bits being unused
1955   (void) cached_has_bits;
1956 
1957   // repeated .perfetto.protos.HeapGraphObject objects = 2;
1958   total_size += 1UL * this->_internal_objects_size();
1959   for (const auto& msg : this->_impl_.objects_) {
1960     total_size +=
1961       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
1962   }
1963 
1964   // repeated .perfetto.protos.InternedString field_names = 4;
1965   total_size += 1UL * this->_internal_field_names_size();
1966   for (const auto& msg : this->_impl_.field_names_) {
1967     total_size +=
1968       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
1969   }
1970 
1971   // repeated .perfetto.protos.HeapGraphRoot roots = 7;
1972   total_size += 1UL * this->_internal_roots_size();
1973   for (const auto& msg : this->_impl_.roots_) {
1974     total_size +=
1975       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
1976   }
1977 
1978   // repeated .perfetto.protos.InternedString location_names = 8;
1979   total_size += 1UL * this->_internal_location_names_size();
1980   for (const auto& msg : this->_impl_.location_names_) {
1981     total_size +=
1982       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
1983   }
1984 
1985   // repeated .perfetto.protos.HeapGraphType types = 9;
1986   total_size += 1UL * this->_internal_types_size();
1987   for (const auto& msg : this->_impl_.types_) {
1988     total_size +=
1989       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
1990   }
1991 
1992   cached_has_bits = _impl_._has_bits_[0];
1993   if (cached_has_bits & 0x00000007u) {
1994     // optional int32 pid = 1;
1995     if (cached_has_bits & 0x00000001u) {
1996       total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_pid());
1997     }
1998 
1999     // optional bool continued = 5;
2000     if (cached_has_bits & 0x00000002u) {
2001       total_size += 1 + 1;
2002     }
2003 
2004     // optional uint64 index = 6;
2005     if (cached_has_bits & 0x00000004u) {
2006       total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_index());
2007     }
2008 
2009   }
2010   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
2011     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
2012   }
2013   int cached_size = ::_pbi::ToCachedSize(total_size);
2014   SetCachedSize(cached_size);
2015   return total_size;
2016 }
2017 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)2018 void HeapGraph::CheckTypeAndMergeFrom(
2019     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
2020   MergeFrom(*::_pbi::DownCast<const HeapGraph*>(
2021       &from));
2022 }
2023 
MergeFrom(const HeapGraph & from)2024 void HeapGraph::MergeFrom(const HeapGraph& from) {
2025   HeapGraph* const _this = this;
2026   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.HeapGraph)
2027   GOOGLE_DCHECK_NE(&from, _this);
2028   ::uint32_t cached_has_bits = 0;
2029   (void) cached_has_bits;
2030 
2031   _this->_impl_.objects_.MergeFrom(from._impl_.objects_);
2032   _this->_impl_.field_names_.MergeFrom(from._impl_.field_names_);
2033   _this->_impl_.roots_.MergeFrom(from._impl_.roots_);
2034   _this->_impl_.location_names_.MergeFrom(from._impl_.location_names_);
2035   _this->_impl_.types_.MergeFrom(from._impl_.types_);
2036   cached_has_bits = from._impl_._has_bits_[0];
2037   if (cached_has_bits & 0x00000007u) {
2038     if (cached_has_bits & 0x00000001u) {
2039       _this->_impl_.pid_ = from._impl_.pid_;
2040     }
2041     if (cached_has_bits & 0x00000002u) {
2042       _this->_impl_.continued_ = from._impl_.continued_;
2043     }
2044     if (cached_has_bits & 0x00000004u) {
2045       _this->_impl_.index_ = from._impl_.index_;
2046     }
2047     _this->_impl_._has_bits_[0] |= cached_has_bits;
2048   }
2049   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
2050 }
2051 
CopyFrom(const HeapGraph & from)2052 void HeapGraph::CopyFrom(const HeapGraph& from) {
2053 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.HeapGraph)
2054   if (&from == this) return;
2055   Clear();
2056   MergeFrom(from);
2057 }
2058 
IsInitialized() const2059 bool HeapGraph::IsInitialized() const {
2060   return true;
2061 }
2062 
InternalSwap(HeapGraph * other)2063 void HeapGraph::InternalSwap(HeapGraph* other) {
2064   using std::swap;
2065   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
2066   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
2067   _impl_.objects_.InternalSwap(&other->_impl_.objects_);
2068   _impl_.field_names_.InternalSwap(&other->_impl_.field_names_);
2069   _impl_.roots_.InternalSwap(&other->_impl_.roots_);
2070   _impl_.location_names_.InternalSwap(&other->_impl_.location_names_);
2071   _impl_.types_.InternalSwap(&other->_impl_.types_);
2072   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
2073       PROTOBUF_FIELD_OFFSET(HeapGraph, _impl_.index_)
2074       + sizeof(HeapGraph::_impl_.index_)  // NOLINT
2075       - PROTOBUF_FIELD_OFFSET(HeapGraph, _impl_.pid_)>(
2076           reinterpret_cast<char*>(&_impl_.pid_),
2077           reinterpret_cast<char*>(&other->_impl_.pid_));
2078 }
2079 
GetTypeName() const2080 std::string HeapGraph::GetTypeName() const {
2081   return "perfetto.protos.HeapGraph";
2082 }
2083 
2084 
2085 // @@protoc_insertion_point(namespace_scope)
2086 }  // namespace protos
2087 }  // namespace perfetto
2088 PROTOBUF_NAMESPACE_OPEN
2089 template<> PROTOBUF_NOINLINE ::perfetto::protos::HeapGraphRoot*
CreateMaybeMessage(Arena * arena)2090 Arena::CreateMaybeMessage< ::perfetto::protos::HeapGraphRoot >(Arena* arena) {
2091   return Arena::CreateMessageInternal< ::perfetto::protos::HeapGraphRoot >(arena);
2092 }
2093 template<> PROTOBUF_NOINLINE ::perfetto::protos::HeapGraphType*
CreateMaybeMessage(Arena * arena)2094 Arena::CreateMaybeMessage< ::perfetto::protos::HeapGraphType >(Arena* arena) {
2095   return Arena::CreateMessageInternal< ::perfetto::protos::HeapGraphType >(arena);
2096 }
2097 template<> PROTOBUF_NOINLINE ::perfetto::protos::HeapGraphObject*
CreateMaybeMessage(Arena * arena)2098 Arena::CreateMaybeMessage< ::perfetto::protos::HeapGraphObject >(Arena* arena) {
2099   return Arena::CreateMessageInternal< ::perfetto::protos::HeapGraphObject >(arena);
2100 }
2101 template<> PROTOBUF_NOINLINE ::perfetto::protos::HeapGraph*
CreateMaybeMessage(Arena * arena)2102 Arena::CreateMaybeMessage< ::perfetto::protos::HeapGraph >(Arena* arena) {
2103   return Arena::CreateMessageInternal< ::perfetto::protos::HeapGraph >(arena);
2104 }
2105 PROTOBUF_NAMESPACE_CLOSE
2106 
2107 // @@protoc_insertion_point(global_scope)
2108 #include <google/protobuf/port_undef.inc>
2109