From 0400cca3236de1ca303af38bf81eab332d042b7c Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Tue, 13 Mar 2018 16:37:29 -0700 Subject: Integrated internal changes from Google --- src/google/protobuf/duration.pb.cc | 54 +++++++++++++++----------------------- 1 file changed, 21 insertions(+), 33 deletions(-) (limited to 'src/google/protobuf/duration.pb.cc') diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc index b4d5eb5f..ddc063db 100644 --- a/src/google/protobuf/duration.pb.cc +++ b/src/google/protobuf/duration.pb.cc @@ -7,7 +7,6 @@ #include #include -#include #include #include #include @@ -19,6 +18,7 @@ #include "third_party/protobuf/version.h" #endif // @@protoc_insertion_point(includes) + namespace google { namespace protobuf { class DurationDefaultTypeInternal { @@ -29,14 +29,9 @@ class DurationDefaultTypeInternal { } // namespace protobuf } // namespace google namespace protobuf_google_2fprotobuf_2fduration_2eproto { -void InitDefaultsDurationImpl() { +static void InitDefaultsDuration() { GOOGLE_PROTOBUF_VERIFY_VERSION; -#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS - ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); -#else - ::google::protobuf::internal::InitProtobufDefaults(); -#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS { void* ptr = &::google::protobuf::_Duration_default_instance_; new (ptr) ::google::protobuf::Duration(); @@ -45,9 +40,11 @@ void InitDefaultsDurationImpl() { ::google::protobuf::Duration::InitAsDefaultInstance(); } -void InitDefaultsDuration() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsDurationImpl); +LIBPROTOBUF_EXPORT ::google::protobuf::internal::SCCInfo<0> scc_info_Duration = + {{ATOMIC_VAR_INIT(::google::protobuf::internal::SCCInfoBase::kUninitialized), 0, InitDefaultsDuration}, {}}; + +void InitDefaults() { + ::google::protobuf::internal::InitSCC(&scc_info_Duration.base); } ::google::protobuf::Metadata file_level_metadata[1]; @@ -71,15 +68,14 @@ static ::google::protobuf::Message const * const file_default_instances[] = { void protobuf_AssignDescriptors() { AddDescriptors(); - ::google::protobuf::MessageFactory* factory = NULL; AssignDescriptors( - "google/protobuf/duration.proto", schemas, file_default_instances, TableStruct::offsets, factory, + "google/protobuf/duration.proto", schemas, file_default_instances, TableStruct::offsets, file_level_metadata, NULL, NULL); } void protobuf_AssignDescriptorsOnce() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); + static ::google::protobuf::internal::once_flag once; + ::google::protobuf::internal::call_once(once, protobuf_AssignDescriptors); } void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; @@ -105,8 +101,8 @@ void AddDescriptorsImpl() { } void AddDescriptors() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl); + static ::google::protobuf::internal::once_flag once; + ::google::protobuf::internal::call_once(once, AddDescriptorsImpl); } // Force AddDescriptors() to be called at dynamic initialization time. struct StaticDescriptorInitializer { @@ -129,24 +125,22 @@ const int Duration::kNanosFieldNumber; Duration::Duration() : ::google::protobuf::Message(), _internal_metadata_(NULL) { - if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - ::protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaultsDuration(); - } + ::google::protobuf::internal::InitSCC( + &protobuf_google_2fprotobuf_2fduration_2eproto::scc_info_Duration.base); SharedCtor(); // @@protoc_insertion_point(constructor:google.protobuf.Duration) } Duration::Duration(::google::protobuf::Arena* arena) : ::google::protobuf::Message(), _internal_metadata_(arena) { - ::protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaultsDuration(); + ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fduration_2eproto::scc_info_Duration.base); SharedCtor(); RegisterArenaDtor(arena); // @@protoc_insertion_point(arena_constructor:google.protobuf.Duration) } Duration::Duration(const Duration& from) : ::google::protobuf::Message(), - _internal_metadata_(NULL), - _cached_size_(0) { + _internal_metadata_(NULL) { _internal_metadata_.MergeFrom(from._internal_metadata_); ::memcpy(&seconds_, &from.seconds_, static_cast(reinterpret_cast(&nanos_) - @@ -158,7 +152,6 @@ void Duration::SharedCtor() { ::memset(&seconds_, 0, static_cast( reinterpret_cast(&nanos_) - reinterpret_cast(&seconds_)) + sizeof(nanos_)); - _cached_size_ = 0; } Duration::~Duration() { @@ -177,9 +170,7 @@ void Duration::ArenaDtor(void* object) { void Duration::RegisterArenaDtor(::google::protobuf::Arena* arena) { } void Duration::SetCachedSize(int size) const { - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); + _cached_size_.Set(size); } const ::google::protobuf::Descriptor* Duration::descriptor() { ::protobuf_google_2fprotobuf_2fduration_2eproto::protobuf_AssignDescriptorsOnce(); @@ -187,7 +178,7 @@ const ::google::protobuf::Descriptor* Duration::descriptor() { } const Duration& Duration::default_instance() { - ::protobuf_google_2fprotobuf_2fduration_2eproto::InitDefaultsDuration(); + ::google::protobuf::internal::InitSCC(&protobuf_google_2fprotobuf_2fduration_2eproto::scc_info_Duration.base); return *internal_default_instance(); } @@ -210,7 +201,7 @@ bool Duration::MergePartialFromCodedStream( ::google::protobuf::uint32 tag; // @@protoc_insertion_point(parse_start:google.protobuf.Duration) for (;;) { - ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); + ::std::pair<::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u); tag = p.first; if (!p.second) goto handle_unusual; switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { @@ -334,9 +325,7 @@ size_t Duration::ByteSizeLong() const { } int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); - GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); - _cached_size_ = cached_size; - GOOGLE_SAFE_CONCURRENT_WRITES_END(); + SetCachedSize(cached_size); return total_size; } @@ -412,7 +401,6 @@ void Duration::InternalSwap(Duration* other) { swap(seconds_, other->seconds_); swap(nanos_, other->nanos_); _internal_metadata_.Swap(&other->_internal_metadata_); - swap(_cached_size_, other->_cached_size_); } ::google::protobuf::Metadata Duration::GetMetadata() const { @@ -426,7 +414,7 @@ void Duration::InternalSwap(Duration* other) { } // namespace google namespace google { namespace protobuf { -template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Duration* Arena::CreateMessage< ::google::protobuf::Duration >(Arena* arena) { +template<> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE ::google::protobuf::Duration* Arena::CreateMaybeMessage< ::google::protobuf::Duration >(Arena* arena) { return Arena::CreateMessageInternal< ::google::protobuf::Duration >(arena); } } // namespace protobuf -- cgit v1.2.3