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

Side by Side Diff: third_party/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.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 unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 25 matching lines...) Expand all
36 #define GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__ 36 #define GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
37 37
38 #include <memory> 38 #include <memory>
39 #ifndef _SHARED_PTR_H 39 #ifndef _SHARED_PTR_H
40 #include <google/protobuf/stubs/shared_ptr.h> 40 #include <google/protobuf/stubs/shared_ptr.h>
41 #endif 41 #endif
42 #include <string> 42 #include <string>
43 #include <vector> 43 #include <vector>
44 44
45 #include <google/protobuf/stubs/common.h> 45 #include <google/protobuf/stubs/common.h>
46 #include <google/protobuf/compiler/java/java_options.h>
46 47
47 namespace google { 48 namespace google {
48 namespace protobuf { 49 namespace protobuf {
49 class FileDescriptor; // descriptor.h 50 class FileDescriptor; // descriptor.h
50 namespace compiler { 51 namespace compiler {
51 class GeneratorContext; // code_generator.h 52 class GeneratorContext; // code_generator.h
52 namespace java { 53 namespace java {
53 class ClassNameResolver; // name_resolver.h 54 class ClassNameResolver; // name_resolver.h
54 } 55 }
55 } 56 }
56 namespace io { 57 namespace io {
57 class Printer; // printer.h 58 class Printer; // printer.h
58 } 59 }
59 } 60 }
60 61
61 namespace protobuf { 62 namespace protobuf {
62 namespace compiler { 63 namespace compiler {
63 namespace java { 64 namespace java {
64 65
65 // A generator that generates code that are shared between immutable API 66 // A generator that generates code that are shared between immutable API
66 // and mutable API. Currently only descriptors are shared. 67 // and mutable API. Currently only descriptors are shared.
67 class SharedCodeGenerator { 68 class SharedCodeGenerator {
68 public: 69 public:
69 explicit SharedCodeGenerator(const FileDescriptor* file); 70 SharedCodeGenerator(const FileDescriptor* file, const Options& options);
70 ~SharedCodeGenerator(); 71 ~SharedCodeGenerator();
71 72
72 void Generate(GeneratorContext* generator_context, 73 void Generate(GeneratorContext* generator_context,
73 vector<string>* file_list); 74 std::vector<string>* file_list,
74 75 std::vector<string>* annotation_file_list);
75 void SetEnforceLite(bool value) {
76 enforce_lite_ = value;
77 }
78 76
79 void GenerateDescriptors(io::Printer* printer); 77 void GenerateDescriptors(io::Printer* printer);
80 78
81 private: 79 private:
82 // Returns whether the dependency should be included in the output file. 80 // Returns whether the dependency should be included in the output file.
83 // Always returns true for opensource, but used internally at Google to help 81 // Always returns true for opensource, but used internally at Google to help
84 // improve compatibility with version 1 of protocol buffers. 82 // improve compatibility with version 1 of protocol buffers.
85 bool ShouldIncludeDependency(const FileDescriptor* descriptor); 83 bool ShouldIncludeDependency(const FileDescriptor* descriptor);
86 84
87 google::protobuf::scoped_ptr<ClassNameResolver> name_resolver_; 85 google::protobuf::scoped_ptr<ClassNameResolver> name_resolver_;
88 bool enforce_lite_;
89 const FileDescriptor* file_; 86 const FileDescriptor* file_;
87 const Options options_;
90 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SharedCodeGenerator); 88 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SharedCodeGenerator);
91 }; 89 };
92 90
93 91
94 } // namespace java 92 } // namespace java
95 } // namespace compiler 93 } // namespace compiler
96 } // namespace protobuf 94 } // namespace protobuf
97 95
98 } // namespace google 96 } // namespace google
99 #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__ 97 #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_SHARED_CODE_GENERATOR_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698