aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl/codegen
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2016-09-15 11:21:52 -0700
committerGravatar Yuchen Zeng <zyc@google.com>2016-09-15 11:21:52 -0700
commit66f3a4bbdf9837056cc2ae256c318b0e0929d3fa (patch)
treeafaf5b2b92477726f97f9d0d426134366c91583d /include/grpc++/impl/codegen
parentaed2b683cc711778178287b117968aeee39b8998 (diff)
parent500ca305b174a627abf3aa6511fea27d0ade4f36 (diff)
Merge remote-tracking branch 'upstream/master' into fix_gprc
Diffstat (limited to 'include/grpc++/impl/codegen')
-rw-r--r--include/grpc++/impl/codegen/async_unary_call.h1
-rw-r--r--include/grpc++/impl/codegen/call.h1
-rw-r--r--include/grpc++/impl/codegen/client_context.h2
-rw-r--r--include/grpc++/impl/codegen/completion_queue.h3
-rw-r--r--include/grpc++/impl/codegen/core_codegen.h12
-rw-r--r--include/grpc++/impl/codegen/core_codegen_interface.h18
-rw-r--r--include/grpc++/impl/codegen/grpc_library.h1
-rw-r--r--include/grpc++/impl/codegen/proto_utils.h3
-rw-r--r--include/grpc++/impl/codegen/rpc_service_method.h5
-rw-r--r--include/grpc++/impl/codegen/server_context.h1
-rw-r--r--include/grpc++/impl/codegen/server_interface.h7
-rw-r--r--include/grpc++/impl/codegen/sync_no_cxx11.h28
-rw-r--r--include/grpc++/impl/codegen/sync_stream.h1
-rw-r--r--include/grpc++/impl/codegen/thrift_serializer.h4
-rw-r--r--include/grpc++/impl/codegen/thrift_utils.h2
-rw-r--r--include/grpc++/impl/codegen/time.h4
16 files changed, 62 insertions, 31 deletions
diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h
index 5ceab73cea..87c94d6507 100644
--- a/include/grpc++/impl/codegen/async_unary_call.h
+++ b/include/grpc++/impl/codegen/async_unary_call.h
@@ -40,7 +40,6 @@
#include <grpc++/impl/codegen/server_context.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
-#include <grpc/impl/codegen/log.h>
namespace grpc {
diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h
index df225d362b..42213571dd 100644
--- a/include/grpc++/impl/codegen/call.h
+++ b/include/grpc++/impl/codegen/call.h
@@ -48,7 +48,6 @@
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/string_ref.h>
-#include <grpc/impl/codegen/alloc.h>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/grpc_types.h>
diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h
index 9fecb5043e..387d807c4b 100644
--- a/include/grpc++/impl/codegen/client_context.h
+++ b/include/grpc++/impl/codegen/client_context.h
@@ -62,9 +62,7 @@
#include <grpc++/impl/codegen/sync.h>
#include <grpc++/impl/codegen/time.h>
#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/impl/codegen/log.h>
#include <grpc/impl/codegen/propagation_bits.h>
-#include <grpc/impl/codegen/time.h>
struct census_context;
struct grpc_call;
diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h
index d5a409a082..ef00163b7e 100644
--- a/include/grpc++/impl/codegen/completion_queue.h
+++ b/include/grpc++/impl/codegen/completion_queue.h
@@ -52,7 +52,6 @@
#include <grpc++/impl/codegen/grpc_library.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/time.h>
-#include <grpc/impl/codegen/time.h>
struct grpc_completion_queue;
@@ -219,7 +218,7 @@ class CompletionQueue : private GrpcLibraryCodegen {
/// Performs a single polling pluck on \a tag.
/// \warning Must not be mixed with calls to \a Next.
void TryPluck(CompletionQueueTag* tag) {
- auto deadline = gpr_time_0(GPR_CLOCK_REALTIME);
+ auto deadline = g_core_codegen_interface->gpr_time_0(GPR_CLOCK_REALTIME);
auto ev = g_core_codegen_interface->grpc_completion_queue_pluck(
cq_, tag, deadline, nullptr);
if (ev.type == GRPC_QUEUE_TIMEOUT) return;
diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h
index 2586b94504..0ce009e69d 100644
--- a/include/grpc++/impl/codegen/core_codegen.h
+++ b/include/grpc++/impl/codegen/core_codegen.h
@@ -55,6 +55,17 @@ class CoreCodegen : public CoreCodegenInterface {
void* gpr_malloc(size_t size) GRPC_OVERRIDE;
void gpr_free(void* p) GRPC_OVERRIDE;
+ void gpr_mu_init(gpr_mu* mu) GRPC_OVERRIDE;
+ void gpr_mu_destroy(gpr_mu* mu) GRPC_OVERRIDE;
+ void gpr_mu_lock(gpr_mu* mu) GRPC_OVERRIDE;
+ void gpr_mu_unlock(gpr_mu* mu) GRPC_OVERRIDE;
+ void gpr_cv_init(gpr_cv* cv) GRPC_OVERRIDE;
+ void gpr_cv_destroy(gpr_cv* cv) GRPC_OVERRIDE;
+ int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
+ gpr_timespec abs_deadline) GRPC_OVERRIDE;
+ void gpr_cv_signal(gpr_cv* cv) GRPC_OVERRIDE;
+ void gpr_cv_broadcast(gpr_cv* cv) GRPC_OVERRIDE;
+
void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE;
int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
@@ -78,6 +89,7 @@ class CoreCodegen : public CoreCodegenInterface {
void grpc_metadata_array_destroy(grpc_metadata_array* array) GRPC_OVERRIDE;
gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE;
+ gpr_timespec gpr_time_0(gpr_clock_type type) GRPC_OVERRIDE;
virtual const Status& ok() GRPC_OVERRIDE;
virtual const Status& cancelled() GRPC_OVERRIDE;
diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h
index f9a8f9b980..68851f15c6 100644
--- a/include/grpc++/impl/codegen/core_codegen_interface.h
+++ b/include/grpc++/impl/codegen/core_codegen_interface.h
@@ -36,7 +36,13 @@
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/status.h>
+#include <grpc/impl/codegen/byte_buffer_reader.h>
#include <grpc/impl/codegen/grpc_types.h>
+#include <grpc/impl/codegen/sync.h>
+
+extern "C" {
+struct grpc_byte_buffer;
+}
namespace grpc {
@@ -63,6 +69,17 @@ class CoreCodegenInterface {
virtual void* gpr_malloc(size_t size) = 0;
virtual void gpr_free(void* p) = 0;
+ virtual void gpr_mu_init(gpr_mu* mu) = 0;
+ virtual void gpr_mu_destroy(gpr_mu* mu) = 0;
+ virtual void gpr_mu_lock(gpr_mu* mu) = 0;
+ virtual void gpr_mu_unlock(gpr_mu* mu) = 0;
+ virtual void gpr_cv_init(gpr_cv* cv) = 0;
+ virtual void gpr_cv_destroy(gpr_cv* cv) = 0;
+ virtual int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
+ gpr_timespec abs_deadline) = 0;
+ virtual void gpr_cv_signal(gpr_cv* cv) = 0;
+ virtual void gpr_cv_broadcast(gpr_cv* cv) = 0;
+
virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0;
virtual int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
@@ -89,6 +106,7 @@ class CoreCodegenInterface {
virtual const Status& cancelled() = 0;
virtual gpr_timespec gpr_inf_future(gpr_clock_type type) = 0;
+ virtual gpr_timespec gpr_time_0(gpr_clock_type type) = 0;
};
extern CoreCodegenInterface* g_core_codegen_interface;
diff --git a/include/grpc++/impl/codegen/grpc_library.h b/include/grpc++/impl/codegen/grpc_library.h
index 3cdc6f3f7c..2b11aff214 100644
--- a/include/grpc++/impl/codegen/grpc_library.h
+++ b/include/grpc++/impl/codegen/grpc_library.h
@@ -35,7 +35,6 @@
#define GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
#include <grpc++/impl/codegen/core_codegen_interface.h>
-#include <grpc/impl/codegen/log.h>
namespace grpc {
diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h
index d4599c5fff..d2e0f6fcdd 100644
--- a/include/grpc++/impl/codegen/proto_utils.h
+++ b/include/grpc++/impl/codegen/proto_utils.h
@@ -40,9 +40,8 @@
#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/byte_buffer_reader.h>
-#include <grpc/impl/codegen/log.h>
+#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/slice.h>
namespace grpc {
diff --git a/include/grpc++/impl/codegen/rpc_service_method.h b/include/grpc++/impl/codegen/rpc_service_method.h
index 52124fba0b..88da0965c8 100644
--- a/include/grpc++/impl/codegen/rpc_service_method.h
+++ b/include/grpc++/impl/codegen/rpc_service_method.h
@@ -43,7 +43,10 @@
#include <grpc++/impl/codegen/config.h>
#include <grpc++/impl/codegen/rpc_method.h>
#include <grpc++/impl/codegen/status.h>
-#include <grpc/impl/codegen/byte_buffer.h>
+
+extern "C" {
+struct grpc_byte_buffer;
+}
namespace grpc {
class ServerContext;
diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h
index 379c9f7cf8..bce8d2c2f8 100644
--- a/include/grpc++/impl/codegen/server_context.h
+++ b/include/grpc++/impl/codegen/server_context.h
@@ -43,7 +43,6 @@
#include <grpc++/impl/codegen/string_ref.h>
#include <grpc++/impl/codegen/time.h>
#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/impl/codegen/time.h>
struct gpr_timespec;
struct grpc_metadata;
diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h
index 3a3e052d9e..1f1b714cbf 100644
--- a/include/grpc++/impl/codegen/server_interface.h
+++ b/include/grpc++/impl/codegen/server_interface.h
@@ -52,6 +52,8 @@ class ServerCredentials;
class Service;
class ThreadPoolInterface;
+extern CoreCodegenInterface* g_core_codegen_interface;
+
/// Models a gRPC server.
///
/// Servers are configured and started via \a grpc::ServerBuilder.
@@ -78,7 +80,10 @@ class ServerInterface : public CallHook {
/// All completion queue associated with the server (for example, for async
/// serving) must be shutdown *after* this method has returned:
/// See \a ServerBuilder::AddCompletionQueue for details.
- void Shutdown() { ShutdownInternal(gpr_inf_future(GPR_CLOCK_MONOTONIC)); }
+ void Shutdown() {
+ ShutdownInternal(
+ g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_MONOTONIC));
+ }
/// Block waiting for all work to complete.
///
diff --git a/include/grpc++/impl/codegen/sync_no_cxx11.h b/include/grpc++/impl/codegen/sync_no_cxx11.h
index 55c059ede7..87a6594f7d 100644
--- a/include/grpc++/impl/codegen/sync_no_cxx11.h
+++ b/include/grpc++/impl/codegen/sync_no_cxx11.h
@@ -34,18 +34,20 @@
#ifndef GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H
#define GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H
-#include <grpc/impl/codegen/sync.h>
+#include <grpc++/impl/codegen/core_codegen_interface.h>
namespace grpc {
+extern CoreCodegenInterface *g_core_codegen_interface;
+
template <class mutex>
class lock_guard;
class condition_variable;
class mutex {
public:
- mutex() { gpr_mu_init(&mu_); }
- ~mutex() { gpr_mu_destroy(&mu_); }
+ mutex() { g_core_codegen_interface->gpr_mu_init(&mu_); }
+ ~mutex() { g_core_codegen_interface->gpr_mu_destroy(&mu_); }
private:
::gpr_mu mu_;
@@ -57,16 +59,18 @@ class mutex {
template <class mutex>
class lock_guard {
public:
- lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); }
+ lock_guard(mutex &mu) : mu_(mu), locked(true) {
+ g_core_codegen_interface->gpr_mu_lock(&mu.mu_);
+ }
~lock_guard() { unlock_internal(); }
protected:
void lock_internal() {
- if (!locked) gpr_mu_lock(&mu_.mu_);
+ if (!locked) g_core_codegen_interface->gpr_mu_lock(&mu_.mu_);
locked = true;
}
void unlock_internal() {
- if (locked) gpr_mu_unlock(&mu_.mu_);
+ if (locked) g_core_codegen_interface->gpr_mu_unlock(&mu_.mu_);
locked = false;
}
@@ -86,15 +90,17 @@ class unique_lock : public lock_guard<mutex> {
class condition_variable {
public:
- condition_variable() { gpr_cv_init(&cv_); }
- ~condition_variable() { gpr_cv_destroy(&cv_); }
+ condition_variable() { g_core_codegen_interface->gpr_cv_init(&cv_); }
+ ~condition_variable() { g_core_codegen_interface->gpr_cv_destroy(&cv_); }
void wait(lock_guard<mutex> &mu) {
mu.locked = false;
- gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future(GPR_CLOCK_REALTIME));
+ g_core_codegen_interface->gpr_cv_wait(
+ &cv_, &mu.mu_.mu_,
+ g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_REALTIME));
mu.locked = true;
}
- void notify_one() { gpr_cv_signal(&cv_); }
- void notify_all() { gpr_cv_broadcast(&cv_); }
+ void notify_one() { g_core_codegen_interface->gpr_cv_signal(&cv_); }
+ void notify_all() { g_core_codegen_interface->gpr_cv_broadcast(&cv_); }
private:
gpr_cv cv_;
diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h
index e1d4660ae7..aba129811b 100644
--- a/include/grpc++/impl/codegen/sync_stream.h
+++ b/include/grpc++/impl/codegen/sync_stream.h
@@ -42,7 +42,6 @@
#include <grpc++/impl/codegen/server_context.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
-#include <grpc/impl/codegen/log.h>
namespace grpc {
diff --git a/include/grpc++/impl/codegen/thrift_serializer.h b/include/grpc++/impl/codegen/thrift_serializer.h
index 7308a1577c..fd324a994f 100644
--- a/include/grpc++/impl/codegen/thrift_serializer.h
+++ b/include/grpc++/impl/codegen/thrift_serializer.h
@@ -34,10 +34,8 @@
#ifndef GRPCXX_IMPL_CODEGEN_THRIFT_SERIALIZER_H
#define GRPCXX_IMPL_CODEGEN_THRIFT_SERIALIZER_H
-#include <grpc/impl/codegen/byte_buffer.h>
#include <grpc/impl/codegen/byte_buffer_reader.h>
#include <grpc/impl/codegen/slice.h>
-#include <grpc/impl/codegen/slice_buffer.h>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/protocol/TCompactProtocol.h>
#include <thrift/protocol/TProtocolException.h>
@@ -216,4 +214,4 @@ typedef ThriftSerializer<void, TCompactProtocolT<TBufferBase>>
} // namespace thrift
} // namespace apache
-#endif \ No newline at end of file
+#endif
diff --git a/include/grpc++/impl/codegen/thrift_utils.h b/include/grpc++/impl/codegen/thrift_utils.h
index 7d19b247f4..be558c5789 100644
--- a/include/grpc++/impl/codegen/thrift_utils.h
+++ b/include/grpc++/impl/codegen/thrift_utils.h
@@ -40,10 +40,8 @@
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/status_code_enum.h>
#include <grpc++/impl/codegen/thrift_serializer.h>
-#include <grpc/impl/codegen/byte_buffer.h>
#include <grpc/impl/codegen/byte_buffer_reader.h>
#include <grpc/impl/codegen/slice.h>
-#include <grpc/impl/codegen/slice_buffer.h>
#include <cstdint>
#include <cstdlib>
diff --git a/include/grpc++/impl/codegen/time.h b/include/grpc++/impl/codegen/time.h
index d9b19bce64..87c5112d0d 100644
--- a/include/grpc++/impl/codegen/time.h
+++ b/include/grpc++/impl/codegen/time.h
@@ -35,7 +35,7 @@
#define GRPCXX_IMPL_CODEGEN_TIME_H
#include <grpc++/impl/codegen/config.h>
-#include <grpc/impl/codegen/time.h>
+#include <grpc/impl/codegen/grpc_types.h>
namespace grpc {
@@ -79,7 +79,7 @@ class TimePoint<gpr_timespec> {
#include <chrono>
-#include <grpc/impl/codegen/time.h>
+#include <grpc/impl/codegen/grpc_types.h>
namespace grpc {