| 598 | } |
| 599 | |
| 600 | void ByteString::AppendToCord(absl::Cord* absl_nonnull out) const { |
| 601 | ABSL_DCHECK(out != nullptr); |
| 602 | |
| 603 | switch (GetKind()) { |
| 604 | case ByteStringKind::kSmall: |
| 605 | out->Append(GetSmall()); |
| 606 | break; |
| 607 | case ByteStringKind::kMedium: { |
| 608 | const auto* refcount = GetMediumReferenceCount(); |
| 609 | if (refcount != nullptr) { |
| 610 | StrongRef(*refcount); |
| 611 | out->Append(absl::MakeCordFromExternal( |
| 612 | GetMedium(), ReferenceCountReleaser{refcount})); |
| 613 | } else { |
| 614 | out->Append(GetMedium()); |
| 615 | } |
| 616 | } break; |
| 617 | case ByteStringKind::kLarge: |
| 618 | out->Append(GetLarge()); |
| 619 | break; |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | absl::string_view ByteString::ToStringView( |
| 624 | std::string* absl_nonnull scratch) const { |