| 1434 | } |
| 1435 | |
| 1436 | Value Value::WrapMessageUnsafe( |
| 1437 | const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND, |
| 1438 | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool |
| 1439 | ABSL_ATTRIBUTE_LIFETIME_BOUND, |
| 1440 | google::protobuf::MessageFactory* absl_nonnull message_factory |
| 1441 | ABSL_ATTRIBUTE_LIFETIME_BOUND, |
| 1442 | google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) { |
| 1443 | ABSL_DCHECK(message != nullptr); |
| 1444 | ABSL_DCHECK(descriptor_pool != nullptr); |
| 1445 | ABSL_DCHECK(message_factory != nullptr); |
| 1446 | ABSL_DCHECK(arena != nullptr); |
| 1447 | |
| 1448 | std::string scratch; |
| 1449 | absl::StatusOr<well_known_types::Value> adapted_value = |
| 1450 | well_known_types::AdaptFromMessage(arena, *message, descriptor_pool, |
| 1451 | message_factory, scratch); |
| 1452 | if (ABSL_PREDICT_FALSE(!adapted_value.ok())) { |
| 1453 | return ErrorValue(std::move(adapted_value).status()); |
| 1454 | } |
| 1455 | return absl::visit( |
| 1456 | absl::Overload(BorrowingWellKnownTypesValueVisitor{ |
| 1457 | /* .message = */ message, /* .arena = */ arena, |
| 1458 | /* .scratch = */ &scratch}, |
| 1459 | [&](absl::monostate) -> Value { |
| 1460 | if (message->GetArena() != arena) { |
| 1461 | return UnsafeParsedMessageValue(message); |
| 1462 | } |
| 1463 | return ParsedMessageValue(message, arena); |
| 1464 | }), |
| 1465 | std::move(adapted_value).value()); |
| 1466 | } |
| 1467 | |
| 1468 | namespace { |
| 1469 |
nothing calls this directly
no test coverage detected