From ab127f75015c595bf27dd75f8f22a64f4fd9c7c0 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Mon, 26 Feb 2024 11:19:54 -0800 Subject: [PATCH] Rename EagerParseLazyField to EagerParseLazyFieldIgnoreUnparsed PiperOrigin-RevId: 610469115 --- src/google/protobuf/internal_message_util.cc | 17 ++++++++++------- src/google/protobuf/internal_message_util.h | 5 +++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/google/protobuf/internal_message_util.cc b/src/google/protobuf/internal_message_util.cc index 362885d614..a20ba6f445 100644 --- a/src/google/protobuf/internal_message_util.cc +++ b/src/google/protobuf/internal_message_util.cc @@ -26,7 +26,7 @@ class MessageUtil { } // Walks the entire message tree and eager parses all lazy fields. - static void EagerParseLazyField(Message* message); + static void EagerParseLazyFieldIgnoreUnparsedByMutation(Message* message); }; namespace { @@ -56,7 +56,8 @@ inline bool IsNonMessageField(const FieldDescriptor* field) { // To eagerly parse lazy fields in the entire message tree, mutates all the // message fields (optional, repeated, extensions). -void MessageUtil::EagerParseLazyField(Message* message) { +void MessageUtil::EagerParseLazyFieldIgnoreUnparsedByMutation( + Message* message) { const Reflection* reflection = message->GetReflection(); std::vector fields; reflection->ListFields(*message, &fields); @@ -65,7 +66,8 @@ void MessageUtil::EagerParseLazyField(Message* message) { if (IsNonMessageField(field)) continue; if (!field->is_repeated()) { - EagerParseLazyField(reflection->MutableMessage(message, field)); + EagerParseLazyFieldIgnoreUnparsedByMutation( + reflection->MutableMessage(message, field)); continue; } @@ -73,7 +75,8 @@ void MessageUtil::EagerParseLazyField(Message* message) { if (UseMapIterator(reflection, *message, field)) { auto end = reflection->MapEnd(message, field); for (auto it = reflection->MapBegin(message, field); it != end; ++it) { - EagerParseLazyField(it.MutableValueRef()->MutableMessageValue()); + EagerParseLazyFieldIgnoreUnparsedByMutation( + it.MutableValueRef()->MutableMessageValue()); } continue; } @@ -82,15 +85,15 @@ void MessageUtil::EagerParseLazyField(Message* message) { if (field->is_repeated()) { for (int i = 0, end = reflection->FieldSize(*message, field); i < end; ++i) { - EagerParseLazyField( + EagerParseLazyFieldIgnoreUnparsedByMutation( reflection->MutableRepeatedMessage(message, field, i)); } } } } -void EagerParseLazyField(Message& message) { - MessageUtil::EagerParseLazyField(&message); +void EagerParseLazyFieldIgnoreUnparsed(Message& message) { + MessageUtil::EagerParseLazyFieldIgnoreUnparsedByMutation(&message); } } // namespace internal diff --git a/src/google/protobuf/internal_message_util.h b/src/google/protobuf/internal_message_util.h index 6a8d24837a..ec413d046a 100644 --- a/src/google/protobuf/internal_message_util.h +++ b/src/google/protobuf/internal_message_util.h @@ -17,8 +17,9 @@ namespace google { namespace protobuf { namespace internal { -// Walks the entire message tree and eager parses all lazy fields. -void EagerParseLazyField(Message& message); +// Walks the entire message tree, eager parses all lazy fields and configures +// them to ignore unparsed. +void EagerParseLazyFieldIgnoreUnparsed(Message& message); } // namespace internal } // namespace protobuf