Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: third_party/protobuf/src/google/protobuf/descriptor.cc

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/descriptor.cc
diff --git a/third_party/protobuf/src/google/protobuf/descriptor.cc b/third_party/protobuf/src/google/protobuf/descriptor.cc
index 85991dccdd35dd13b21d5a326fa5f8ea50f45b3a..a59c285010740255ad5cb2881eba3856b8502b25 100644
--- a/third_party/protobuf/src/google/protobuf/descriptor.cc
+++ b/third_party/protobuf/src/google/protobuf/descriptor.cc
@@ -357,13 +357,20 @@ void DeleteAllowedProto3Extendee() {
void InitAllowedProto3Extendee() {
allowed_proto3_extendees_ = new set<string>;
- allowed_proto3_extendees_->insert("google.protobuf.FileOptions");
- allowed_proto3_extendees_->insert("google.protobuf.MessageOptions");
- allowed_proto3_extendees_->insert("google.protobuf.FieldOptions");
- allowed_proto3_extendees_->insert("google.protobuf.EnumOptions");
- allowed_proto3_extendees_->insert("google.protobuf.EnumValueOptions");
- allowed_proto3_extendees_->insert("google.protobuf.ServiceOptions");
- allowed_proto3_extendees_->insert("google.protobuf.MethodOptions");
+ const char* kOptionNames[] = {
+ "FileOptions", "MessageOptions", "FieldOptions", "EnumOptions",
+ "EnumValueOptions", "ServiceOptions", "MethodOptions"};
+ for (int i = 0; i < GOOGLE_ARRAYSIZE(kOptionNames); ++i) {
+ // descriptor.proto has a different package name in opensource. We allow
+ // both so the opensource protocol compiler can also compile internal
+ // proto3 files with custom options. See: b/27567912
+ allowed_proto3_extendees_->insert(string("google.protobuf.") +
+ kOptionNames[i]);
+ // Split the word to trick the opensource processing scripts so they
+ // will keep the origial package name.
+ allowed_proto3_extendees_->insert(string("proto") + "2." + kOptionNames[i]);
+ }
+
google::protobuf::internal::OnShutdown(&DeleteAllowedProto3Extendee);
}
@@ -2766,6 +2773,9 @@ class DescriptorBuilder {
private:
friend class OptionInterpreter;
+ // Non-recursive part of BuildFile functionality.
+ const FileDescriptor* BuildFileImpl(const FileDescriptorProto& proto);
+
const DescriptorPool* pool_;
DescriptorPool::Tables* tables_; // for convenience
DescriptorPool::ErrorCollector* error_collector_;
@@ -3834,7 +3844,11 @@ const FileDescriptor* DescriptorBuilder::BuildFile(
}
tables_->pending_files_.pop_back();
}
+ return BuildFileImpl(proto);
+}
+const FileDescriptor* DescriptorBuilder::BuildFileImpl(
+ const FileDescriptorProto& proto) {
// Checkpoint the tables so that we can roll back if something goes wrong.
tables_->AddCheckpoint();
@@ -5113,11 +5127,6 @@ void DescriptorBuilder::ValidateProto3(
for (int i = 0; i < file->enum_type_count(); ++i) {
ValidateProto3Enum(file->enum_types_ + i, proto.enum_type(i));
}
- if (IsLite(file)) {
- AddError(file->name(), proto,
- DescriptorPool::ErrorCollector::OTHER,
- "Lite runtime is not supported in proto3.");
- }
}
static string ToLowercaseWithoutUnderscores(const string& name) {
« no previous file with comments | « third_party/protobuf/src/google/protobuf/descriptor.h ('k') | third_party/protobuf/src/google/protobuf/descriptor.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698