Internal change

PiperOrigin-RevId: 503157344
This commit is contained in:
Adam Cozzette
2023-01-19 07:20:04 -08:00
committed by Copybara-Service
parent e2dedcbfe5
commit 7a7cc77a81
7 changed files with 30 additions and 25 deletions
@@ -28,7 +28,7 @@ constexpr char kDescriptorContents[] =
mediapipe::FieldData ReadFileDescriptorSet(const std::string& pb) {
mediapipe::FieldData result;
*result.mutable_message_value()->mutable_type_url() =
"proto2.FileDescriptorSet";
"google::protobuf.FileDescriptorSet";
*result.mutable_message_value()->mutable_value() = pb;
// Force linking of the generated options protobuf.
+12 -10
View File
@@ -66,26 +66,28 @@ std::string GetFieldString(const FieldData& message_data,
void RegisterDescriptorProtos(
absl::flat_hash_map<std::string, Descriptor>& result) {
std::vector<Descriptor> descriptors = {
{"proto2.FileDescriptorSet",
{"google::protobuf.FileDescriptorSet",
{
{"file", 1, FieldType::TYPE_MESSAGE, "proto2.FileDescriptorProto"},
{"file", 1, FieldType::TYPE_MESSAGE,
"google::protobuf.FileDescriptorProto"},
}},
{"proto2.FileDescriptorProto",
{"google::protobuf.FileDescriptorProto",
{
{"package", 2, FieldType::TYPE_STRING, ""},
{"message_type", 4, FieldType::TYPE_MESSAGE,
"proto2.DescriptorProto"},
"google::protobuf.DescriptorProto"},
}},
{"proto2.DescriptorProto",
{"google::protobuf.DescriptorProto",
{
{"name", 1, FieldType::TYPE_STRING, ""},
{"field", 2, FieldType::TYPE_MESSAGE, "proto2.FieldDescriptorProto"},
{"field", 2, FieldType::TYPE_MESSAGE,
"google::protobuf.FieldDescriptorProto"},
{"extension", 6, FieldType::TYPE_MESSAGE,
"proto2.FieldDescriptorProto"},
"google::protobuf.FieldDescriptorProto"},
{"nested_type", 3, FieldType::TYPE_MESSAGE,
"proto2.DescriptorProto"},
"google::protobuf.DescriptorProto"},
}},
{"proto2.FieldDescriptorProto",
{"google::protobuf.FieldDescriptorProto",
{
{"name", 1, FieldType::TYPE_STRING, ""},
{"number", 3, FieldType::TYPE_INT32, ""},
@@ -140,7 +142,7 @@ void OptionsRegistry::Register(const FieldData& message_type,
const Descriptor* OptionsRegistry::GetProtobufDescriptor(
const std::string& type_name) {
if (descriptors().count("proto2.DescriptorProto") == 0) {
if (descriptors().count("google::protobuf.DescriptorProto") == 0) {
RegisterDescriptorProtos(descriptors());
}
absl::ReaderMutexLock lock(&mutex());
+1 -1
View File
@@ -28,7 +28,7 @@ class OptionsRegistry {
// Finds the descriptor for a protobuf.
static const Descriptor* GetProtobufDescriptor(const std::string& type_name);
// Returns all known proto2 extensions to a type.
// Returns all known google::protobuf extensions to a type.
static void FindAllExtensions(absl::string_view extendee,
std::vector<const FieldDescriptor*>* result);