aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl/codegen/proto_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc++/impl/codegen/proto_utils.h')
-rw-r--r--include/grpc++/impl/codegen/proto_utils.h23
1 files changed, 8 insertions, 15 deletions
diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h
index ce177104e0..f77f8eebb3 100644
--- a/include/grpc++/impl/codegen/proto_utils.h
+++ b/include/grpc++/impl/codegen/proto_utils.h
@@ -36,22 +36,16 @@
#include <type_traits>
-#include <grpc/impl/codegen/byte_buffer.h>
-#include <grpc++/impl/codegen/serialization_traits.h>
#include <grpc++/impl/codegen/config_protobuf.h>
+#include <grpc++/impl/codegen/core_codegen_interface.h>
+#include <grpc++/impl/codegen/serialization_traits.h>
#include <grpc++/impl/codegen/status.h>
+#include <grpc/impl/codegen/byte_buffer.h>
+#include <grpc/impl/codegen/log.h>
namespace grpc {
-// Serialize the msg into a buffer created inside the function. The caller
-// should destroy the returned buffer when done with it. If serialization fails,
-// false is returned and buffer is left unchanged.
-Status SerializeProto(const grpc::protobuf::Message& msg,
- grpc_byte_buffer** buffer);
-
-// The caller keeps ownership of buffer and msg.
-Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg,
- int max_message_size);
+extern CoreCodegenInterface* g_core_codegen_interface;
template <class T>
class SerializationTraits<T, typename std::enable_if<std::is_base_of<
@@ -60,14 +54,13 @@ class SerializationTraits<T, typename std::enable_if<std::is_base_of<
static Status Serialize(const grpc::protobuf::Message& msg,
grpc_byte_buffer** buffer, bool* own_buffer) {
*own_buffer = true;
- return SerializeProto(msg, buffer);
+ return g_core_codegen_interface->SerializeProto(msg, buffer);
}
static Status Deserialize(grpc_byte_buffer* buffer,
grpc::protobuf::Message* msg,
int max_message_size) {
- auto status = DeserializeProto(buffer, msg, max_message_size);
- grpc_byte_buffer_destroy(buffer);
- return status;
+ return g_core_codegen_interface->DeserializeProto(buffer, msg,
+ max_message_size);
}
};