1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: protos/perfetto/trace/gpu/gpu_counter_event.proto
3 
4 #include "protos/perfetto/trace/gpu/gpu_counter_event.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 {
GpuCounterEvent_GpuCounter(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR GpuCounterEvent_GpuCounter::GpuCounterEvent_GpuCounter(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.counter_id_)*/0u
28   , /*decltype(_impl_.value_)*/{}
29   , /*decltype(_impl_._oneof_case_)*/{}} {}
30 struct GpuCounterEvent_GpuCounterDefaultTypeInternal {
GpuCounterEvent_GpuCounterDefaultTypeInternalperfetto::protos::GpuCounterEvent_GpuCounterDefaultTypeInternal31   PROTOBUF_CONSTEXPR GpuCounterEvent_GpuCounterDefaultTypeInternal()
32       : _instance(::_pbi::ConstantInitialized{}) {}
~GpuCounterEvent_GpuCounterDefaultTypeInternalperfetto::protos::GpuCounterEvent_GpuCounterDefaultTypeInternal33   ~GpuCounterEvent_GpuCounterDefaultTypeInternal() {}
34   union {  // NOLINT(misc-non-private-member-variables-in-classes)
35     GpuCounterEvent_GpuCounter _instance;
36   };
37 };
38 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GpuCounterEvent_GpuCounterDefaultTypeInternal _GpuCounterEvent_GpuCounter_default_instance_;
GpuCounterEvent(::_pbi::ConstantInitialized)39 PROTOBUF_CONSTEXPR GpuCounterEvent::GpuCounterEvent(
40     ::_pbi::ConstantInitialized): _impl_{
41     /*decltype(_impl_._has_bits_)*/{}
42   , /*decltype(_impl_._cached_size_)*/{}
43   , /*decltype(_impl_.counters_)*/{}
44   , /*decltype(_impl_.counter_descriptor_)*/nullptr
45   , /*decltype(_impl_.gpu_id_)*/0} {}
46 struct GpuCounterEventDefaultTypeInternal {
GpuCounterEventDefaultTypeInternalperfetto::protos::GpuCounterEventDefaultTypeInternal47   PROTOBUF_CONSTEXPR GpuCounterEventDefaultTypeInternal()
48       : _instance(::_pbi::ConstantInitialized{}) {}
~GpuCounterEventDefaultTypeInternalperfetto::protos::GpuCounterEventDefaultTypeInternal49   ~GpuCounterEventDefaultTypeInternal() {}
50   union {  // NOLINT(misc-non-private-member-variables-in-classes)
51     GpuCounterEvent _instance;
52   };
53 };
54 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 GpuCounterEventDefaultTypeInternal _GpuCounterEvent_default_instance_;
55 }  // namespace protos
56 }  // namespace perfetto
57 namespace perfetto {
58 namespace protos {
59 
60 // ===================================================================
61 
62 class GpuCounterEvent_GpuCounter::_Internal {
63  public:
64   using HasBits = decltype(std::declval<GpuCounterEvent_GpuCounter>()._impl_._has_bits_);
set_has_counter_id(HasBits * has_bits)65   static void set_has_counter_id(HasBits* has_bits) {
66     (*has_bits)[0] |= 1u;
67   }
68 };
69 
GpuCounterEvent_GpuCounter(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)70 GpuCounterEvent_GpuCounter::GpuCounterEvent_GpuCounter(::PROTOBUF_NAMESPACE_ID::Arena* arena,
71                          bool is_message_owned)
72   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
73   SharedCtor(arena, is_message_owned);
74   // @@protoc_insertion_point(arena_constructor:perfetto.protos.GpuCounterEvent.GpuCounter)
75 }
GpuCounterEvent_GpuCounter(const GpuCounterEvent_GpuCounter & from)76 GpuCounterEvent_GpuCounter::GpuCounterEvent_GpuCounter(const GpuCounterEvent_GpuCounter& from)
77   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
78   GpuCounterEvent_GpuCounter* const _this = this; (void)_this;
79   new (&_impl_) Impl_{
80       decltype(_impl_._has_bits_){from._impl_._has_bits_}
81     , /*decltype(_impl_._cached_size_)*/{}
82     , decltype(_impl_.counter_id_){}
83     , decltype(_impl_.value_){}
84     , /*decltype(_impl_._oneof_case_)*/{}};
85 
86   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
87   _this->_impl_.counter_id_ = from._impl_.counter_id_;
88   clear_has_value();
89   switch (from.value_case()) {
90     case kIntValue: {
91       _this->_internal_set_int_value(from._internal_int_value());
92       break;
93     }
94     case kDoubleValue: {
95       _this->_internal_set_double_value(from._internal_double_value());
96       break;
97     }
98     case VALUE_NOT_SET: {
99       break;
100     }
101   }
102   // @@protoc_insertion_point(copy_constructor:perfetto.protos.GpuCounterEvent.GpuCounter)
103 }
104 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)105 inline void GpuCounterEvent_GpuCounter::SharedCtor(
106     ::_pb::Arena* arena, bool is_message_owned) {
107   (void)arena;
108   (void)is_message_owned;
109   new (&_impl_) Impl_{
110       decltype(_impl_._has_bits_){}
111     , /*decltype(_impl_._cached_size_)*/{}
112     , decltype(_impl_.counter_id_){0u}
113     , decltype(_impl_.value_){}
114     , /*decltype(_impl_._oneof_case_)*/{}
115   };
116   clear_has_value();
117 }
118 
~GpuCounterEvent_GpuCounter()119 GpuCounterEvent_GpuCounter::~GpuCounterEvent_GpuCounter() {
120   // @@protoc_insertion_point(destructor:perfetto.protos.GpuCounterEvent.GpuCounter)
121   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
122   (void)arena;
123     return;
124   }
125   SharedDtor();
126 }
127 
SharedDtor()128 inline void GpuCounterEvent_GpuCounter::SharedDtor() {
129   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
130   if (has_value()) {
131     clear_value();
132   }
133 }
134 
SetCachedSize(int size) const135 void GpuCounterEvent_GpuCounter::SetCachedSize(int size) const {
136   _impl_._cached_size_.Set(size);
137 }
138 
clear_value()139 void GpuCounterEvent_GpuCounter::clear_value() {
140 // @@protoc_insertion_point(one_of_clear_start:perfetto.protos.GpuCounterEvent.GpuCounter)
141   switch (value_case()) {
142     case kIntValue: {
143       // No need to clear
144       break;
145     }
146     case kDoubleValue: {
147       // No need to clear
148       break;
149     }
150     case VALUE_NOT_SET: {
151       break;
152     }
153   }
154   _impl_._oneof_case_[0] = VALUE_NOT_SET;
155 }
156 
157 
Clear()158 void GpuCounterEvent_GpuCounter::Clear() {
159 // @@protoc_insertion_point(message_clear_start:perfetto.protos.GpuCounterEvent.GpuCounter)
160   ::uint32_t cached_has_bits = 0;
161   // Prevent compiler warnings about cached_has_bits being unused
162   (void) cached_has_bits;
163 
164   _impl_.counter_id_ = 0u;
165   clear_value();
166   _impl_._has_bits_.Clear();
167   _internal_metadata_.Clear<std::string>();
168 }
169 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)170 const char* GpuCounterEvent_GpuCounter::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
171 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
172   _Internal::HasBits has_bits{};
173   while (!ctx->Done(&ptr)) {
174     ::uint32_t tag;
175     ptr = ::_pbi::ReadTag(ptr, &tag);
176     switch (tag >> 3) {
177       // optional uint32 counter_id = 1;
178       case 1:
179         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
180           _Internal::set_has_counter_id(&has_bits);
181           _impl_.counter_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
182           CHK_(ptr);
183         } else {
184           goto handle_unusual;
185         }
186         continue;
187       // int64 int_value = 2;
188       case 2:
189         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
190           _internal_set_int_value(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
191           CHK_(ptr);
192         } else {
193           goto handle_unusual;
194         }
195         continue;
196       // double double_value = 3;
197       case 3:
198         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 25)) {
199           _internal_set_double_value(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr));
200           ptr += sizeof(double);
201         } else {
202           goto handle_unusual;
203         }
204         continue;
205       default:
206         goto handle_unusual;
207     }  // switch
208   handle_unusual:
209     if ((tag == 0) || ((tag & 7) == 4)) {
210       CHK_(ptr);
211       ctx->SetLastTag(tag);
212       goto message_done;
213     }
214     ptr = UnknownFieldParse(
215         tag,
216         _internal_metadata_.mutable_unknown_fields<std::string>(),
217         ptr, ctx);
218     CHK_(ptr != nullptr);
219   }  // while
220 message_done:
221   _impl_._has_bits_.Or(has_bits);
222   return ptr;
223 failure:
224   ptr = nullptr;
225   goto message_done;
226 #undef CHK_
227 }
228 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const229 ::uint8_t* GpuCounterEvent_GpuCounter::_InternalSerialize(
230     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
231   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.GpuCounterEvent.GpuCounter)
232   ::uint32_t cached_has_bits = 0;
233   (void) cached_has_bits;
234 
235   cached_has_bits = _impl_._has_bits_[0];
236   // optional uint32 counter_id = 1;
237   if (cached_has_bits & 0x00000001u) {
238     target = stream->EnsureSpace(target);
239     target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_counter_id(), target);
240   }
241 
242   switch (value_case()) {
243     case kIntValue: {
244       target = stream->EnsureSpace(target);
245       target = ::_pbi::WireFormatLite::WriteInt64ToArray(2, this->_internal_int_value(), target);
246       break;
247     }
248     case kDoubleValue: {
249       target = stream->EnsureSpace(target);
250       target = ::_pbi::WireFormatLite::WriteDoubleToArray(3, this->_internal_double_value(), target);
251       break;
252     }
253     default: ;
254   }
255   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
256     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
257         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
258   }
259   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.GpuCounterEvent.GpuCounter)
260   return target;
261 }
262 
ByteSizeLong() const263 size_t GpuCounterEvent_GpuCounter::ByteSizeLong() const {
264 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.GpuCounterEvent.GpuCounter)
265   size_t total_size = 0;
266 
267   ::uint32_t cached_has_bits = 0;
268   // Prevent compiler warnings about cached_has_bits being unused
269   (void) cached_has_bits;
270 
271   // optional uint32 counter_id = 1;
272   cached_has_bits = _impl_._has_bits_[0];
273   if (cached_has_bits & 0x00000001u) {
274     total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_counter_id());
275   }
276 
277   switch (value_case()) {
278     // int64 int_value = 2;
279     case kIntValue: {
280       total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_int_value());
281       break;
282     }
283     // double double_value = 3;
284     case kDoubleValue: {
285       total_size += 1 + 8;
286       break;
287     }
288     case VALUE_NOT_SET: {
289       break;
290     }
291   }
292   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
293     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
294   }
295   int cached_size = ::_pbi::ToCachedSize(total_size);
296   SetCachedSize(cached_size);
297   return total_size;
298 }
299 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)300 void GpuCounterEvent_GpuCounter::CheckTypeAndMergeFrom(
301     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
302   MergeFrom(*::_pbi::DownCast<const GpuCounterEvent_GpuCounter*>(
303       &from));
304 }
305 
MergeFrom(const GpuCounterEvent_GpuCounter & from)306 void GpuCounterEvent_GpuCounter::MergeFrom(const GpuCounterEvent_GpuCounter& from) {
307   GpuCounterEvent_GpuCounter* const _this = this;
308   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.GpuCounterEvent.GpuCounter)
309   GOOGLE_DCHECK_NE(&from, _this);
310   ::uint32_t cached_has_bits = 0;
311   (void) cached_has_bits;
312 
313   if (from._internal_has_counter_id()) {
314     _this->_internal_set_counter_id(from._internal_counter_id());
315   }
316   switch (from.value_case()) {
317     case kIntValue: {
318       _this->_internal_set_int_value(from._internal_int_value());
319       break;
320     }
321     case kDoubleValue: {
322       _this->_internal_set_double_value(from._internal_double_value());
323       break;
324     }
325     case VALUE_NOT_SET: {
326       break;
327     }
328   }
329   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
330 }
331 
CopyFrom(const GpuCounterEvent_GpuCounter & from)332 void GpuCounterEvent_GpuCounter::CopyFrom(const GpuCounterEvent_GpuCounter& from) {
333 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.GpuCounterEvent.GpuCounter)
334   if (&from == this) return;
335   Clear();
336   MergeFrom(from);
337 }
338 
IsInitialized() const339 bool GpuCounterEvent_GpuCounter::IsInitialized() const {
340   return true;
341 }
342 
InternalSwap(GpuCounterEvent_GpuCounter * other)343 void GpuCounterEvent_GpuCounter::InternalSwap(GpuCounterEvent_GpuCounter* other) {
344   using std::swap;
345   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
346   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
347   swap(_impl_.counter_id_, other->_impl_.counter_id_);
348   swap(_impl_.value_, other->_impl_.value_);
349   swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
350 }
351 
GetTypeName() const352 std::string GpuCounterEvent_GpuCounter::GetTypeName() const {
353   return "perfetto.protos.GpuCounterEvent.GpuCounter";
354 }
355 
356 
357 // ===================================================================
358 
359 class GpuCounterEvent::_Internal {
360  public:
361   using HasBits = decltype(std::declval<GpuCounterEvent>()._impl_._has_bits_);
362   static const ::perfetto::protos::GpuCounterDescriptor& counter_descriptor(const GpuCounterEvent* msg);
set_has_counter_descriptor(HasBits * has_bits)363   static void set_has_counter_descriptor(HasBits* has_bits) {
364     (*has_bits)[0] |= 1u;
365   }
set_has_gpu_id(HasBits * has_bits)366   static void set_has_gpu_id(HasBits* has_bits) {
367     (*has_bits)[0] |= 2u;
368   }
369 };
370 
371 const ::perfetto::protos::GpuCounterDescriptor&
counter_descriptor(const GpuCounterEvent * msg)372 GpuCounterEvent::_Internal::counter_descriptor(const GpuCounterEvent* msg) {
373   return *msg->_impl_.counter_descriptor_;
374 }
clear_counter_descriptor()375 void GpuCounterEvent::clear_counter_descriptor() {
376   if (_impl_.counter_descriptor_ != nullptr) _impl_.counter_descriptor_->Clear();
377   _impl_._has_bits_[0] &= ~0x00000001u;
378 }
GpuCounterEvent(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)379 GpuCounterEvent::GpuCounterEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena,
380                          bool is_message_owned)
381   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
382   SharedCtor(arena, is_message_owned);
383   // @@protoc_insertion_point(arena_constructor:perfetto.protos.GpuCounterEvent)
384 }
GpuCounterEvent(const GpuCounterEvent & from)385 GpuCounterEvent::GpuCounterEvent(const GpuCounterEvent& from)
386   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
387   GpuCounterEvent* const _this = this; (void)_this;
388   new (&_impl_) Impl_{
389       decltype(_impl_._has_bits_){from._impl_._has_bits_}
390     , /*decltype(_impl_._cached_size_)*/{}
391     , decltype(_impl_.counters_){from._impl_.counters_}
392     , decltype(_impl_.counter_descriptor_){nullptr}
393     , decltype(_impl_.gpu_id_){}};
394 
395   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
396   if (from._internal_has_counter_descriptor()) {
397     _this->_impl_.counter_descriptor_ = new ::perfetto::protos::GpuCounterDescriptor(*from._impl_.counter_descriptor_);
398   }
399   _this->_impl_.gpu_id_ = from._impl_.gpu_id_;
400   // @@protoc_insertion_point(copy_constructor:perfetto.protos.GpuCounterEvent)
401 }
402 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)403 inline void GpuCounterEvent::SharedCtor(
404     ::_pb::Arena* arena, bool is_message_owned) {
405   (void)arena;
406   (void)is_message_owned;
407   new (&_impl_) Impl_{
408       decltype(_impl_._has_bits_){}
409     , /*decltype(_impl_._cached_size_)*/{}
410     , decltype(_impl_.counters_){arena}
411     , decltype(_impl_.counter_descriptor_){nullptr}
412     , decltype(_impl_.gpu_id_){0}
413   };
414 }
415 
~GpuCounterEvent()416 GpuCounterEvent::~GpuCounterEvent() {
417   // @@protoc_insertion_point(destructor:perfetto.protos.GpuCounterEvent)
418   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
419   (void)arena;
420     return;
421   }
422   SharedDtor();
423 }
424 
SharedDtor()425 inline void GpuCounterEvent::SharedDtor() {
426   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
427   _impl_.counters_.~RepeatedPtrField();
428   if (this != internal_default_instance()) delete _impl_.counter_descriptor_;
429 }
430 
SetCachedSize(int size) const431 void GpuCounterEvent::SetCachedSize(int size) const {
432   _impl_._cached_size_.Set(size);
433 }
434 
Clear()435 void GpuCounterEvent::Clear() {
436 // @@protoc_insertion_point(message_clear_start:perfetto.protos.GpuCounterEvent)
437   ::uint32_t cached_has_bits = 0;
438   // Prevent compiler warnings about cached_has_bits being unused
439   (void) cached_has_bits;
440 
441   _impl_.counters_.Clear();
442   cached_has_bits = _impl_._has_bits_[0];
443   if (cached_has_bits & 0x00000001u) {
444     GOOGLE_DCHECK(_impl_.counter_descriptor_ != nullptr);
445     _impl_.counter_descriptor_->Clear();
446   }
447   _impl_.gpu_id_ = 0;
448   _impl_._has_bits_.Clear();
449   _internal_metadata_.Clear<std::string>();
450 }
451 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)452 const char* GpuCounterEvent::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
453 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
454   _Internal::HasBits has_bits{};
455   while (!ctx->Done(&ptr)) {
456     ::uint32_t tag;
457     ptr = ::_pbi::ReadTag(ptr, &tag);
458     switch (tag >> 3) {
459       // optional .perfetto.protos.GpuCounterDescriptor counter_descriptor = 1;
460       case 1:
461         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 10)) {
462           ptr = ctx->ParseMessage(_internal_mutable_counter_descriptor(), ptr);
463           CHK_(ptr);
464         } else {
465           goto handle_unusual;
466         }
467         continue;
468       // repeated .perfetto.protos.GpuCounterEvent.GpuCounter counters = 2;
469       case 2:
470         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 18)) {
471           ptr -= 1;
472           do {
473             ptr += 1;
474             ptr = ctx->ParseMessage(_internal_add_counters(), ptr);
475             CHK_(ptr);
476             if (!ctx->DataAvailable(ptr)) break;
477           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
478         } else {
479           goto handle_unusual;
480         }
481         continue;
482       // optional int32 gpu_id = 3;
483       case 3:
484         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 24)) {
485           _Internal::set_has_gpu_id(&has_bits);
486           _impl_.gpu_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
487           CHK_(ptr);
488         } else {
489           goto handle_unusual;
490         }
491         continue;
492       default:
493         goto handle_unusual;
494     }  // switch
495   handle_unusual:
496     if ((tag == 0) || ((tag & 7) == 4)) {
497       CHK_(ptr);
498       ctx->SetLastTag(tag);
499       goto message_done;
500     }
501     ptr = UnknownFieldParse(
502         tag,
503         _internal_metadata_.mutable_unknown_fields<std::string>(),
504         ptr, ctx);
505     CHK_(ptr != nullptr);
506   }  // while
507 message_done:
508   _impl_._has_bits_.Or(has_bits);
509   return ptr;
510 failure:
511   ptr = nullptr;
512   goto message_done;
513 #undef CHK_
514 }
515 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const516 ::uint8_t* GpuCounterEvent::_InternalSerialize(
517     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
518   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.GpuCounterEvent)
519   ::uint32_t cached_has_bits = 0;
520   (void) cached_has_bits;
521 
522   cached_has_bits = _impl_._has_bits_[0];
523   // optional .perfetto.protos.GpuCounterDescriptor counter_descriptor = 1;
524   if (cached_has_bits & 0x00000001u) {
525     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
526       InternalWriteMessage(1, _Internal::counter_descriptor(this),
527         _Internal::counter_descriptor(this).GetCachedSize(), target, stream);
528   }
529 
530   // repeated .perfetto.protos.GpuCounterEvent.GpuCounter counters = 2;
531   for (unsigned i = 0,
532       n = static_cast<unsigned>(this->_internal_counters_size()); i < n; i++) {
533     const auto& repfield = this->_internal_counters(i);
534     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
535         InternalWriteMessage(2, repfield, repfield.GetCachedSize(), target, stream);
536   }
537 
538   // optional int32 gpu_id = 3;
539   if (cached_has_bits & 0x00000002u) {
540     target = stream->EnsureSpace(target);
541     target = ::_pbi::WireFormatLite::WriteInt32ToArray(3, this->_internal_gpu_id(), target);
542   }
543 
544   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
545     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
546         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
547   }
548   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.GpuCounterEvent)
549   return target;
550 }
551 
ByteSizeLong() const552 size_t GpuCounterEvent::ByteSizeLong() const {
553 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.GpuCounterEvent)
554   size_t total_size = 0;
555 
556   ::uint32_t cached_has_bits = 0;
557   // Prevent compiler warnings about cached_has_bits being unused
558   (void) cached_has_bits;
559 
560   // repeated .perfetto.protos.GpuCounterEvent.GpuCounter counters = 2;
561   total_size += 1UL * this->_internal_counters_size();
562   for (const auto& msg : this->_impl_.counters_) {
563     total_size +=
564       ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
565   }
566 
567   cached_has_bits = _impl_._has_bits_[0];
568   if (cached_has_bits & 0x00000003u) {
569     // optional .perfetto.protos.GpuCounterDescriptor counter_descriptor = 1;
570     if (cached_has_bits & 0x00000001u) {
571       total_size += 1 +
572         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
573           *_impl_.counter_descriptor_);
574     }
575 
576     // optional int32 gpu_id = 3;
577     if (cached_has_bits & 0x00000002u) {
578       total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_gpu_id());
579     }
580 
581   }
582   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
583     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
584   }
585   int cached_size = ::_pbi::ToCachedSize(total_size);
586   SetCachedSize(cached_size);
587   return total_size;
588 }
589 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)590 void GpuCounterEvent::CheckTypeAndMergeFrom(
591     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
592   MergeFrom(*::_pbi::DownCast<const GpuCounterEvent*>(
593       &from));
594 }
595 
MergeFrom(const GpuCounterEvent & from)596 void GpuCounterEvent::MergeFrom(const GpuCounterEvent& from) {
597   GpuCounterEvent* const _this = this;
598   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.GpuCounterEvent)
599   GOOGLE_DCHECK_NE(&from, _this);
600   ::uint32_t cached_has_bits = 0;
601   (void) cached_has_bits;
602 
603   _this->_impl_.counters_.MergeFrom(from._impl_.counters_);
604   cached_has_bits = from._impl_._has_bits_[0];
605   if (cached_has_bits & 0x00000003u) {
606     if (cached_has_bits & 0x00000001u) {
607       _this->_internal_mutable_counter_descriptor()->::perfetto::protos::GpuCounterDescriptor::MergeFrom(
608           from._internal_counter_descriptor());
609     }
610     if (cached_has_bits & 0x00000002u) {
611       _this->_impl_.gpu_id_ = from._impl_.gpu_id_;
612     }
613     _this->_impl_._has_bits_[0] |= cached_has_bits;
614   }
615   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
616 }
617 
CopyFrom(const GpuCounterEvent & from)618 void GpuCounterEvent::CopyFrom(const GpuCounterEvent& from) {
619 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.GpuCounterEvent)
620   if (&from == this) return;
621   Clear();
622   MergeFrom(from);
623 }
624 
IsInitialized() const625 bool GpuCounterEvent::IsInitialized() const {
626   return true;
627 }
628 
InternalSwap(GpuCounterEvent * other)629 void GpuCounterEvent::InternalSwap(GpuCounterEvent* other) {
630   using std::swap;
631   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
632   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
633   _impl_.counters_.InternalSwap(&other->_impl_.counters_);
634   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
635       PROTOBUF_FIELD_OFFSET(GpuCounterEvent, _impl_.gpu_id_)
636       + sizeof(GpuCounterEvent::_impl_.gpu_id_)  // NOLINT
637       - PROTOBUF_FIELD_OFFSET(GpuCounterEvent, _impl_.counter_descriptor_)>(
638           reinterpret_cast<char*>(&_impl_.counter_descriptor_),
639           reinterpret_cast<char*>(&other->_impl_.counter_descriptor_));
640 }
641 
GetTypeName() const642 std::string GpuCounterEvent::GetTypeName() const {
643   return "perfetto.protos.GpuCounterEvent";
644 }
645 
646 
647 // @@protoc_insertion_point(namespace_scope)
648 }  // namespace protos
649 }  // namespace perfetto
650 PROTOBUF_NAMESPACE_OPEN
651 template<> PROTOBUF_NOINLINE ::perfetto::protos::GpuCounterEvent_GpuCounter*
CreateMaybeMessage(Arena * arena)652 Arena::CreateMaybeMessage< ::perfetto::protos::GpuCounterEvent_GpuCounter >(Arena* arena) {
653   return Arena::CreateMessageInternal< ::perfetto::protos::GpuCounterEvent_GpuCounter >(arena);
654 }
655 template<> PROTOBUF_NOINLINE ::perfetto::protos::GpuCounterEvent*
CreateMaybeMessage(Arena * arena)656 Arena::CreateMaybeMessage< ::perfetto::protos::GpuCounterEvent >(Arena* arena) {
657   return Arena::CreateMessageInternal< ::perfetto::protos::GpuCounterEvent >(arena);
658 }
659 PROTOBUF_NAMESPACE_CLOSE
660 
661 // @@protoc_insertion_point(global_scope)
662 #include <google/protobuf/port_undef.inc>
663