diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/cpp_generator.cc | 6 | ||||
-rw-r--r-- | src/cpp/client/channel_cc.cc | 4 | ||||
-rw-r--r-- | src/cpp/common/completion_queue_cc.cc | 10 | ||||
-rw-r--r-- | src/cpp/server/server_cc.cc | 4 | ||||
-rw-r--r-- | src/cpp/server/server_context.cc | 16 |
5 files changed, 23 insertions, 17 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index fcff75a420..34d5beb653 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -926,8 +926,11 @@ void PrintHeaderServerMethodCallback( "Method$(context, request, response, controller);\n" " }, this));\n"); } else if (ClientOnlyStreaming(method)) { + // TODO(vjpai): Add in code generation for all streaming methods } else if (ServerOnlyStreaming(method)) { + // TODO(vjpai): Add in code generation for all streaming methods } else if (method->BidiStreaming()) { + // TODO(vjpai): Add in code generation for all streaming methods } printer->Print(*vars, "}\n"); printer->Print(*vars, @@ -975,8 +978,11 @@ void PrintHeaderServerMethodRawCallback( "Method$(context, request, response, controller);\n" " }, this));\n"); } else if (ClientOnlyStreaming(method)) { + // TODO(vjpai): Add in code generation for all streaming methods } else if (ServerOnlyStreaming(method)) { + // TODO(vjpai): Add in code generation for all streaming methods } else if (method->BidiStreaming()) { + // TODO(vjpai): Add in code generation for all streaming methods } printer->Print(*vars, "}\n"); printer->Print(*vars, diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index 15e3ccb3c9..f5c1b4e2c5 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -225,7 +225,7 @@ class ShutdownCallback : public grpc_experimental_completion_queue_functor { static void Run(grpc_experimental_completion_queue_functor* cb, int) { auto* callback = static_cast<ShutdownCallback*>(cb); delete callback->cq_; - grpc_core::Delete(callback); + delete callback; } private: @@ -238,7 +238,7 @@ CompletionQueue* Channel::CallbackCQ() { // if there is no explicit per-channel CQ registered std::lock_guard<std::mutex> l(mu_); if (callback_cq_ == nullptr) { - auto* shutdown_callback = grpc_core::New<ShutdownCallback>(); + auto* shutdown_callback = new ShutdownCallback; callback_cq_ = new CompletionQueue(grpc_completion_queue_attributes{ GRPC_CQ_CURRENT_VERSION, GRPC_CQ_CALLBACK, GRPC_CQ_DEFAULT_POLLING, shutdown_callback}); diff --git a/src/cpp/common/completion_queue_cc.cc b/src/cpp/common/completion_queue_cc.cc index 6893201e2e..d93a54aed7 100644 --- a/src/cpp/common/completion_queue_cc.cc +++ b/src/cpp/common/completion_queue_cc.cc @@ -60,10 +60,10 @@ CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal( case GRPC_QUEUE_SHUTDOWN: return SHUTDOWN; case GRPC_OP_COMPLETE: - auto cq_tag = static_cast<internal::CompletionQueueTag*>(ev.tag); + auto core_cq_tag = static_cast<internal::CompletionQueueTag*>(ev.tag); *ok = ev.success != 0; - *tag = cq_tag; - if (cq_tag->FinalizeResult(tag, ok)) { + *tag = core_cq_tag; + if (core_cq_tag->FinalizeResult(tag, ok)) { return GOT_EVENT; } break; @@ -87,9 +87,9 @@ bool CompletionQueue::CompletionQueueTLSCache::Flush(void** tag, bool* ok) { flushed_ = true; if (grpc_completion_queue_thread_local_cache_flush(cq_->cq_, &res_tag, &res)) { - auto cq_tag = static_cast<internal::CompletionQueueTag*>(res_tag); + auto core_cq_tag = static_cast<internal::CompletionQueueTag*>(res_tag); *ok = res == 1; - if (cq_tag->FinalizeResult(tag, ok)) { + if (core_cq_tag->FinalizeResult(tag, ok)) { return true; } } diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index a9f0315af6..870ee84e3e 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -1111,7 +1111,7 @@ class ShutdownCallback : public grpc_experimental_completion_queue_functor { static void Run(grpc_experimental_completion_queue_functor* cb, int) { auto* callback = static_cast<ShutdownCallback*>(cb); delete callback->cq_; - grpc_core::Delete(callback); + delete callback; } private: @@ -1124,7 +1124,7 @@ CompletionQueue* Server::CallbackCQ() { // if there is no explicit per-server CQ registered std::lock_guard<std::mutex> l(mu_); if (callback_cq_ == nullptr) { - auto* shutdown_callback = grpc_core::New<ShutdownCallback>(); + auto* shutdown_callback = new ShutdownCallback; callback_cq_ = new CompletionQueue(grpc_completion_queue_attributes{ GRPC_CQ_CURRENT_VERSION, GRPC_CQ_CALLBACK, GRPC_CQ_DEFAULT_POLLING, shutdown_callback}); diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 8ded7a8972..355debb3fb 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -45,7 +45,7 @@ class ServerContext::CompletionOp final : public internal::CallOpSetInterface { : call_(*call), has_tag_(false), tag_(nullptr), - cq_tag_(this), + core_cq_tag_(this), refs_(2), finalized_(false), cancelled_(0), @@ -92,9 +92,9 @@ class ServerContext::CompletionOp final : public internal::CallOpSetInterface { tag_ = tag; } - void set_cq_tag(void* cq_tag) { cq_tag_ = cq_tag; } + void set_core_cq_tag(void* core_cq_tag) { core_cq_tag_ = core_cq_tag; } - void* cq_tag() override { return cq_tag_; } + void* core_cq_tag() override { return core_cq_tag_; } void Unref(); @@ -138,7 +138,7 @@ class ServerContext::CompletionOp final : public internal::CallOpSetInterface { internal::Call call_; bool has_tag_; void* tag_; - void* cq_tag_; + void* core_cq_tag_; std::mutex mu_; int refs_; bool finalized_; @@ -166,8 +166,8 @@ void ServerContext::CompletionOp::FillOps(internal::Call* call) { interceptor_methods_.SetCall(&call_); interceptor_methods_.SetReverse(); interceptor_methods_.SetCallOpSetInterface(this); - GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call->call(), &ops, 1, cq_tag_, nullptr)); + GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call->call(), &ops, 1, + core_cq_tag_, nullptr)); /* No interceptors to run here */ } @@ -272,7 +272,7 @@ void ServerContext::BeginCompletionOp(internal::Call* call, bool callback) { if (callback) { completion_tag_ = internal::CallbackWithSuccessTag(call->call(), nullptr, completion_op_); - completion_op_->set_cq_tag(&completion_tag_); + completion_op_->set_core_cq_tag(&completion_tag_); } else if (has_notify_when_done_tag_) { completion_op_->set_tag(async_notify_when_done_tag_); } @@ -305,7 +305,7 @@ bool ServerContext::IsCancelled() const { if (completion_tag_) { // When using callback API, this result is always valid. return completion_op_->CheckCancelledAsync(); - } else if (completion_tag_ || has_notify_when_done_tag_) { + } else if (has_notify_when_done_tag_) { // When using async API, the result is only valid // if the tag has already been delivered at the completion queue return completion_op_ && completion_op_->CheckCancelledAsync(); |