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

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

Issue 1842653006: Update //third_party/protobuf to version 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 8 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_generator_factory.h
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_extension.h b/third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h
similarity index 52%
copy from third_party/protobuf/src/google/protobuf/compiler/java/java_extension.h
copy to third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h
index 009ed9ffacaf207d4fb6322dca43697499b32991..55365a9d4e94faefcd84f41c580bca993f782ae3 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_extension.h
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h
@@ -1,6 +1,6 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
+// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -28,22 +28,25 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
+// Author: liujisi@google.com (Pherl Liu)
-#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_H__
-#define GOOGLE_PROTOBUF_COMPILER_JAVA_EXTENSION_H__
-
-#include <string>
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__
+#define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__
#include <google/protobuf/stubs/common.h>
namespace google {
namespace protobuf {
- class FieldDescriptor; // descriptor.h
- namespace io {
- class Printer; // printer.h
+ class FieldDescriptor; // descriptor.h
+ class Descriptor; // descriptor.h
+ class ServiceDescriptor; // descriptor.h
+ namespace compiler {
+ namespace java {
+ class MessageGenerator; // message.h
+ class ExtensionGenerator; // extension.h
+ class ServiceGenerator; // service.h
+ class Context; // context.h
+ }
}
}
@@ -51,27 +54,48 @@ namespace protobuf {
namespace compiler {
namespace java {
-// Generates code for an extension, which may be within the scope of some
-// message or may be at file scope. This is much simpler than FieldGenerator
-// since extensions are just simple identifiers with interesting types.
-class ExtensionGenerator {
+class GeneratorFactory {
+ public:
+ GeneratorFactory();
+ virtual ~GeneratorFactory();
+
+ virtual MessageGenerator* NewMessageGenerator(
+ const Descriptor* descriptor) const = 0;
+
+ virtual ExtensionGenerator* NewExtensionGenerator(
+ const FieldDescriptor* descriptor) const = 0;
+
+ virtual ServiceGenerator* NewServiceGenerator(
+ const ServiceDescriptor* descriptor) const = 0;
+
+ private:
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratorFactory);
+};
+
+// Factory that creates generators for immutable-default messages.
+class ImmutableGeneratorFactory : public GeneratorFactory {
public:
- explicit ExtensionGenerator(const FieldDescriptor* descriptor);
- ~ExtensionGenerator();
+ ImmutableGeneratorFactory(Context* context);
+ virtual ~ImmutableGeneratorFactory();
- void Generate(io::Printer* printer);
- void GenerateNonNestedInitializationCode(io::Printer* printer);
- void GenerateRegistrationCode(io::Printer* printer);
+ virtual MessageGenerator* NewMessageGenerator(
+ const Descriptor* descriptor) const;
+
+ virtual ExtensionGenerator* NewExtensionGenerator(
+ const FieldDescriptor* descriptor) const;
+
+ virtual ServiceGenerator* NewServiceGenerator(
+ const ServiceDescriptor* descriptor) const;
private:
- const FieldDescriptor* descriptor_;
- string scope_;
- GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
+ Context* context_;
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ImmutableGeneratorFactory);
};
+
} // namespace java
} // namespace compiler
} // namespace protobuf
} // namespace google
-#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_H__
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_FACTORY_H__

Powered by Google App Engine
This is Rietveld 408576698