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

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/java/java_message.h

Issue 1322483002: Revert https://codereview.chromium.org/1291903002 (protobuf roll). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/compiler/java/java_message.h
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_message.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_message.h
index c3c37765142dc798648905fe88c5c983ad53c646..a30f020267557cc659f6e7d2921000a89a4d755f 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_message.h
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_message.h
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
+// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -36,17 +36,11 @@
#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__
#include <string>
-#include <map>
+#include <google/protobuf/stubs/common.h>
#include <google/protobuf/compiler/java/java_field.h>
namespace google {
namespace protobuf {
- namespace compiler {
- namespace java {
- class Context; // context.h
- class ClassNameResolver; // name_resolver.h
- }
- }
namespace io {
class Printer; // printer.h
}
@@ -59,54 +53,32 @@ namespace java {
class MessageGenerator {
public:
explicit MessageGenerator(const Descriptor* descriptor);
- virtual ~MessageGenerator();
+ ~MessageGenerator();
// All static variables have to be declared at the top-level of the file
// so that we can control initialization order, which is important for
// DescriptorProto bootstrapping to work.
- virtual void GenerateStaticVariables(io::Printer* printer) = 0;
+ void GenerateStaticVariables(io::Printer* printer);
// Output code which initializes the static variables generated by
- // GenerateStaticVariables(). Returns an estimate of bytecode size.
- virtual int GenerateStaticVariableInitializers(io::Printer* printer) = 0;
+ // GenerateStaticVariables().
+ void GenerateStaticVariableInitializers(io::Printer* printer);
// Generate the class itself.
- virtual void Generate(io::Printer* printer) = 0;
+ void Generate(io::Printer* printer);
// Generates the base interface that both the class and its builder implement
- virtual void GenerateInterface(io::Printer* printer) = 0;
+ void GenerateInterface(io::Printer* printer);
// Generate code to register all contained extensions with an
// ExtensionRegistry.
- virtual void GenerateExtensionRegistrationCode(io::Printer* printer) = 0;
-
- protected:
- const Descriptor* descriptor_;
-
- private:
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
-};
-
-class ImmutableMessageGenerator : public MessageGenerator {
- public:
- explicit ImmutableMessageGenerator(const Descriptor* descriptor,
- Context* context);
- virtual ~ImmutableMessageGenerator();
-
- virtual void Generate(io::Printer* printer);
- virtual void GenerateInterface(io::Printer* printer);
- virtual void GenerateExtensionRegistrationCode(io::Printer* printer);
- virtual void GenerateStaticVariables(io::Printer* printer);
-
- // Returns an estimate of the number of bytes the printed code will compile to
- virtual int GenerateStaticVariableInitializers(io::Printer* printer);
+ void GenerateExtensionRegistrationCode(io::Printer* printer);
private:
-
- void GenerateFieldAccessorTable(io::Printer* printer);
-
- // Returns an estimate of the number of bytes the printed code will compile to
- int GenerateFieldAccessorTableInitializer(io::Printer* printer);
+ enum UseMemoization {
+ MEMOIZE,
+ DONT_MEMOIZE
+ };
void GenerateMessageSerializationMethods(io::Printer* printer);
void GenerateParseFromMethods(io::Printer* printer);
@@ -116,18 +88,20 @@ class ImmutableMessageGenerator : public MessageGenerator {
io::Printer* printer, const Descriptor::ExtensionRange* range);
void GenerateBuilder(io::Printer* printer);
- void GenerateIsInitialized(io::Printer* printer);
+ void GenerateCommonBuilderMethods(io::Printer* printer);
void GenerateDescriptorMethods(io::Printer* printer);
- void GenerateInitializers(io::Printer* printer);
+ void GenerateBuilderParsingMethods(io::Printer* printer);
+ void GenerateIsInitialized(io::Printer* printer,
+ UseMemoization useMemoization);
void GenerateEqualsAndHashCode(io::Printer* printer);
+
void GenerateParser(io::Printer* printer);
void GenerateParsingConstructor(io::Printer* printer);
- Context* context_;
- ClassNameResolver* name_resolver_;
- FieldGeneratorMap<ImmutableFieldGenerator> field_generators_;
+ const Descriptor* descriptor_;
+ FieldGeneratorMap field_generators_;
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableMessageGenerator);
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
};
} // namespace java

Powered by Google App Engine
This is Rietveld 408576698