1 // Generated by the protocol buffer compiler.  DO NOT EDIT!
2 // source: protos/perfetto/trace/track_event/thread_descriptor.proto
3 
4 #include "protos/perfetto/trace/track_event/thread_descriptor.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 {
ThreadDescriptor(::_pbi::ConstantInitialized)23 PROTOBUF_CONSTEXPR ThreadDescriptor::ThreadDescriptor(
24     ::_pbi::ConstantInitialized): _impl_{
25     /*decltype(_impl_._has_bits_)*/{}
26   , /*decltype(_impl_._cached_size_)*/{}
27   , /*decltype(_impl_.thread_name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
28   , /*decltype(_impl_.pid_)*/0
29   , /*decltype(_impl_.tid_)*/0
30   , /*decltype(_impl_.legacy_sort_index_)*/0
31   , /*decltype(_impl_.chrome_thread_type_)*/0
32   , /*decltype(_impl_.reference_timestamp_us_)*/::int64_t{0}
33   , /*decltype(_impl_.reference_thread_time_us_)*/::int64_t{0}
34   , /*decltype(_impl_.reference_thread_instruction_count_)*/::int64_t{0}} {}
35 struct ThreadDescriptorDefaultTypeInternal {
ThreadDescriptorDefaultTypeInternalperfetto::protos::ThreadDescriptorDefaultTypeInternal36   PROTOBUF_CONSTEXPR ThreadDescriptorDefaultTypeInternal()
37       : _instance(::_pbi::ConstantInitialized{}) {}
~ThreadDescriptorDefaultTypeInternalperfetto::protos::ThreadDescriptorDefaultTypeInternal38   ~ThreadDescriptorDefaultTypeInternal() {}
39   union {  // NOLINT(misc-non-private-member-variables-in-classes)
40     ThreadDescriptor _instance;
41   };
42 };
43 PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ThreadDescriptorDefaultTypeInternal _ThreadDescriptor_default_instance_;
44 }  // namespace protos
45 }  // namespace perfetto
46 namespace perfetto {
47 namespace protos {
ThreadDescriptor_ChromeThreadType_IsValid(int value)48 bool ThreadDescriptor_ChromeThreadType_IsValid(int value) {
49   switch (value) {
50     case 0:
51     case 1:
52     case 2:
53     case 3:
54     case 4:
55     case 5:
56     case 6:
57     case 7:
58     case 8:
59     case 9:
60     case 10:
61     case 11:
62     case 50:
63     case 51:
64       return true;
65     default:
66       return false;
67   }
68 }
69 
70 static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> ThreadDescriptor_ChromeThreadType_strings[14] = {};
71 
72 static const char ThreadDescriptor_ChromeThreadType_names[] =
73   "CHROME_THREAD_COMPOSITOR"
74   "CHROME_THREAD_COMPOSITOR_WORKER"
75   "CHROME_THREAD_IO"
76   "CHROME_THREAD_MAIN"
77   "CHROME_THREAD_MEMORY_INFRA"
78   "CHROME_THREAD_POOL_BG_BLOCKING"
79   "CHROME_THREAD_POOL_BG_WORKER"
80   "CHROME_THREAD_POOL_FB_BLOCKING"
81   "CHROME_THREAD_POOL_FG_WORKER"
82   "CHROME_THREAD_POOL_SERVICE"
83   "CHROME_THREAD_SAMPLING_PROFILER"
84   "CHROME_THREAD_SERVICE_WORKER"
85   "CHROME_THREAD_UNSPECIFIED"
86   "CHROME_THREAD_VIZ_COMPOSITOR";
87 
88 static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ThreadDescriptor_ChromeThreadType_entries[] = {
89   { {ThreadDescriptor_ChromeThreadType_names + 0, 24}, 8 },
90   { {ThreadDescriptor_ChromeThreadType_names + 24, 31}, 10 },
91   { {ThreadDescriptor_ChromeThreadType_names + 55, 16}, 2 },
92   { {ThreadDescriptor_ChromeThreadType_names + 71, 18}, 1 },
93   { {ThreadDescriptor_ChromeThreadType_names + 89, 26}, 50 },
94   { {ThreadDescriptor_ChromeThreadType_names + 115, 30}, 6 },
95   { {ThreadDescriptor_ChromeThreadType_names + 145, 28}, 3 },
96   { {ThreadDescriptor_ChromeThreadType_names + 173, 30}, 5 },
97   { {ThreadDescriptor_ChromeThreadType_names + 203, 28}, 4 },
98   { {ThreadDescriptor_ChromeThreadType_names + 231, 26}, 7 },
99   { {ThreadDescriptor_ChromeThreadType_names + 257, 31}, 51 },
100   { {ThreadDescriptor_ChromeThreadType_names + 288, 28}, 11 },
101   { {ThreadDescriptor_ChromeThreadType_names + 316, 25}, 0 },
102   { {ThreadDescriptor_ChromeThreadType_names + 341, 28}, 9 },
103 };
104 
105 static const int ThreadDescriptor_ChromeThreadType_entries_by_number[] = {
106   12, // 0 -> CHROME_THREAD_UNSPECIFIED
107   3, // 1 -> CHROME_THREAD_MAIN
108   2, // 2 -> CHROME_THREAD_IO
109   6, // 3 -> CHROME_THREAD_POOL_BG_WORKER
110   8, // 4 -> CHROME_THREAD_POOL_FG_WORKER
111   7, // 5 -> CHROME_THREAD_POOL_FB_BLOCKING
112   5, // 6 -> CHROME_THREAD_POOL_BG_BLOCKING
113   9, // 7 -> CHROME_THREAD_POOL_SERVICE
114   0, // 8 -> CHROME_THREAD_COMPOSITOR
115   13, // 9 -> CHROME_THREAD_VIZ_COMPOSITOR
116   1, // 10 -> CHROME_THREAD_COMPOSITOR_WORKER
117   11, // 11 -> CHROME_THREAD_SERVICE_WORKER
118   4, // 50 -> CHROME_THREAD_MEMORY_INFRA
119   10, // 51 -> CHROME_THREAD_SAMPLING_PROFILER
120 };
121 
ThreadDescriptor_ChromeThreadType_Name(ThreadDescriptor_ChromeThreadType value)122 const std::string& ThreadDescriptor_ChromeThreadType_Name(
123     ThreadDescriptor_ChromeThreadType value) {
124   static const bool dummy =
125       ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
126           ThreadDescriptor_ChromeThreadType_entries,
127           ThreadDescriptor_ChromeThreadType_entries_by_number,
128           14, ThreadDescriptor_ChromeThreadType_strings);
129   (void) dummy;
130   int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
131       ThreadDescriptor_ChromeThreadType_entries,
132       ThreadDescriptor_ChromeThreadType_entries_by_number,
133       14, value);
134   return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
135                      ThreadDescriptor_ChromeThreadType_strings[idx].get();
136 }
ThreadDescriptor_ChromeThreadType_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name,ThreadDescriptor_ChromeThreadType * value)137 bool ThreadDescriptor_ChromeThreadType_Parse(
138     ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ThreadDescriptor_ChromeThreadType* value) {
139   int int_value;
140   bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
141       ThreadDescriptor_ChromeThreadType_entries, 14, name, &int_value);
142   if (success) {
143     *value = static_cast<ThreadDescriptor_ChromeThreadType>(int_value);
144   }
145   return success;
146 }
147 #if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
148 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_UNSPECIFIED;
149 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_MAIN;
150 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_IO;
151 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_BG_WORKER;
152 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_FG_WORKER;
153 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_FB_BLOCKING;
154 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_BG_BLOCKING;
155 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_POOL_SERVICE;
156 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_COMPOSITOR;
157 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_VIZ_COMPOSITOR;
158 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_COMPOSITOR_WORKER;
159 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_SERVICE_WORKER;
160 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_MEMORY_INFRA;
161 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::CHROME_THREAD_SAMPLING_PROFILER;
162 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::ChromeThreadType_MIN;
163 constexpr ThreadDescriptor_ChromeThreadType ThreadDescriptor::ChromeThreadType_MAX;
164 constexpr int ThreadDescriptor::ChromeThreadType_ARRAYSIZE;
165 #endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
166 
167 // ===================================================================
168 
169 class ThreadDescriptor::_Internal {
170  public:
171   using HasBits = decltype(std::declval<ThreadDescriptor>()._impl_._has_bits_);
set_has_pid(HasBits * has_bits)172   static void set_has_pid(HasBits* has_bits) {
173     (*has_bits)[0] |= 2u;
174   }
set_has_tid(HasBits * has_bits)175   static void set_has_tid(HasBits* has_bits) {
176     (*has_bits)[0] |= 4u;
177   }
set_has_thread_name(HasBits * has_bits)178   static void set_has_thread_name(HasBits* has_bits) {
179     (*has_bits)[0] |= 1u;
180   }
set_has_chrome_thread_type(HasBits * has_bits)181   static void set_has_chrome_thread_type(HasBits* has_bits) {
182     (*has_bits)[0] |= 16u;
183   }
set_has_reference_timestamp_us(HasBits * has_bits)184   static void set_has_reference_timestamp_us(HasBits* has_bits) {
185     (*has_bits)[0] |= 32u;
186   }
set_has_reference_thread_time_us(HasBits * has_bits)187   static void set_has_reference_thread_time_us(HasBits* has_bits) {
188     (*has_bits)[0] |= 64u;
189   }
set_has_reference_thread_instruction_count(HasBits * has_bits)190   static void set_has_reference_thread_instruction_count(HasBits* has_bits) {
191     (*has_bits)[0] |= 128u;
192   }
set_has_legacy_sort_index(HasBits * has_bits)193   static void set_has_legacy_sort_index(HasBits* has_bits) {
194     (*has_bits)[0] |= 8u;
195   }
196 };
197 
ThreadDescriptor(::PROTOBUF_NAMESPACE_ID::Arena * arena,bool is_message_owned)198 ThreadDescriptor::ThreadDescriptor(::PROTOBUF_NAMESPACE_ID::Arena* arena,
199                          bool is_message_owned)
200   : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
201   SharedCtor(arena, is_message_owned);
202   // @@protoc_insertion_point(arena_constructor:perfetto.protos.ThreadDescriptor)
203 }
ThreadDescriptor(const ThreadDescriptor & from)204 ThreadDescriptor::ThreadDescriptor(const ThreadDescriptor& from)
205   : ::PROTOBUF_NAMESPACE_ID::MessageLite() {
206   ThreadDescriptor* const _this = this; (void)_this;
207   new (&_impl_) Impl_{
208       decltype(_impl_._has_bits_){from._impl_._has_bits_}
209     , /*decltype(_impl_._cached_size_)*/{}
210     , decltype(_impl_.thread_name_){}
211     , decltype(_impl_.pid_){}
212     , decltype(_impl_.tid_){}
213     , decltype(_impl_.legacy_sort_index_){}
214     , decltype(_impl_.chrome_thread_type_){}
215     , decltype(_impl_.reference_timestamp_us_){}
216     , decltype(_impl_.reference_thread_time_us_){}
217     , decltype(_impl_.reference_thread_instruction_count_){}};
218 
219   _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
220   _impl_.thread_name_.InitDefault();
221   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
222     _impl_.thread_name_.Set("", GetArenaForAllocation());
223   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
224   if (from._internal_has_thread_name()) {
225     _this->_impl_.thread_name_.Set(from._internal_thread_name(),
226       _this->GetArenaForAllocation());
227   }
228   ::memcpy(&_impl_.pid_, &from._impl_.pid_,
229     static_cast<size_t>(reinterpret_cast<char*>(&_impl_.reference_thread_instruction_count_) -
230     reinterpret_cast<char*>(&_impl_.pid_)) + sizeof(_impl_.reference_thread_instruction_count_));
231   // @@protoc_insertion_point(copy_constructor:perfetto.protos.ThreadDescriptor)
232 }
233 
SharedCtor(::_pb::Arena * arena,bool is_message_owned)234 inline void ThreadDescriptor::SharedCtor(
235     ::_pb::Arena* arena, bool is_message_owned) {
236   (void)arena;
237   (void)is_message_owned;
238   new (&_impl_) Impl_{
239       decltype(_impl_._has_bits_){}
240     , /*decltype(_impl_._cached_size_)*/{}
241     , decltype(_impl_.thread_name_){}
242     , decltype(_impl_.pid_){0}
243     , decltype(_impl_.tid_){0}
244     , decltype(_impl_.legacy_sort_index_){0}
245     , decltype(_impl_.chrome_thread_type_){0}
246     , decltype(_impl_.reference_timestamp_us_){::int64_t{0}}
247     , decltype(_impl_.reference_thread_time_us_){::int64_t{0}}
248     , decltype(_impl_.reference_thread_instruction_count_){::int64_t{0}}
249   };
250   _impl_.thread_name_.InitDefault();
251   #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
252     _impl_.thread_name_.Set("", GetArenaForAllocation());
253   #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
254 }
255 
~ThreadDescriptor()256 ThreadDescriptor::~ThreadDescriptor() {
257   // @@protoc_insertion_point(destructor:perfetto.protos.ThreadDescriptor)
258   if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
259   (void)arena;
260     return;
261   }
262   SharedDtor();
263 }
264 
SharedDtor()265 inline void ThreadDescriptor::SharedDtor() {
266   GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
267   _impl_.thread_name_.Destroy();
268 }
269 
SetCachedSize(int size) const270 void ThreadDescriptor::SetCachedSize(int size) const {
271   _impl_._cached_size_.Set(size);
272 }
273 
Clear()274 void ThreadDescriptor::Clear() {
275 // @@protoc_insertion_point(message_clear_start:perfetto.protos.ThreadDescriptor)
276   ::uint32_t cached_has_bits = 0;
277   // Prevent compiler warnings about cached_has_bits being unused
278   (void) cached_has_bits;
279 
280   cached_has_bits = _impl_._has_bits_[0];
281   if (cached_has_bits & 0x00000001u) {
282     _impl_.thread_name_.ClearNonDefaultToEmpty();
283   }
284   if (cached_has_bits & 0x000000feu) {
285     ::memset(&_impl_.pid_, 0, static_cast<size_t>(
286         reinterpret_cast<char*>(&_impl_.reference_thread_instruction_count_) -
287         reinterpret_cast<char*>(&_impl_.pid_)) + sizeof(_impl_.reference_thread_instruction_count_));
288   }
289   _impl_._has_bits_.Clear();
290   _internal_metadata_.Clear<std::string>();
291 }
292 
_InternalParse(const char * ptr,::_pbi::ParseContext * ctx)293 const char* ThreadDescriptor::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
294 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
295   _Internal::HasBits has_bits{};
296   while (!ctx->Done(&ptr)) {
297     ::uint32_t tag;
298     ptr = ::_pbi::ReadTag(ptr, &tag);
299     switch (tag >> 3) {
300       // optional int32 pid = 1;
301       case 1:
302         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 8)) {
303           _Internal::set_has_pid(&has_bits);
304           _impl_.pid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
305           CHK_(ptr);
306         } else {
307           goto handle_unusual;
308         }
309         continue;
310       // optional int32 tid = 2;
311       case 2:
312         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 16)) {
313           _Internal::set_has_tid(&has_bits);
314           _impl_.tid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
315           CHK_(ptr);
316         } else {
317           goto handle_unusual;
318         }
319         continue;
320       // optional int32 legacy_sort_index = 3;
321       case 3:
322         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 24)) {
323           _Internal::set_has_legacy_sort_index(&has_bits);
324           _impl_.legacy_sort_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
325           CHK_(ptr);
326         } else {
327           goto handle_unusual;
328         }
329         continue;
330       // optional .perfetto.protos.ThreadDescriptor.ChromeThreadType chrome_thread_type = 4;
331       case 4:
332         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 32)) {
333           ::uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
334           CHK_(ptr);
335           if (PROTOBUF_PREDICT_TRUE(::perfetto::protos::ThreadDescriptor_ChromeThreadType_IsValid(val))) {
336             _internal_set_chrome_thread_type(static_cast<::perfetto::protos::ThreadDescriptor_ChromeThreadType>(val));
337           } else {
338             ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields());
339           }
340         } else {
341           goto handle_unusual;
342         }
343         continue;
344       // optional string thread_name = 5;
345       case 5:
346         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 42)) {
347           auto str = _internal_mutable_thread_name();
348           ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
349           CHK_(ptr);
350         } else {
351           goto handle_unusual;
352         }
353         continue;
354       // optional int64 reference_timestamp_us = 6;
355       case 6:
356         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 48)) {
357           _Internal::set_has_reference_timestamp_us(&has_bits);
358           _impl_.reference_timestamp_us_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
359           CHK_(ptr);
360         } else {
361           goto handle_unusual;
362         }
363         continue;
364       // optional int64 reference_thread_time_us = 7;
365       case 7:
366         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 56)) {
367           _Internal::set_has_reference_thread_time_us(&has_bits);
368           _impl_.reference_thread_time_us_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
369           CHK_(ptr);
370         } else {
371           goto handle_unusual;
372         }
373         continue;
374       // optional int64 reference_thread_instruction_count = 8;
375       case 8:
376         if (PROTOBUF_PREDICT_TRUE(static_cast<::uint8_t>(tag) == 64)) {
377           _Internal::set_has_reference_thread_instruction_count(&has_bits);
378           _impl_.reference_thread_instruction_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
379           CHK_(ptr);
380         } else {
381           goto handle_unusual;
382         }
383         continue;
384       default:
385         goto handle_unusual;
386     }  // switch
387   handle_unusual:
388     if ((tag == 0) || ((tag & 7) == 4)) {
389       CHK_(ptr);
390       ctx->SetLastTag(tag);
391       goto message_done;
392     }
393     ptr = UnknownFieldParse(
394         tag,
395         _internal_metadata_.mutable_unknown_fields<std::string>(),
396         ptr, ctx);
397     CHK_(ptr != nullptr);
398   }  // while
399 message_done:
400   _impl_._has_bits_.Or(has_bits);
401   return ptr;
402 failure:
403   ptr = nullptr;
404   goto message_done;
405 #undef CHK_
406 }
407 
_InternalSerialize(::uint8_t * target,::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream * stream) const408 ::uint8_t* ThreadDescriptor::_InternalSerialize(
409     ::uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
410   // @@protoc_insertion_point(serialize_to_array_start:perfetto.protos.ThreadDescriptor)
411   ::uint32_t cached_has_bits = 0;
412   (void) cached_has_bits;
413 
414   cached_has_bits = _impl_._has_bits_[0];
415   // optional int32 pid = 1;
416   if (cached_has_bits & 0x00000002u) {
417     target = stream->EnsureSpace(target);
418     target = ::_pbi::WireFormatLite::WriteInt32ToArray(1, this->_internal_pid(), target);
419   }
420 
421   // optional int32 tid = 2;
422   if (cached_has_bits & 0x00000004u) {
423     target = stream->EnsureSpace(target);
424     target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_tid(), target);
425   }
426 
427   // optional int32 legacy_sort_index = 3;
428   if (cached_has_bits & 0x00000008u) {
429     target = stream->EnsureSpace(target);
430     target = ::_pbi::WireFormatLite::WriteInt32ToArray(3, this->_internal_legacy_sort_index(), target);
431   }
432 
433   // optional .perfetto.protos.ThreadDescriptor.ChromeThreadType chrome_thread_type = 4;
434   if (cached_has_bits & 0x00000010u) {
435     target = stream->EnsureSpace(target);
436     target = ::_pbi::WireFormatLite::WriteEnumToArray(
437       4, this->_internal_chrome_thread_type(), target);
438   }
439 
440   // optional string thread_name = 5;
441   if (cached_has_bits & 0x00000001u) {
442     target = stream->WriteStringMaybeAliased(
443         5, this->_internal_thread_name(), target);
444   }
445 
446   // optional int64 reference_timestamp_us = 6;
447   if (cached_has_bits & 0x00000020u) {
448     target = stream->EnsureSpace(target);
449     target = ::_pbi::WireFormatLite::WriteInt64ToArray(6, this->_internal_reference_timestamp_us(), target);
450   }
451 
452   // optional int64 reference_thread_time_us = 7;
453   if (cached_has_bits & 0x00000040u) {
454     target = stream->EnsureSpace(target);
455     target = ::_pbi::WireFormatLite::WriteInt64ToArray(7, this->_internal_reference_thread_time_us(), target);
456   }
457 
458   // optional int64 reference_thread_instruction_count = 8;
459   if (cached_has_bits & 0x00000080u) {
460     target = stream->EnsureSpace(target);
461     target = ::_pbi::WireFormatLite::WriteInt64ToArray(8, this->_internal_reference_thread_instruction_count(), target);
462   }
463 
464   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
465     target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
466         static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
467   }
468   // @@protoc_insertion_point(serialize_to_array_end:perfetto.protos.ThreadDescriptor)
469   return target;
470 }
471 
ByteSizeLong() const472 size_t ThreadDescriptor::ByteSizeLong() const {
473 // @@protoc_insertion_point(message_byte_size_start:perfetto.protos.ThreadDescriptor)
474   size_t total_size = 0;
475 
476   ::uint32_t cached_has_bits = 0;
477   // Prevent compiler warnings about cached_has_bits being unused
478   (void) cached_has_bits;
479 
480   cached_has_bits = _impl_._has_bits_[0];
481   if (cached_has_bits & 0x000000ffu) {
482     // optional string thread_name = 5;
483     if (cached_has_bits & 0x00000001u) {
484       total_size += 1 +
485         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
486           this->_internal_thread_name());
487     }
488 
489     // optional int32 pid = 1;
490     if (cached_has_bits & 0x00000002u) {
491       total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_pid());
492     }
493 
494     // optional int32 tid = 2;
495     if (cached_has_bits & 0x00000004u) {
496       total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_tid());
497     }
498 
499     // optional int32 legacy_sort_index = 3;
500     if (cached_has_bits & 0x00000008u) {
501       total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_legacy_sort_index());
502     }
503 
504     // optional .perfetto.protos.ThreadDescriptor.ChromeThreadType chrome_thread_type = 4;
505     if (cached_has_bits & 0x00000010u) {
506       total_size += 1 +
507         ::_pbi::WireFormatLite::EnumSize(this->_internal_chrome_thread_type());
508     }
509 
510     // optional int64 reference_timestamp_us = 6;
511     if (cached_has_bits & 0x00000020u) {
512       total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_reference_timestamp_us());
513     }
514 
515     // optional int64 reference_thread_time_us = 7;
516     if (cached_has_bits & 0x00000040u) {
517       total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_reference_thread_time_us());
518     }
519 
520     // optional int64 reference_thread_instruction_count = 8;
521     if (cached_has_bits & 0x00000080u) {
522       total_size += ::_pbi::WireFormatLite::Int64SizePlusOne(this->_internal_reference_thread_instruction_count());
523     }
524 
525   }
526   if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
527     total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
528   }
529   int cached_size = ::_pbi::ToCachedSize(total_size);
530   SetCachedSize(cached_size);
531   return total_size;
532 }
533 
CheckTypeAndMergeFrom(const::PROTOBUF_NAMESPACE_ID::MessageLite & from)534 void ThreadDescriptor::CheckTypeAndMergeFrom(
535     const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
536   MergeFrom(*::_pbi::DownCast<const ThreadDescriptor*>(
537       &from));
538 }
539 
MergeFrom(const ThreadDescriptor & from)540 void ThreadDescriptor::MergeFrom(const ThreadDescriptor& from) {
541   ThreadDescriptor* const _this = this;
542   // @@protoc_insertion_point(class_specific_merge_from_start:perfetto.protos.ThreadDescriptor)
543   GOOGLE_DCHECK_NE(&from, _this);
544   ::uint32_t cached_has_bits = 0;
545   (void) cached_has_bits;
546 
547   cached_has_bits = from._impl_._has_bits_[0];
548   if (cached_has_bits & 0x000000ffu) {
549     if (cached_has_bits & 0x00000001u) {
550       _this->_internal_set_thread_name(from._internal_thread_name());
551     }
552     if (cached_has_bits & 0x00000002u) {
553       _this->_impl_.pid_ = from._impl_.pid_;
554     }
555     if (cached_has_bits & 0x00000004u) {
556       _this->_impl_.tid_ = from._impl_.tid_;
557     }
558     if (cached_has_bits & 0x00000008u) {
559       _this->_impl_.legacy_sort_index_ = from._impl_.legacy_sort_index_;
560     }
561     if (cached_has_bits & 0x00000010u) {
562       _this->_impl_.chrome_thread_type_ = from._impl_.chrome_thread_type_;
563     }
564     if (cached_has_bits & 0x00000020u) {
565       _this->_impl_.reference_timestamp_us_ = from._impl_.reference_timestamp_us_;
566     }
567     if (cached_has_bits & 0x00000040u) {
568       _this->_impl_.reference_thread_time_us_ = from._impl_.reference_thread_time_us_;
569     }
570     if (cached_has_bits & 0x00000080u) {
571       _this->_impl_.reference_thread_instruction_count_ = from._impl_.reference_thread_instruction_count_;
572     }
573     _this->_impl_._has_bits_[0] |= cached_has_bits;
574   }
575   _this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
576 }
577 
CopyFrom(const ThreadDescriptor & from)578 void ThreadDescriptor::CopyFrom(const ThreadDescriptor& from) {
579 // @@protoc_insertion_point(class_specific_copy_from_start:perfetto.protos.ThreadDescriptor)
580   if (&from == this) return;
581   Clear();
582   MergeFrom(from);
583 }
584 
IsInitialized() const585 bool ThreadDescriptor::IsInitialized() const {
586   return true;
587 }
588 
InternalSwap(ThreadDescriptor * other)589 void ThreadDescriptor::InternalSwap(ThreadDescriptor* other) {
590   using std::swap;
591   auto* lhs_arena = GetArenaForAllocation();
592   auto* rhs_arena = other->GetArenaForAllocation();
593   _internal_metadata_.InternalSwap(&other->_internal_metadata_);
594   swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
595   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
596       &_impl_.thread_name_, lhs_arena,
597       &other->_impl_.thread_name_, rhs_arena
598   );
599   ::PROTOBUF_NAMESPACE_ID::internal::memswap<
600       PROTOBUF_FIELD_OFFSET(ThreadDescriptor, _impl_.reference_thread_instruction_count_)
601       + sizeof(ThreadDescriptor::_impl_.reference_thread_instruction_count_)  // NOLINT
602       - PROTOBUF_FIELD_OFFSET(ThreadDescriptor, _impl_.pid_)>(
603           reinterpret_cast<char*>(&_impl_.pid_),
604           reinterpret_cast<char*>(&other->_impl_.pid_));
605 }
606 
GetTypeName() const607 std::string ThreadDescriptor::GetTypeName() const {
608   return "perfetto.protos.ThreadDescriptor";
609 }
610 
611 
612 // @@protoc_insertion_point(namespace_scope)
613 }  // namespace protos
614 }  // namespace perfetto
615 PROTOBUF_NAMESPACE_OPEN
616 template<> PROTOBUF_NOINLINE ::perfetto::protos::ThreadDescriptor*
CreateMaybeMessage(Arena * arena)617 Arena::CreateMaybeMessage< ::perfetto::protos::ThreadDescriptor >(Arena* arena) {
618   return Arena::CreateMessageInternal< ::perfetto::protos::ThreadDescriptor >(arena);
619 }
620 PROTOBUF_NAMESPACE_CLOSE
621 
622 // @@protoc_insertion_point(global_scope)
623 #include <google/protobuf/port_undef.inc>
624