Change Any::PackFrom to avoid bringing the full runtime.

PiperOrigin-RevId: 603079735
pull/15658/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent 6f1d88107f
commit f8ea418e6a
  1. 5
      src/google/protobuf/any.cc

@ -25,13 +25,12 @@ bool AnyMetadata::PackFrom(Arena* arena, const Message& message) {
bool AnyMetadata::PackFrom(Arena* arena, const Message& message,
absl::string_view type_url_prefix) {
type_url_->Set(
GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena);
type_url_->Set(GetTypeUrl(message.GetTypeName(), type_url_prefix), arena);
return message.SerializeToString(value_->Mutable(arena));
}
bool AnyMetadata::UnpackTo(Message* message) const {
if (!InternalIs(message->GetDescriptor()->full_name())) {
if (!InternalIs(message->GetTypeName())) {
return false;
}
return message->ParseFromString(value_->Get());

Loading…
Cancel
Save