Index: third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc |
index d6b1ddc5f8c82bec2d640efdfbaa4daf59477e44..226c2aa03b8094dfba184d3ccc750da8e76f91ef 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc |
+++ b/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc |
@@ -143,7 +143,7 @@ void ServiceGenerator::GenerateMethodSignatures( |
VirtualOrNon virtual_or_non, io::Printer* printer) { |
for (int i = 0; i < descriptor_->method_count(); i++) { |
const MethodDescriptor* method = descriptor_->method(i); |
- std::map<string, string> sub_vars; |
+ map<string, string> sub_vars; |
sub_vars["name"] = method->name(); |
sub_vars["input_type"] = ClassName(method->input_type(), true); |
sub_vars["output_type"] = ClassName(method->output_type(), true); |
@@ -161,7 +161,7 @@ void ServiceGenerator::GenerateMethodSignatures( |
void ServiceGenerator::GenerateDescriptorInitializer( |
io::Printer* printer, int index) { |
- std::map<string, string> vars; |
+ map<string, string> vars; |
vars["classname"] = descriptor_->name(); |
vars["index"] = SimpleItoa(index); |
@@ -172,20 +172,19 @@ void ServiceGenerator::GenerateDescriptorInitializer( |
// =================================================================== |
void ServiceGenerator::GenerateImplementation(io::Printer* printer) { |
- vars_["index"] = SimpleItoa(index_in_metadata_); |
- printer->Print( |
- vars_, |
- "$classname$::~$classname$() {}\n" |
- "\n" |
- "const ::google::protobuf::ServiceDescriptor* $classname$::descriptor() {\n" |
- " protobuf_AssignDescriptorsOnce();\n" |
- " return file_level_service_descriptors[$index$];\n" |
- "}\n" |
- "\n" |
- "const ::google::protobuf::ServiceDescriptor* $classname$::GetDescriptor() {\n" |
- " return descriptor();\n" |
- "}\n" |
- "\n"); |
+ printer->Print(vars_, |
+ "$classname$::~$classname$() {}\n" |
+ "\n" |
+ "const ::google::protobuf::ServiceDescriptor* $classname$::descriptor() {\n" |
+ " protobuf_AssignDescriptorsOnce();\n" |
+ " return $classname$_descriptor_;\n" |
+ "}\n" |
+ "\n" |
+ "const ::google::protobuf::ServiceDescriptor* $classname$::GetDescriptor() {\n" |
+ " protobuf_AssignDescriptorsOnce();\n" |
+ " return $classname$_descriptor_;\n" |
+ "}\n" |
+ "\n"); |
// Generate methods of the interface. |
GenerateNotImplementedMethods(printer); |
@@ -213,7 +212,7 @@ void ServiceGenerator::GenerateImplementation(io::Printer* printer) { |
void ServiceGenerator::GenerateNotImplementedMethods(io::Printer* printer) { |
for (int i = 0; i < descriptor_->method_count(); i++) { |
const MethodDescriptor* method = descriptor_->method(i); |
- std::map<string, string> sub_vars; |
+ map<string, string> sub_vars; |
sub_vars["classname"] = descriptor_->name(); |
sub_vars["name"] = method->name(); |
sub_vars["index"] = SimpleItoa(i); |
@@ -233,20 +232,18 @@ void ServiceGenerator::GenerateNotImplementedMethods(io::Printer* printer) { |
} |
void ServiceGenerator::GenerateCallMethod(io::Printer* printer) { |
- printer->Print( |
- vars_, |
- "void $classname$::CallMethod(const ::google::protobuf::MethodDescriptor* method,\n" |
- " ::google::protobuf::RpcController* controller,\n" |
- " const ::google::protobuf::Message* request,\n" |
- " ::google::protobuf::Message* response,\n" |
- " ::google::protobuf::Closure* done) {\n" |
- " GOOGLE_DCHECK_EQ(method->service(), " |
- "file_level_service_descriptors[$index$]);\n" |
- " switch(method->index()) {\n"); |
+ printer->Print(vars_, |
+ "void $classname$::CallMethod(const ::google::protobuf::MethodDescriptor* method,\n" |
+ " ::google::protobuf::RpcController* controller,\n" |
+ " const ::google::protobuf::Message* request,\n" |
+ " ::google::protobuf::Message* response,\n" |
+ " ::google::protobuf::Closure* done) {\n" |
+ " GOOGLE_DCHECK_EQ(method->service(), $classname$_descriptor_);\n" |
+ " switch(method->index()) {\n"); |
for (int i = 0; i < descriptor_->method_count(); i++) { |
const MethodDescriptor* method = descriptor_->method(i); |
- std::map<string, string> sub_vars; |
+ map<string, string> sub_vars; |
sub_vars["name"] = method->name(); |
sub_vars["index"] = SimpleItoa(i); |
sub_vars["input_type"] = ClassName(method->input_type(), true); |
@@ -292,7 +289,7 @@ void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which, |
const Descriptor* type = |
(which == REQUEST) ? method->input_type() : method->output_type(); |
- std::map<string, string> sub_vars; |
+ map<string, string> sub_vars; |
sub_vars["index"] = SimpleItoa(i); |
sub_vars["type"] = ClassName(type, true); |
@@ -301,21 +298,19 @@ void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which, |
" return $type$::default_instance();\n"); |
} |
- printer->Print( |
+ printer->Print(vars_, |
" default:\n" |
" GOOGLE_LOG(FATAL) << \"Bad method index; this should never happen.\";\n" |
- " return *::google::protobuf::MessageFactory::generated_factory()\n" |
- " ->GetPrototype(method->$input_or_output$_type());\n" |
+ " return *static_cast< ::google::protobuf::Message*>(NULL);\n" |
" }\n" |
"}\n" |
- "\n", |
- "input_or_output", which == REQUEST ? "input" : "output"); |
+ "\n"); |
} |
void ServiceGenerator::GenerateStubMethods(io::Printer* printer) { |
for (int i = 0; i < descriptor_->method_count(); i++) { |
const MethodDescriptor* method = descriptor_->method(i); |
- std::map<string, string> sub_vars; |
+ map<string, string> sub_vars; |
sub_vars["classname"] = descriptor_->name(); |
sub_vars["name"] = method->name(); |
sub_vars["index"] = SimpleItoa(i); |