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