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

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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/compiler/cpp/cpp_file.h
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h
index 5dcf692bcdeaf03ebb2847d3ea47939994801ad1..25d6eabf937851952636982c3c8055aa81069626 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h
+++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h
@@ -68,6 +68,9 @@ class FileGenerator {
FileGenerator(const FileDescriptor* file, const Options& options);
~FileGenerator();
+ // Shared code between the two header generators below.
+ void GenerateHeader(io::Printer* printer);
+
// info_path, if non-empty, should be the path (relative to printer's output)
// to the metadata file describing this proto header.
void GenerateProtoHeader(io::Printer* printer,
@@ -117,18 +120,6 @@ class FileGenerator {
// Generates types for classes.
void GenerateMessageDefinitions(io::Printer* printer);
- // Generates forward-declarations for just this file's classes. This is
- // used for .pb.h headers, but not in proto_h mode.
- void GenerateMessageForwardDeclarations(io::Printer* printer);
-
- // Fills in types for forward declarations. This is used internally, and
- // also by other FileGenerators to determine imports' declarations.
- void FillMessageForwardDeclarations(ForwardDeclarations* decls);
- void FillMessageDefinitions(ForwardDeclarations* decls);
-
- // Generates enum definitions.
- void GenerateEnumForwardDeclarations(io::Printer* printer);
- void FillEnumForwardDeclarations(ForwardDeclarations* decls);
void GenerateEnumDefinitions(io::Printer* printer);
// Generates generic service definitions.
@@ -145,13 +136,25 @@ class FileGenerator {
const FileDescriptor* file_;
const Options options_;
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> > message_generators_;
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<EnumGenerator> > enum_generators_;
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<ServiceGenerator> > service_generators_;
- google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator> > extension_generators_;
+ // Contains the post-order walk of all the messages (and child messages) in
+ // this file. If you need a pre-order walk just reverse iterate.
+ std::vector<MessageGenerator*> message_generators_;
+ std::vector<EnumGenerator*> enum_generators_;
+ std::vector<ServiceGenerator*> service_generators_;
+ std::vector<ExtensionGenerator*> extension_generators_;
+
+ // These members are just for owning (and thus proper deleting). Some of the
+ // message_ and enum_generators above are owned by child messages.
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<MessageGenerator> >
+ message_generators_owner_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<EnumGenerator> > enum_generators_owner_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<ServiceGenerator> >
+ service_generators_owner_;
+ google::protobuf::scoped_array<google::protobuf::scoped_ptr<ExtensionGenerator> >
+ extension_generators_owner_;
// E.g. if the package is foo.bar, package_parts_ is {"foo", "bar"}.
- vector<string> package_parts_;
+ std::vector<string> package_parts_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
};

Powered by Google App Engine
This is Rietveld 408576698