Revert "Avoid fully qualifying namespaces (and add check) (#28901)" (#28916)

This reverts commit fc7314c701.
This commit is contained in:
AJ Heller 2022-02-17 17:56:19 -08:00 committed by GitHub
parent fc7314c701
commit e72a5fe5dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
135 changed files with 1176 additions and 1268 deletions

View File

@ -32,7 +32,7 @@
namespace grpc { namespace grpc {
class Alarm : private grpc::GrpcLibraryCodegen { class Alarm : private ::grpc::GrpcLibraryCodegen {
public: public:
/// Create an unset completion queue alarm /// Create an unset completion queue alarm
Alarm(); Alarm();
@ -48,8 +48,8 @@ class Alarm : private grpc::GrpcLibraryCodegen {
/// internal::GrpcLibraryInitializer instance would need to be introduced /// internal::GrpcLibraryInitializer instance would need to be introduced
/// here. \endinternal. /// here. \endinternal.
template <typename T> template <typename T>
Alarm(grpc::CompletionQueue* cq, const T& deadline, void* tag) : Alarm() { Alarm(::grpc::CompletionQueue* cq, const T& deadline, void* tag) : Alarm() {
SetInternal(cq, grpc::TimePoint<T>(deadline).raw_time(), tag); SetInternal(cq, ::grpc::TimePoint<T>(deadline).raw_time(), tag);
} }
/// Trigger an alarm instance on completion queue \a cq at the specified time. /// Trigger an alarm instance on completion queue \a cq at the specified time.
@ -61,8 +61,8 @@ class Alarm : private grpc::GrpcLibraryCodegen {
// setting an immediate deadline. Such usage allows synchronizing an external // setting an immediate deadline. Such usage allows synchronizing an external
// event with an application's \a grpc::CompletionQueue::Next loop. // event with an application's \a grpc::CompletionQueue::Next loop.
template <typename T> template <typename T>
void Set(grpc::CompletionQueue* cq, const T& deadline, void* tag) { void Set(::grpc::CompletionQueue* cq, const T& deadline, void* tag) {
SetInternal(cq, grpc::TimePoint<T>(deadline).raw_time(), tag); SetInternal(cq, ::grpc::TimePoint<T>(deadline).raw_time(), tag);
} }
/// Alarms aren't copyable. /// Alarms aren't copyable.
@ -86,14 +86,15 @@ class Alarm : private grpc::GrpcLibraryCodegen {
/// (false) /// (false)
template <typename T> template <typename T>
void Set(const T& deadline, std::function<void(bool)> f) { void Set(const T& deadline, std::function<void(bool)> f) {
SetInternal(grpc::TimePoint<T>(deadline).raw_time(), std::move(f)); SetInternal(::grpc::TimePoint<T>(deadline).raw_time(), std::move(f));
} }
private: private:
void SetInternal(grpc::CompletionQueue* cq, gpr_timespec deadline, void* tag); void SetInternal(::grpc::CompletionQueue* cq, gpr_timespec deadline,
void* tag);
void SetInternal(gpr_timespec deadline, std::function<void(bool)> f); void SetInternal(gpr_timespec deadline, std::function<void(bool)> f);
grpc::internal::CompletionQueueTag* alarm_; ::grpc::internal::CompletionQueueTag* alarm_;
}; };
} // namespace grpc } // namespace grpc

View File

@ -51,10 +51,10 @@ void ChannelResetConnectionBackoff(Channel* channel);
} // namespace experimental } // namespace experimental
/// Channels represent a connection to an endpoint. Created by \a CreateChannel. /// Channels represent a connection to an endpoint. Created by \a CreateChannel.
class Channel final : public grpc::ChannelInterface, class Channel final : public ::grpc::ChannelInterface,
public grpc::internal::CallHook, public ::grpc::internal::CallHook,
public std::enable_shared_from_this<Channel>, public std::enable_shared_from_this<Channel>,
private grpc::GrpcLibraryCodegen { private ::grpc::GrpcLibraryCodegen {
public: public:
~Channel() override; ~Channel() override;
@ -71,38 +71,38 @@ class Channel final : public grpc::ChannelInterface,
private: private:
template <class InputMessage, class OutputMessage> template <class InputMessage, class OutputMessage>
friend class grpc::internal::BlockingUnaryCallImpl; friend class ::grpc::internal::BlockingUnaryCallImpl;
friend class grpc::testing::ChannelTestPeer; friend class ::grpc::testing::ChannelTestPeer;
friend void experimental::ChannelResetConnectionBackoff(Channel* channel); friend void experimental::ChannelResetConnectionBackoff(Channel* channel);
friend std::shared_ptr<Channel> grpc::CreateChannelInternal( friend std::shared_ptr<Channel> grpc::CreateChannelInternal(
const std::string& host, grpc_channel* c_channel, const std::string& host, grpc_channel* c_channel,
std::vector<std::unique_ptr< std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>> ::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators); interceptor_creators);
friend class grpc::internal::InterceptedChannel; friend class ::grpc::internal::InterceptedChannel;
Channel(const std::string& host, grpc_channel* c_channel, Channel(const std::string& host, grpc_channel* c_channel,
std::vector<std::unique_ptr< std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>> ::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators); interceptor_creators);
grpc::internal::Call CreateCall(const grpc::internal::RpcMethod& method, ::grpc::internal::Call CreateCall(const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, ::grpc::ClientContext* context,
grpc::CompletionQueue* cq) override; ::grpc::CompletionQueue* cq) override;
void PerformOpsOnCall(grpc::internal::CallOpSetInterface* ops, void PerformOpsOnCall(::grpc::internal::CallOpSetInterface* ops,
grpc::internal::Call* call) override; ::grpc::internal::Call* call) override;
void* RegisterMethod(const char* method) override; void* RegisterMethod(const char* method) override;
void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline, grpc::CompletionQueue* cq, gpr_timespec deadline,
void* tag) override; ::grpc::CompletionQueue* cq, void* tag) override;
bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) override; gpr_timespec deadline) override;
grpc::CompletionQueue* CallbackCQ() override; ::grpc::CompletionQueue* CallbackCQ() override;
grpc::internal::Call CreateCallInternal( ::grpc::internal::Call CreateCallInternal(
const grpc::internal::RpcMethod& method, grpc::ClientContext* context, const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
grpc::CompletionQueue* cq, size_t interceptor_pos) override; ::grpc::CompletionQueue* cq, size_t interceptor_pos) override;
const std::string host_; const std::string host_;
grpc_channel* const c_channel_; // owned grpc_channel* const c_channel_; // owned

View File

@ -28,7 +28,7 @@ class ServerInitializer;
namespace reflection { namespace reflection {
class ProtoServerReflectionPlugin : public grpc::ServerBuilderPlugin { class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin {
public: public:
ProtoServerReflectionPlugin(); ProtoServerReflectionPlugin();
::std::string name() override; ::std::string name() override;

View File

@ -37,7 +37,7 @@ namespace experimental {
class LoadReportingServiceServerBuilderOption class LoadReportingServiceServerBuilderOption
: public grpc::ServerBuilderOption { : public grpc::ServerBuilderOption {
public: public:
void UpdateArguments(grpc::ChannelArguments* args) override; void UpdateArguments(::grpc::ChannelArguments* args) override;
void UpdatePlugins(std::vector<std::unique_ptr<::grpc::ServerBuilderPlugin>>* void UpdatePlugins(std::vector<std::unique_ptr<::grpc::ServerBuilderPlugin>>*
plugins) override; plugins) override;
}; };

View File

@ -53,7 +53,7 @@ class TemplatedGenericStub final {
/// succeeded (i.e. the call won't proceed if the return value is nullptr). /// succeeded (i.e. the call won't proceed if the return value is nullptr).
std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>> std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>
PrepareCall(ClientContext* context, const std::string& method, PrepareCall(ClientContext* context, const std::string& method,
grpc::CompletionQueue* cq) { ::grpc::CompletionQueue* cq) {
return CallInternal(channel_.get(), context, method, /*options=*/{}, cq, return CallInternal(channel_.get(), context, method, /*options=*/{}, cq,
false, nullptr); false, nullptr);
} }
@ -64,7 +64,7 @@ class TemplatedGenericStub final {
/// succeeded (i.e. the call won't proceed if the return value is nullptr). /// succeeded (i.e. the call won't proceed if the return value is nullptr).
std::unique_ptr<ClientAsyncResponseReader<ResponseType>> PrepareUnaryCall( std::unique_ptr<ClientAsyncResponseReader<ResponseType>> PrepareUnaryCall(
ClientContext* context, const std::string& method, ClientContext* context, const std::string& method,
const RequestType& request, grpc::CompletionQueue* cq) { const RequestType& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr<ClientAsyncResponseReader<ResponseType>>( return std::unique_ptr<ClientAsyncResponseReader<ResponseType>>(
internal::ClientAsyncResponseReaderHelper::Create<ResponseType>( internal::ClientAsyncResponseReaderHelper::Create<ResponseType>(
channel_.get(), cq, channel_.get(), cq,
@ -82,7 +82,7 @@ class TemplatedGenericStub final {
/// succeeded (i.e. the call won't proceed if the return value is nullptr). /// succeeded (i.e. the call won't proceed if the return value is nullptr).
std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>> Call( std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>> Call(
ClientContext* context, const std::string& method, ClientContext* context, const std::string& method,
grpc::CompletionQueue* cq, void* tag) { ::grpc::CompletionQueue* cq, void* tag) {
return CallInternal(channel_.get(), context, method, /*options=*/{}, cq, return CallInternal(channel_.get(), context, method, /*options=*/{}, cq,
true, tag); true, tag);
} }
@ -157,7 +157,7 @@ class TemplatedGenericStub final {
std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>> std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>
CallInternal(grpc::ChannelInterface* channel, ClientContext* context, CallInternal(grpc::ChannelInterface* channel, ClientContext* context,
const std::string& method, StubOptions options, const std::string& method, StubOptions options,
grpc::CompletionQueue* cq, bool start, void* tag) { ::grpc::CompletionQueue* cq, bool start, void* tag) {
return std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>( return std::unique_ptr<ClientAsyncReaderWriter<RequestType, ResponseType>>(
internal::ClientAsyncReaderWriterFactory<RequestType, ResponseType>:: internal::ClientAsyncReaderWriterFactory<RequestType, ResponseType>::
Create(channel, cq, Create(channel, cq,

View File

@ -73,8 +73,8 @@ class AsyncGenericService final {
void RequestCall(GenericServerContext* ctx, void RequestCall(GenericServerContext* ctx,
GenericServerAsyncReaderWriter* reader_writer, GenericServerAsyncReaderWriter* reader_writer,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag); ::grpc::ServerCompletionQueue* notification_cq, void* tag);
private: private:
friend class grpc::Server; friend class grpc::Server;
@ -92,7 +92,7 @@ class GenericCallbackServerContext final : public grpc::CallbackServerContext {
const std::string& host() const { return host_; } const std::string& host() const { return host_; }
private: private:
friend class grpc::Server; friend class ::grpc::Server;
std::string method_; std::string method_;
std::string host_; std::string host_;
@ -124,7 +124,7 @@ class CallbackGenericService {
internal::CallbackBidiHandler<ByteBuffer, ByteBuffer>* Handler() { internal::CallbackBidiHandler<ByteBuffer, ByteBuffer>* Handler() {
return new internal::CallbackBidiHandler<ByteBuffer, ByteBuffer>( return new internal::CallbackBidiHandler<ByteBuffer, ByteBuffer>(
[this](grpc::CallbackServerContext* ctx) { [this](::grpc::CallbackServerContext* ctx) {
return CreateReactor(static_cast<GenericCallbackServerContext*>(ctx)); return CreateReactor(static_cast<GenericCallbackServerContext*>(ctx));
}); });
} }

View File

@ -75,7 +75,7 @@ class ClientAsyncStreamingInterface {
/// ///
/// \param[in] tag Tag identifying this request. /// \param[in] tag Tag identifying this request.
/// \param[out] status To be updated with the operation status. /// \param[out] status To be updated with the operation status.
virtual void Finish(grpc::Status* status, void* tag) = 0; virtual void Finish(::grpc::Status* status, void* tag) = 0;
}; };
/// An interface that yields a sequence of messages of type \a R. /// An interface that yields a sequence of messages of type \a R.
@ -135,7 +135,7 @@ class AsyncWriterInterface {
/// \param[in] msg The message to be written. /// \param[in] msg The message to be written.
/// \param[in] options The WriteOptions to be used to write this message. /// \param[in] options The WriteOptions to be used to write this message.
/// \param[in] tag The tag identifying the operation. /// \param[in] tag The tag identifying the operation.
virtual void Write(const W& msg, grpc::WriteOptions options, void* tag) = 0; virtual void Write(const W& msg, ::grpc::WriteOptions options, void* tag) = 0;
/// Request the writing of \a msg and coalesce it with the writing /// Request the writing of \a msg and coalesce it with the writing
/// of trailing metadata, using WriteOptions \a options with /// of trailing metadata, using WriteOptions \a options with
@ -155,7 +155,7 @@ class AsyncWriterInterface {
/// \param[in] msg The message to be written. /// \param[in] msg The message to be written.
/// \param[in] options The WriteOptions to be used to write this message. /// \param[in] options The WriteOptions to be used to write this message.
/// \param[in] tag The tag identifying the operation. /// \param[in] tag The tag identifying the operation.
void WriteLast(const W& msg, grpc::WriteOptions options, void* tag) { void WriteLast(const W& msg, ::grpc::WriteOptions options, void* tag) {
Write(msg, options.set_last_message(), tag); Write(msg, options.set_last_message(), tag);
} }
}; };
@ -179,13 +179,13 @@ class ClientAsyncReaderFactory {
/// Note that \a context will be used to fill in custom initial metadata /// Note that \a context will be used to fill in custom initial metadata
/// used to send to the server when starting the call. /// used to send to the server when starting the call.
template <class W> template <class W>
static ClientAsyncReader<R>* Create(grpc::ChannelInterface* channel, static ClientAsyncReader<R>* Create(::grpc::ChannelInterface* channel,
grpc::CompletionQueue* cq, ::grpc::CompletionQueue* cq,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, ::grpc::ClientContext* context,
const W& request, bool start, void* tag) { const W& request, bool start, void* tag) {
grpc::internal::Call call = channel->CreateCall(method, context, cq); ::grpc::internal::Call call = channel->CreateCall(method, context, cq);
return new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( return new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientAsyncReader<R>))) call.call(), sizeof(ClientAsyncReader<R>)))
ClientAsyncReader<R>(call, context, request, start, tag); ClientAsyncReader<R>(call, context, request, start, tag);
} }
@ -248,7 +248,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
/// Side effect: /// Side effect:
/// - the \a ClientContext associated with this call is updated with /// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata received from the server. /// possible initial and trailing metadata received from the server.
void Finish(grpc::Status* status, void* tag) override { void Finish(::grpc::Status* status, void* tag) override {
GPR_CODEGEN_ASSERT(started_); GPR_CODEGEN_ASSERT(started_);
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
@ -261,7 +261,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
private: private:
friend class internal::ClientAsyncReaderFactory<R>; friend class internal::ClientAsyncReaderFactory<R>;
template <class W> template <class W>
ClientAsyncReader(grpc::internal::Call call, grpc::ClientContext* context, ClientAsyncReader(::grpc::internal::Call call, ::grpc::ClientContext* context,
const W& request, bool start, void* tag) const W& request, bool start, void* tag)
: context_(context), call_(call), started_(start) { : context_(context), call_(call), started_(start) {
// TODO(ctiller): don't assert // TODO(ctiller): don't assert
@ -281,20 +281,20 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
call_.PerformOps(&init_ops_); call_.PerformOps(&init_ops_);
} }
grpc::ClientContext* context_; ::grpc::ClientContext* context_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
bool started_; bool started_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpClientSendClose> ::grpc::internal::CallOpClientSendClose>
init_ops_; init_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpRecvMessage<R>> ::grpc::internal::CallOpRecvMessage<R>>
read_ops_; read_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpClientRecvStatus> ::grpc::internal::CallOpClientRecvStatus>
finish_ops_; finish_ops_;
}; };
@ -327,13 +327,13 @@ class ClientAsyncWriterFactory {
/// message from the server upon a successful call to the \a Finish /// message from the server upon a successful call to the \a Finish
/// method of this instance. /// method of this instance.
template <class R> template <class R>
static ClientAsyncWriter<W>* Create(grpc::ChannelInterface* channel, static ClientAsyncWriter<W>* Create(::grpc::ChannelInterface* channel,
grpc::CompletionQueue* cq, ::grpc::CompletionQueue* cq,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, R* response, ::grpc::ClientContext* context,
bool start, void* tag) { R* response, bool start, void* tag) {
grpc::internal::Call call = channel->CreateCall(method, context, cq); ::grpc::internal::Call call = channel->CreateCall(method, context, cq);
return new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( return new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientAsyncWriter<W>))) call.call(), sizeof(ClientAsyncWriter<W>)))
ClientAsyncWriter<W>(call, context, response, start, tag); ClientAsyncWriter<W>(call, context, response, start, tag);
} }
@ -388,7 +388,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void Write(const W& msg, grpc::WriteOptions options, void* tag) override { void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override {
GPR_CODEGEN_ASSERT(started_); GPR_CODEGEN_ASSERT(started_);
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
if (options.is_last_message()) { if (options.is_last_message()) {
@ -414,7 +414,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
/// possible initial and trailing metadata received from the server. /// possible initial and trailing metadata received from the server.
/// - attempts to fill in the \a response parameter passed to this class's /// - attempts to fill in the \a response parameter passed to this class's
/// constructor with the server's response message. /// constructor with the server's response message.
void Finish(grpc::Status* status, void* tag) override { void Finish(::grpc::Status* status, void* tag) override {
GPR_CODEGEN_ASSERT(started_); GPR_CODEGEN_ASSERT(started_);
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
@ -427,7 +427,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
private: private:
friend class internal::ClientAsyncWriterFactory<W>; friend class internal::ClientAsyncWriterFactory<W>;
template <class R> template <class R>
ClientAsyncWriter(grpc::internal::Call call, grpc::ClientContext* context, ClientAsyncWriter(::grpc::internal::Call call, ::grpc::ClientContext* context,
R* response, bool start, void* tag) R* response, bool start, void* tag)
: context_(context), call_(call), started_(start) { : context_(context), call_(call), started_(start) {
finish_ops_.RecvMessage(response); finish_ops_.RecvMessage(response);
@ -450,18 +450,18 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
} }
} }
grpc::ClientContext* context_; ::grpc::ClientContext* context_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
bool started_; bool started_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpClientSendClose> ::grpc::internal::CallOpClientSendClose>
write_ops_; write_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpGenericRecvMessage, ::grpc::internal::CallOpGenericRecvMessage,
grpc::internal::CallOpClientRecvStatus> ::grpc::internal::CallOpClientRecvStatus>
finish_ops_; finish_ops_;
}; };
@ -493,12 +493,12 @@ class ClientAsyncReaderWriterFactory {
/// Note that \a context will be used to fill in custom initial metadata /// Note that \a context will be used to fill in custom initial metadata
/// used to send to the server when starting the call. /// used to send to the server when starting the call.
static ClientAsyncReaderWriter<W, R>* Create( static ClientAsyncReaderWriter<W, R>* Create(
grpc::ChannelInterface* channel, grpc::CompletionQueue* cq, ::grpc::ChannelInterface* channel, ::grpc::CompletionQueue* cq,
const grpc::internal::RpcMethod& method, grpc::ClientContext* context, const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
bool start, void* tag) { bool start, void* tag) {
grpc::internal::Call call = channel->CreateCall(method, context, cq); ::grpc::internal::Call call = channel->CreateCall(method, context, cq);
return new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( return new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientAsyncReaderWriter<W, R>))) call.call(), sizeof(ClientAsyncReaderWriter<W, R>)))
ClientAsyncReaderWriter<W, R>(call, context, start, tag); ClientAsyncReaderWriter<W, R>(call, context, start, tag);
} }
@ -565,7 +565,7 @@ class ClientAsyncReaderWriter final
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void Write(const W& msg, grpc::WriteOptions options, void* tag) override { void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override {
GPR_CODEGEN_ASSERT(started_); GPR_CODEGEN_ASSERT(started_);
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
if (options.is_last_message()) { if (options.is_last_message()) {
@ -588,7 +588,7 @@ class ClientAsyncReaderWriter final
/// Side effect /// Side effect
/// - the \a ClientContext associated with this call is updated with /// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server. /// possible initial and trailing metadata sent from the server.
void Finish(grpc::Status* status, void* tag) override { void Finish(::grpc::Status* status, void* tag) override {
GPR_CODEGEN_ASSERT(started_); GPR_CODEGEN_ASSERT(started_);
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
@ -600,8 +600,8 @@ class ClientAsyncReaderWriter final
private: private:
friend class internal::ClientAsyncReaderWriterFactory<W, R>; friend class internal::ClientAsyncReaderWriterFactory<W, R>;
ClientAsyncReaderWriter(grpc::internal::Call call, ClientAsyncReaderWriter(::grpc::internal::Call call,
grpc::ClientContext* context, bool start, void* tag) ::grpc::ClientContext* context, bool start, void* tag)
: context_(context), call_(call), started_(start) { : context_(context), call_(call), started_(start) {
if (start) { if (start) {
StartCallInternal(tag); StartCallInternal(tag);
@ -621,26 +621,26 @@ class ClientAsyncReaderWriter final
} }
} }
grpc::ClientContext* context_; ::grpc::ClientContext* context_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
bool started_; bool started_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpRecvMessage<R>> ::grpc::internal::CallOpRecvMessage<R>>
read_ops_; read_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpClientSendClose> ::grpc::internal::CallOpClientSendClose>
write_ops_; write_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpClientRecvStatus> ::grpc::internal::CallOpClientRecvStatus>
finish_ops_; finish_ops_;
}; };
template <class W, class R> template <class W, class R>
class ServerAsyncReaderInterface class ServerAsyncReaderInterface
: public grpc::internal::ServerAsyncStreamingInterface, : public ::grpc::internal::ServerAsyncStreamingInterface,
public internal::AsyncReaderInterface<R> { public internal::AsyncReaderInterface<R> {
public: public:
/// Indicate that the stream is to be finished with a certain status code /// Indicate that the stream is to be finished with a certain status code
@ -665,7 +665,8 @@ class ServerAsyncReaderInterface
/// \param[in] tag Tag identifying this request. /// \param[in] tag Tag identifying this request.
/// \param[in] status To be sent to the client as the result of this call. /// \param[in] status To be sent to the client as the result of this call.
/// \param[in] msg To be sent to the client as the response for this call. /// \param[in] msg To be sent to the client as the response for this call.
virtual void Finish(const W& msg, const grpc::Status& status, void* tag) = 0; virtual void Finish(const W& msg, const ::grpc::Status& status,
void* tag) = 0;
/// Indicate that the stream is to be finished with a certain /// Indicate that the stream is to be finished with a certain
/// non-OK status code. /// non-OK status code.
@ -688,7 +689,7 @@ class ServerAsyncReaderInterface
/// \param[in] tag Tag identifying this request. /// \param[in] tag Tag identifying this request.
/// \param[in] status To be sent to the client as the result of this call. /// \param[in] status To be sent to the client as the result of this call.
/// - Note: \a status must have a non-OK code. /// - Note: \a status must have a non-OK code.
virtual void FinishWithError(const grpc::Status& status, void* tag) = 0; virtual void FinishWithError(const ::grpc::Status& status, void* tag) = 0;
}; };
/// Async server-side API for doing client-streaming RPCs, /// Async server-side API for doing client-streaming RPCs,
@ -697,7 +698,7 @@ class ServerAsyncReaderInterface
template <class W, class R> template <class W, class R>
class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> { class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
public: public:
explicit ServerAsyncReader(grpc::ServerContext* ctx) explicit ServerAsyncReader(::grpc::ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {} : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
/// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics. /// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
@ -735,7 +736,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
/// ///
/// gRPC doesn't take ownership or a reference to \a msg and \a status, so it /// gRPC doesn't take ownership or a reference to \a msg and \a status, so it
/// is safe to deallocate once Finish returns. /// is safe to deallocate once Finish returns.
void Finish(const W& msg, const grpc::Status& status, void* tag) override { void Finish(const W& msg, const ::grpc::Status& status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_, finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@ -764,7 +765,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
/// ///
/// gRPC doesn't take ownership or a reference to \a status, so it is safe to /// gRPC doesn't take ownership or a reference to \a status, so it is safe to
/// to deallocate once FinishWithError returns. /// to deallocate once FinishWithError returns.
void FinishWithError(const grpc::Status& status, void* tag) override { void FinishWithError(const ::grpc::Status& status, void* tag) override {
GPR_CODEGEN_ASSERT(!status.ok()); GPR_CODEGEN_ASSERT(!status.ok());
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
@ -780,22 +781,22 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
} }
private: private:
void BindCall(grpc::internal::Call* call) override { call_ = *call; } void BindCall(::grpc::internal::Call* call) override { call_ = *call; }
grpc::internal::Call call_; ::grpc::internal::Call call_;
grpc::ServerContext* ctx_; ::grpc::ServerContext* ctx_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> read_ops_; ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> read_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
finish_ops_; finish_ops_;
}; };
template <class W> template <class W>
class ServerAsyncWriterInterface class ServerAsyncWriterInterface
: public grpc::internal::ServerAsyncStreamingInterface, : public ::grpc::internal::ServerAsyncStreamingInterface,
public internal::AsyncWriterInterface<W> { public internal::AsyncWriterInterface<W> {
public: public:
/// Indicate that the stream is to be finished with a certain status code. /// Indicate that the stream is to be finished with a certain status code.
@ -819,7 +820,7 @@ class ServerAsyncWriterInterface
/// ///
/// \param[in] tag Tag identifying this request. /// \param[in] tag Tag identifying this request.
/// \param[in] status To be sent to the client as the result of this call. /// \param[in] status To be sent to the client as the result of this call.
virtual void Finish(const grpc::Status& status, void* tag) = 0; virtual void Finish(const ::grpc::Status& status, void* tag) = 0;
/// Request the writing of \a msg and coalesce it with trailing metadata which /// Request the writing of \a msg and coalesce it with trailing metadata which
/// contains \a status, using WriteOptions options with /// contains \a status, using WriteOptions options with
@ -835,8 +836,8 @@ class ServerAsyncWriterInterface
/// \param[in] options The WriteOptions to be used to write this message. /// \param[in] options The WriteOptions to be used to write this message.
/// \param[in] status The Status that server returns to client. /// \param[in] status The Status that server returns to client.
/// \param[in] tag The tag identifying the operation. /// \param[in] tag The tag identifying the operation.
virtual void WriteAndFinish(const W& msg, grpc::WriteOptions options, virtual void WriteAndFinish(const W& msg, ::grpc::WriteOptions options,
const grpc::Status& status, void* tag) = 0; const ::grpc::Status& status, void* tag) = 0;
}; };
/// Async server-side API for doing server streaming RPCs, /// Async server-side API for doing server streaming RPCs,
@ -844,7 +845,7 @@ class ServerAsyncWriterInterface
template <class W> template <class W>
class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> { class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
public: public:
explicit ServerAsyncWriter(grpc::ServerContext* ctx) explicit ServerAsyncWriter(::grpc::ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {} : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
/// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics. /// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
@ -875,7 +876,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void Write(const W& msg, grpc::WriteOptions options, void* tag) override { void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override {
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
if (options.is_last_message()) { if (options.is_last_message()) {
options.set_buffer_hint(); options.set_buffer_hint();
@ -897,8 +898,8 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
/// ///
/// gRPC doesn't take ownership or a reference to \a msg and \a status, so it /// gRPC doesn't take ownership or a reference to \a msg and \a status, so it
/// is safe to deallocate once WriteAndFinish returns. /// is safe to deallocate once WriteAndFinish returns.
void WriteAndFinish(const W& msg, grpc::WriteOptions options, void WriteAndFinish(const W& msg, ::grpc::WriteOptions options,
const grpc::Status& status, void* tag) override { const ::grpc::Status& status, void* tag) override {
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_); EnsureInitialMetadataSent(&write_ops_);
options.set_buffer_hint(); options.set_buffer_hint();
@ -918,7 +919,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
/// ///
/// gRPC doesn't take ownership or a reference to \a status, so it is safe to /// gRPC doesn't take ownership or a reference to \a status, so it is safe to
/// to deallocate once Finish returns. /// to deallocate once Finish returns.
void Finish(const grpc::Status& status, void* tag) override { void Finish(const ::grpc::Status& status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&finish_ops_); EnsureInitialMetadataSent(&finish_ops_);
finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status); finish_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
@ -926,7 +927,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
} }
private: private:
void BindCall(grpc::internal::Call* call) override { call_ = *call; } void BindCall(::grpc::internal::Call* call) override { call_ = *call; }
template <class T> template <class T>
void EnsureInitialMetadataSent(T* ops) { void EnsureInitialMetadataSent(T* ops) {
@ -940,23 +941,23 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
} }
} }
grpc::internal::Call call_; ::grpc::internal::Call call_;
grpc::ServerContext* ctx_; ::grpc::ServerContext* ctx_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
write_ops_; write_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
finish_ops_; finish_ops_;
}; };
/// Server-side interface for asynchronous bi-directional streaming. /// Server-side interface for asynchronous bi-directional streaming.
template <class W, class R> template <class W, class R>
class ServerAsyncReaderWriterInterface class ServerAsyncReaderWriterInterface
: public grpc::internal::ServerAsyncStreamingInterface, : public ::grpc::internal::ServerAsyncStreamingInterface,
public internal::AsyncWriterInterface<W>, public internal::AsyncWriterInterface<W>,
public internal::AsyncReaderInterface<R> { public internal::AsyncReaderInterface<R> {
public: public:
@ -982,7 +983,7 @@ class ServerAsyncReaderWriterInterface
/// ///
/// \param[in] tag Tag identifying this request. /// \param[in] tag Tag identifying this request.
/// \param[in] status To be sent to the client as the result of this call. /// \param[in] status To be sent to the client as the result of this call.
virtual void Finish(const grpc::Status& status, void* tag) = 0; virtual void Finish(const ::grpc::Status& status, void* tag) = 0;
/// Request the writing of \a msg and coalesce it with trailing metadata which /// Request the writing of \a msg and coalesce it with trailing metadata which
/// contains \a status, using WriteOptions options with /// contains \a status, using WriteOptions options with
@ -998,8 +999,8 @@ class ServerAsyncReaderWriterInterface
/// \param[in] options The WriteOptions to be used to write this message. /// \param[in] options The WriteOptions to be used to write this message.
/// \param[in] status The Status that server returns to client. /// \param[in] status The Status that server returns to client.
/// \param[in] tag The tag identifying the operation. /// \param[in] tag The tag identifying the operation.
virtual void WriteAndFinish(const W& msg, grpc::WriteOptions options, virtual void WriteAndFinish(const W& msg, ::grpc::WriteOptions options,
const grpc::Status& status, void* tag) = 0; const ::grpc::Status& status, void* tag) = 0;
}; };
/// Async server-side API for doing bidirectional streaming RPCs, /// Async server-side API for doing bidirectional streaming RPCs,
@ -1010,7 +1011,7 @@ template <class W, class R>
class ServerAsyncReaderWriter final class ServerAsyncReaderWriter final
: public ServerAsyncReaderWriterInterface<W, R> { : public ServerAsyncReaderWriterInterface<W, R> {
public: public:
explicit ServerAsyncReaderWriter(grpc::ServerContext* ctx) explicit ServerAsyncReaderWriter(::grpc::ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {} : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
/// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics. /// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
@ -1047,7 +1048,7 @@ class ServerAsyncReaderWriter final
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void Write(const W& msg, grpc::WriteOptions options, void* tag) override { void Write(const W& msg, ::grpc::WriteOptions options, void* tag) override {
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
if (options.is_last_message()) { if (options.is_last_message()) {
options.set_buffer_hint(); options.set_buffer_hint();
@ -1068,8 +1069,8 @@ class ServerAsyncReaderWriter final
// //
/// gRPC doesn't take ownership or a reference to \a msg and \a status, so it /// gRPC doesn't take ownership or a reference to \a msg and \a status, so it
/// is safe to deallocate once WriteAndFinish returns. /// is safe to deallocate once WriteAndFinish returns.
void WriteAndFinish(const W& msg, grpc::WriteOptions options, void WriteAndFinish(const W& msg, ::grpc::WriteOptions options,
const grpc::Status& status, void* tag) override { const ::grpc::Status& status, void* tag) override {
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_); EnsureInitialMetadataSent(&write_ops_);
options.set_buffer_hint(); options.set_buffer_hint();
@ -1089,7 +1090,7 @@ class ServerAsyncReaderWriter final
// //
/// gRPC doesn't take ownership or a reference to \a status, so it is safe to /// gRPC doesn't take ownership or a reference to \a status, so it is safe to
/// to deallocate once Finish returns. /// to deallocate once Finish returns.
void Finish(const grpc::Status& status, void* tag) override { void Finish(const ::grpc::Status& status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&finish_ops_); EnsureInitialMetadataSent(&finish_ops_);
@ -1098,9 +1099,9 @@ class ServerAsyncReaderWriter final
} }
private: private:
friend class grpc::Server; friend class ::grpc::Server;
void BindCall(grpc::internal::Call* call) override { call_ = *call; } void BindCall(::grpc::internal::Call* call) override { call_ = *call; }
template <class T> template <class T>
void EnsureInitialMetadataSent(T* ops) { void EnsureInitialMetadataSent(T* ops) {
@ -1114,17 +1115,17 @@ class ServerAsyncReaderWriter final
} }
} }
grpc::internal::Call call_; ::grpc::internal::Call call_;
grpc::ServerContext* ctx_; ::grpc::ServerContext* ctx_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> read_ops_; ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> read_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
write_ops_; write_ops_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
finish_ops_; finish_ops_;
}; };

View File

@ -70,7 +70,7 @@ class ClientAsyncResponseReaderInterface {
/// \param[in] tag Tag identifying this request. /// \param[in] tag Tag identifying this request.
/// \param[out] status To be updated with the operation status. /// \param[out] status To be updated with the operation status.
/// \param[out] msg To be filled in with the server's response message. /// \param[out] msg To be filled in with the server's response message.
virtual void Finish(R* msg, grpc::Status* status, void* tag) = 0; virtual void Finish(R* msg, ::grpc::Status* status, void* tag) = 0;
}; };
namespace internal { namespace internal {
@ -91,12 +91,12 @@ class ClientAsyncResponseReaderHelper {
/// extraneous parameter just to provide the needed type information. /// extraneous parameter just to provide the needed type information.
template <class R, class W, class BaseR = R, class BaseW = W> template <class R, class W, class BaseR = R, class BaseW = W>
static ClientAsyncResponseReader<R>* Create( static ClientAsyncResponseReader<R>* Create(
grpc::ChannelInterface* channel, grpc::CompletionQueue* cq, ::grpc::ChannelInterface* channel, ::grpc::CompletionQueue* cq,
const grpc::internal::RpcMethod& method, grpc::ClientContext* context, const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
const W& request) /* __attribute__((noinline)) */ { const W& request) /* __attribute__((noinline)) */ {
grpc::internal::Call call = channel->CreateCall(method, context, cq); ::grpc::internal::Call call = channel->CreateCall(method, context, cq);
ClientAsyncResponseReader<R>* result = ClientAsyncResponseReader<R>* result =
new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientAsyncResponseReader<R>))) call.call(), sizeof(ClientAsyncResponseReader<R>)))
ClientAsyncResponseReader<R>(call, context); ClientAsyncResponseReader<R>(call, context);
SetupRequest<BaseR, BaseW>( SetupRequest<BaseR, BaseW>(
@ -111,7 +111,7 @@ class ClientAsyncResponseReaderHelper {
template <class R, class W> template <class R, class W>
static void SetupRequest( static void SetupRequest(
grpc_call* call, grpc_call* call,
grpc::internal::CallOpSendInitialMetadata** single_buf_ptr, ::grpc::internal::CallOpSendInitialMetadata** single_buf_ptr,
std::function<void(ClientContext*, internal::Call*, std::function<void(ClientContext*, internal::Call*,
internal::CallOpSendInitialMetadata*, void*)>* internal::CallOpSendInitialMetadata*, void*)>*
read_initial_metadata, read_initial_metadata,
@ -121,14 +121,14 @@ class ClientAsyncResponseReaderHelper {
internal::CallOpSetInterface**, void*, Status*, void*)>* finish, internal::CallOpSetInterface**, void*, Status*, void*)>* finish,
const W& request) { const W& request) {
using SingleBufType = using SingleBufType =
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpClientSendClose, ::grpc::internal::CallOpClientSendClose,
grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpRecvMessage<R>, ::grpc::internal::CallOpRecvMessage<R>,
grpc::internal::CallOpClientRecvStatus>; ::grpc::internal::CallOpClientRecvStatus>;
SingleBufType* single_buf = SingleBufType* single_buf =
new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call, sizeof(SingleBufType))) SingleBufType; call, sizeof(SingleBufType))) SingleBufType;
*single_buf_ptr = single_buf; *single_buf_ptr = single_buf;
// TODO(ctiller): don't assert // TODO(ctiller): don't assert
@ -162,11 +162,11 @@ class ClientAsyncResponseReaderHelper {
internal::CallOpSetInterface** finish_buf_ptr, void* msg, internal::CallOpSetInterface** finish_buf_ptr, void* msg,
Status* status, void* tag) { Status* status, void* tag) {
if (initial_metadata_read) { if (initial_metadata_read) {
using FinishBufType = using FinishBufType = ::grpc::internal::CallOpSet<
grpc::internal::CallOpSet<grpc::internal::CallOpRecvMessage<R>, ::grpc::internal::CallOpRecvMessage<R>,
grpc::internal::CallOpClientRecvStatus>; ::grpc::internal::CallOpClientRecvStatus>;
FinishBufType* finish_buf = FinishBufType* finish_buf =
new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call->call(), sizeof(FinishBufType))) FinishBufType; call->call(), sizeof(FinishBufType))) FinishBufType;
*finish_buf_ptr = finish_buf; *finish_buf_ptr = finish_buf;
finish_buf->set_output_tag(tag); finish_buf->set_output_tag(tag);
@ -186,8 +186,9 @@ class ClientAsyncResponseReaderHelper {
}; };
} }
static void StartCall(grpc::ClientContext* context, static void StartCall(
grpc::internal::CallOpSendInitialMetadata* single_buf) { ::grpc::ClientContext* context,
::grpc::internal::CallOpSendInitialMetadata* single_buf) {
single_buf->SendInitialMetadata(&context->send_initial_metadata_, single_buf->SendInitialMetadata(&context->send_initial_metadata_,
context->initial_metadata_flags()); context->initial_metadata_flags());
} }
@ -200,8 +201,8 @@ class ClientAsyncResponseReaderFactory {
public: public:
template <class W> template <class W>
static ClientAsyncResponseReader<R>* Create( static ClientAsyncResponseReader<R>* Create(
grpc::ChannelInterface* channel, grpc::CompletionQueue* cq, ::grpc::ChannelInterface* channel, ::grpc::CompletionQueue* cq,
const grpc::internal::RpcMethod& method, grpc::ClientContext* context, const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
const W& request, bool start) { const W& request, bool start) {
auto* result = ClientAsyncResponseReaderHelper::Create<R>( auto* result = ClientAsyncResponseReaderHelper::Create<R>(
channel, cq, method, context, request); channel, cq, method, context, request);
@ -256,7 +257,7 @@ class ClientAsyncResponseReader final
/// Side effect: /// Side effect:
/// - the \a ClientContext associated with this call is updated with /// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server. /// possible initial and trailing metadata sent from the server.
void Finish(R* msg, grpc::Status* status, void* tag) override { void Finish(R* msg, ::grpc::Status* status, void* tag) override {
GPR_CODEGEN_DEBUG_ASSERT(started_); GPR_CODEGEN_DEBUG_ASSERT(started_);
finish_(context_, &call_, initial_metadata_read_, single_buf_, &finish_buf_, finish_(context_, &call_, initial_metadata_read_, single_buf_, &finish_buf_,
static_cast<void*>(msg), status, tag); static_cast<void*>(msg), status, tag);
@ -264,13 +265,13 @@ class ClientAsyncResponseReader final
private: private:
friend class internal::ClientAsyncResponseReaderHelper; friend class internal::ClientAsyncResponseReaderHelper;
grpc::ClientContext* const context_; ::grpc::ClientContext* const context_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
bool started_ = false; bool started_ = false;
bool initial_metadata_read_ = false; bool initial_metadata_read_ = false;
ClientAsyncResponseReader(grpc::internal::Call call, ClientAsyncResponseReader(::grpc::internal::Call call,
grpc::ClientContext* context) ::grpc::ClientContext* context)
: context_(context), call_(call) {} : context_(context), call_(call) {}
// disable operator new // disable operator new
@ -293,9 +294,9 @@ class ClientAsyncResponseReader final
/// response message sent to the client is of type \a W. /// response message sent to the client is of type \a W.
template <class W> template <class W>
class ServerAsyncResponseWriter final class ServerAsyncResponseWriter final
: public grpc::internal::ServerAsyncStreamingInterface { : public ::grpc::internal::ServerAsyncStreamingInterface {
public: public:
explicit ServerAsyncResponseWriter(grpc::ServerContext* ctx) explicit ServerAsyncResponseWriter(::grpc::ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {} : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
/// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics. /// See \a ServerAsyncStreamingInterface::SendInitialMetadata for semantics.
@ -337,7 +338,7 @@ class ServerAsyncResponseWriter final
/// gRPC doesn't take ownership or a reference to msg and status, so it is /// gRPC doesn't take ownership or a reference to msg and status, so it is
/// safe to deallocate them once the Finish operation is complete (i.e. a /// safe to deallocate them once the Finish operation is complete (i.e. a
/// result arrives in the completion queue). /// result arrives in the completion queue).
void Finish(const W& msg, const grpc::Status& status, void* tag) { void Finish(const W& msg, const ::grpc::Status& status, void* tag) {
finish_buf_.set_output_tag(tag); finish_buf_.set_output_tag(tag);
finish_buf_.set_core_cq_tag(&finish_buf_); finish_buf_.set_core_cq_tag(&finish_buf_);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
@ -374,7 +375,7 @@ class ServerAsyncResponseWriter final
/// gRPC doesn't take ownership or a reference to status, so it is safe to /// gRPC doesn't take ownership or a reference to status, so it is safe to
/// deallocate them once the Finish operation is complete (i.e. a result /// deallocate them once the Finish operation is complete (i.e. a result
/// arrives in the completion queue). /// arrives in the completion queue).
void FinishWithError(const grpc::Status& status, void* tag) { void FinishWithError(const ::grpc::Status& status, void* tag) {
GPR_CODEGEN_ASSERT(!status.ok()); GPR_CODEGEN_ASSERT(!status.ok());
finish_buf_.set_output_tag(tag); finish_buf_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
@ -390,15 +391,15 @@ class ServerAsyncResponseWriter final
} }
private: private:
void BindCall(grpc::internal::Call* call) override { call_ = *call; } void BindCall(::grpc::internal::Call* call) override { call_ = *call; }
grpc::internal::Call call_; ::grpc::internal::Call call_;
grpc::ServerContext* ctx_; ::grpc::ServerContext* ctx_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
meta_buf_; meta_buf_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
finish_buf_; finish_buf_;
}; };

View File

@ -42,7 +42,7 @@ class CallbackUnaryHandler;
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
class CallbackServerStreamingHandler; class CallbackServerStreamingHandler;
template <class RequestType> template <class RequestType>
void* UnaryDeserializeHelper(grpc_byte_buffer*, grpc::Status*, RequestType*); void* UnaryDeserializeHelper(grpc_byte_buffer*, ::grpc::Status*, RequestType*);
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
class ServerStreamingHandler; class ServerStreamingHandler;
template <::grpc::StatusCode code> template <::grpc::StatusCode code>
@ -172,7 +172,7 @@ class ByteBuffer final {
friend class internal::CallOpGenericRecvMessage; friend class internal::CallOpGenericRecvMessage;
template <class RequestType> template <class RequestType>
friend void* internal::UnaryDeserializeHelper(grpc_byte_buffer*, friend void* internal::UnaryDeserializeHelper(grpc_byte_buffer*,
grpc::Status*, RequestType*); ::grpc::Status*, RequestType*);
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
friend class internal::ServerStreamingHandler; friend class internal::ServerStreamingHandler;
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>

View File

@ -42,13 +42,13 @@ class Call final {
call_(nullptr), call_(nullptr),
max_receive_message_size_(-1) {} max_receive_message_size_(-1) {}
/** call is owned by the caller */ /** call is owned by the caller */
Call(grpc_call* call, CallHook* call_hook, grpc::CompletionQueue* cq) Call(grpc_call* call, CallHook* call_hook, ::grpc::CompletionQueue* cq)
: call_hook_(call_hook), : call_hook_(call_hook),
cq_(cq), cq_(cq),
call_(call), call_(call),
max_receive_message_size_(-1) {} max_receive_message_size_(-1) {}
Call(grpc_call* call, CallHook* call_hook, grpc::CompletionQueue* cq, Call(grpc_call* call, CallHook* call_hook, ::grpc::CompletionQueue* cq,
experimental::ClientRpcInfo* rpc_info) experimental::ClientRpcInfo* rpc_info)
: call_hook_(call_hook), : call_hook_(call_hook),
cq_(cq), cq_(cq),
@ -56,7 +56,7 @@ class Call final {
max_receive_message_size_(-1), max_receive_message_size_(-1),
client_rpc_info_(rpc_info) {} client_rpc_info_(rpc_info) {}
Call(grpc_call* call, CallHook* call_hook, grpc::CompletionQueue* cq, Call(grpc_call* call, CallHook* call_hook, ::grpc::CompletionQueue* cq,
int max_receive_message_size, experimental::ServerRpcInfo* rpc_info) int max_receive_message_size, experimental::ServerRpcInfo* rpc_info)
: call_hook_(call_hook), : call_hook_(call_hook),
cq_(cq), cq_(cq),
@ -69,7 +69,7 @@ class Call final {
} }
grpc_call* call() const { return call_; } grpc_call* call() const { return call_; }
grpc::CompletionQueue* cq() const { return cq_; } ::grpc::CompletionQueue* cq() const { return cq_; }
int max_receive_message_size() const { return max_receive_message_size_; } int max_receive_message_size() const { return max_receive_message_size_; }
@ -83,7 +83,7 @@ class Call final {
private: private:
CallHook* call_hook_; CallHook* call_hook_;
grpc::CompletionQueue* cq_; ::grpc::CompletionQueue* cq_;
grpc_call* call_; grpc_call* call_;
int max_receive_message_size_; int max_receive_message_size_;
experimental::ClientRpcInfo* client_rpc_info_ = nullptr; experimental::ClientRpcInfo* client_rpc_info_ = nullptr;

View File

@ -729,7 +729,7 @@ class CallOpRecvInitialMetadata {
public: public:
CallOpRecvInitialMetadata() : metadata_map_(nullptr) {} CallOpRecvInitialMetadata() : metadata_map_(nullptr) {}
void RecvInitialMetadata(grpc::ClientContext* context) { void RecvInitialMetadata(::grpc::ClientContext* context) {
context->initial_metadata_received_ = true; context->initial_metadata_received_ = true;
metadata_map_ = &context->recv_initial_metadata_; metadata_map_ = &context->recv_initial_metadata_;
} }
@ -778,7 +778,7 @@ class CallOpClientRecvStatus {
CallOpClientRecvStatus() CallOpClientRecvStatus()
: recv_status_(nullptr), debug_error_string_(nullptr) {} : recv_status_(nullptr), debug_error_string_(nullptr) {}
void ClientRecvStatus(grpc::ClientContext* context, Status* status) { void ClientRecvStatus(::grpc::ClientContext* context, Status* status) {
client_context_ = context; client_context_ = context;
metadata_map_ = &client_context_->trailing_metadata_; metadata_map_ = &client_context_->trailing_metadata_;
recv_status_ = status; recv_status_ = status;
@ -845,7 +845,7 @@ class CallOpClientRecvStatus {
private: private:
bool hijacked_ = false; bool hijacked_ = false;
grpc::ClientContext* client_context_; ::grpc::ClientContext* client_context_;
MetadataMap* metadata_map_; MetadataMap* metadata_map_;
Status* recv_status_; Status* recv_status_;
const char* debug_error_string_; const char* debug_error_string_;

View File

@ -81,7 +81,7 @@ class ChannelInterface {
/// deadline expires. \a GetState needs to called to get the current state. /// deadline expires. \a GetState needs to called to get the current state.
template <typename T> template <typename T>
void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline, void NotifyOnStateChange(grpc_connectivity_state last_observed, T deadline,
grpc::CompletionQueue* cq, void* tag) { ::grpc::CompletionQueue* cq, void* tag) {
TimePoint<T> deadline_tp(deadline); TimePoint<T> deadline_tp(deadline);
NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag); NotifyOnStateChangeImpl(last_observed, deadline_tp.raw_time(), cq, tag);
} }
@ -106,41 +106,41 @@ class ChannelInterface {
private: private:
template <class R> template <class R>
friend class grpc::ClientReader; friend class ::grpc::ClientReader;
template <class W> template <class W>
friend class grpc::ClientWriter; friend class ::grpc::ClientWriter;
template <class W, class R> template <class W, class R>
friend class grpc::ClientReaderWriter; friend class ::grpc::ClientReaderWriter;
template <class R> template <class R>
friend class grpc::internal::ClientAsyncReaderFactory; friend class ::grpc::internal::ClientAsyncReaderFactory;
template <class W> template <class W>
friend class grpc::internal::ClientAsyncWriterFactory; friend class ::grpc::internal::ClientAsyncWriterFactory;
template <class W, class R> template <class W, class R>
friend class grpc::internal::ClientAsyncReaderWriterFactory; friend class ::grpc::internal::ClientAsyncReaderWriterFactory;
friend class grpc::internal::ClientAsyncResponseReaderHelper; friend class ::grpc::internal::ClientAsyncResponseReaderHelper;
template <class W, class R> template <class W, class R>
friend class grpc::internal::ClientCallbackReaderWriterFactory; friend class ::grpc::internal::ClientCallbackReaderWriterFactory;
template <class R> template <class R>
friend class grpc::internal::ClientCallbackReaderFactory; friend class ::grpc::internal::ClientCallbackReaderFactory;
template <class W> template <class W>
friend class grpc::internal::ClientCallbackWriterFactory; friend class ::grpc::internal::ClientCallbackWriterFactory;
friend class grpc::internal::ClientCallbackUnaryFactory; friend class ::grpc::internal::ClientCallbackUnaryFactory;
template <class InputMessage, class OutputMessage> template <class InputMessage, class OutputMessage>
friend class grpc::internal::BlockingUnaryCallImpl; friend class ::grpc::internal::BlockingUnaryCallImpl;
template <class InputMessage, class OutputMessage> template <class InputMessage, class OutputMessage>
friend class grpc::internal::CallbackUnaryCallImpl; friend class ::grpc::internal::CallbackUnaryCallImpl;
friend class grpc::internal::RpcMethod; friend class ::grpc::internal::RpcMethod;
friend class grpc::experimental::DelegatingChannel; friend class ::grpc::experimental::DelegatingChannel;
friend class grpc::internal::InterceptedChannel; friend class ::grpc::internal::InterceptedChannel;
virtual internal::Call CreateCall(const internal::RpcMethod& method, virtual internal::Call CreateCall(const internal::RpcMethod& method,
grpc::ClientContext* context, ::grpc::ClientContext* context,
grpc::CompletionQueue* cq) = 0; ::grpc::CompletionQueue* cq) = 0;
virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops, virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops,
internal::Call* call) = 0; internal::Call* call) = 0;
virtual void* RegisterMethod(const char* method) = 0; virtual void* RegisterMethod(const char* method) = 0;
virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, virtual void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline, gpr_timespec deadline,
grpc::CompletionQueue* cq, ::grpc::CompletionQueue* cq,
void* tag) = 0; void* tag) = 0;
virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) = 0; gpr_timespec deadline) = 0;
@ -153,8 +153,8 @@ class ChannelInterface {
// method and adding a new pure method to an interface would be a breaking // method and adding a new pure method to an interface would be a breaking
// change (even though this is private and non-API) // change (even though this is private and non-API)
virtual internal::Call CreateCallInternal( virtual internal::Call CreateCallInternal(
const internal::RpcMethod& /*method*/, grpc::ClientContext* /*context*/, const internal::RpcMethod& /*method*/, ::grpc::ClientContext* /*context*/,
grpc::CompletionQueue* /*cq*/, size_t /*interceptor_pos*/) { ::grpc::CompletionQueue* /*cq*/, size_t /*interceptor_pos*/) {
return internal::Call(); return internal::Call();
} }
@ -165,7 +165,7 @@ class ChannelInterface {
// Returns nullptr (rather than being pure) since this is a post-1.0 method // Returns nullptr (rather than being pure) since this is a post-1.0 method
// and adding a new pure method to an interface would be a breaking change // and adding a new pure method to an interface would be a breaking change
// (even though this is private and non-API) // (even though this is private and non-API)
virtual grpc::CompletionQueue* CallbackCQ() { return nullptr; } virtual ::grpc::CompletionQueue* CallbackCQ() { return nullptr; }
}; };
} // namespace grpc } // namespace grpc

View File

@ -48,11 +48,11 @@ class RpcMethod;
template <class InputMessage, class OutputMessage, template <class InputMessage, class OutputMessage,
class BaseInputMessage = InputMessage, class BaseInputMessage = InputMessage,
class BaseOutputMessage = OutputMessage> class BaseOutputMessage = OutputMessage>
void CallbackUnaryCall(grpc::ChannelInterface* channel, void CallbackUnaryCall(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, ::grpc::ClientContext* context,
const InputMessage* request, OutputMessage* result, const InputMessage* request, OutputMessage* result,
std::function<void(grpc::Status)> on_completion) { std::function<void(::grpc::Status)> on_completion) {
static_assert(std::is_base_of<BaseInputMessage, InputMessage>::value, static_assert(std::is_base_of<BaseInputMessage, InputMessage>::value,
"Invalid input message specification"); "Invalid input message specification");
static_assert(std::is_base_of<BaseOutputMessage, OutputMessage>::value, static_assert(std::is_base_of<BaseOutputMessage, OutputMessage>::value,
@ -64,17 +64,17 @@ void CallbackUnaryCall(grpc::ChannelInterface* channel,
template <class InputMessage, class OutputMessage> template <class InputMessage, class OutputMessage>
class CallbackUnaryCallImpl { class CallbackUnaryCallImpl {
public: public:
CallbackUnaryCallImpl(grpc::ChannelInterface* channel, CallbackUnaryCallImpl(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, ::grpc::ClientContext* context,
const InputMessage* request, OutputMessage* result, const InputMessage* request, OutputMessage* result,
std::function<void(grpc::Status)> on_completion) { std::function<void(::grpc::Status)> on_completion) {
grpc::CompletionQueue* cq = channel->CallbackCQ(); ::grpc::CompletionQueue* cq = channel->CallbackCQ();
GPR_CODEGEN_ASSERT(cq != nullptr); GPR_CODEGEN_ASSERT(cq != nullptr);
grpc::internal::Call call(channel->CreateCall(method, context, cq)); grpc::internal::Call call(channel->CreateCall(method, context, cq));
using FullCallOpSet = grpc::internal::CallOpSet< using FullCallOpSet = grpc::internal::CallOpSet<
grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, grpc::internal::CallOpSendMessage,
grpc::internal::CallOpRecvInitialMetadata, grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpRecvMessage<OutputMessage>, grpc::internal::CallOpRecvMessage<OutputMessage>,
@ -87,14 +87,14 @@ class CallbackUnaryCallImpl {
}; };
const size_t alloc_sz = sizeof(OpSetAndTag); const size_t alloc_sz = sizeof(OpSetAndTag);
auto* const alloced = static_cast<OpSetAndTag*>( auto* const alloced = static_cast<OpSetAndTag*>(
grpc::g_core_codegen_interface->grpc_call_arena_alloc(call.call(), ::grpc::g_core_codegen_interface->grpc_call_arena_alloc(call.call(),
alloc_sz)); alloc_sz));
auto* ops = new (&alloced->opset) FullCallOpSet; auto* ops = new (&alloced->opset) FullCallOpSet;
auto* tag = new (&alloced->tag) auto* tag = new (&alloced->tag)
grpc::internal::CallbackWithStatusTag(call.call(), on_completion, ops); grpc::internal::CallbackWithStatusTag(call.call(), on_completion, ops);
// TODO(vjpai): Unify code with sync API as much as possible // TODO(vjpai): Unify code with sync API as much as possible
grpc::Status s = ops->SendMessagePtr(request); ::grpc::Status s = ops->SendMessagePtr(request);
if (!s.ok()) { if (!s.ok()) {
tag->force_run(s); tag->force_run(s);
return; return;
@ -123,7 +123,7 @@ class ClientReactor {
/// hold). /// hold).
/// ///
/// \param[in] s The status outcome of this RPC /// \param[in] s The status outcome of this RPC
virtual void OnDone(const grpc::Status& /*s*/) = 0; virtual void OnDone(const ::grpc::Status& /*s*/) = 0;
/// InternalScheduleOnDone is not part of the API and is not meant to be /// InternalScheduleOnDone is not part of the API and is not meant to be
/// overridden. It is virtual to allow successful builds for certain bazel /// overridden. It is virtual to allow successful builds for certain bazel
@ -132,7 +132,7 @@ class ClientReactor {
/// the virtual call is slower than a direct call, this function is /// the virtual call is slower than a direct call, this function is
/// heavyweight and the cost of the virtual call is not much in comparison. /// heavyweight and the cost of the virtual call is not much in comparison.
/// This function may be removed or devirtualized in the future. /// This function may be removed or devirtualized in the future.
virtual void InternalScheduleOnDone(grpc::Status s); virtual void InternalScheduleOnDone(::grpc::Status s);
/// InternalTrailersOnly is not part of the API and is not meant to be /// InternalTrailersOnly is not part of the API and is not meant to be
/// overridden. It is virtual to allow successful builds for certain bazel /// overridden. It is virtual to allow successful builds for certain bazel
@ -163,7 +163,7 @@ class ClientCallbackReaderWriter {
public: public:
virtual ~ClientCallbackReaderWriter() {} virtual ~ClientCallbackReaderWriter() {}
virtual void StartCall() = 0; virtual void StartCall() = 0;
virtual void Write(const Request* req, grpc::WriteOptions options) = 0; virtual void Write(const Request* req, ::grpc::WriteOptions options) = 0;
virtual void WritesDone() = 0; virtual void WritesDone() = 0;
virtual void Read(Response* resp) = 0; virtual void Read(Response* resp) = 0;
virtual void AddHold(int holds) = 0; virtual void AddHold(int holds) = 0;
@ -195,9 +195,9 @@ class ClientCallbackWriter {
public: public:
virtual ~ClientCallbackWriter() {} virtual ~ClientCallbackWriter() {}
virtual void StartCall() = 0; virtual void StartCall() = 0;
void Write(const Request* req) { Write(req, grpc::WriteOptions()); } void Write(const Request* req) { Write(req, ::grpc::WriteOptions()); }
virtual void Write(const Request* req, grpc::WriteOptions options) = 0; virtual void Write(const Request* req, ::grpc::WriteOptions options) = 0;
void WriteLast(const Request* req, grpc::WriteOptions options) { void WriteLast(const Request* req, ::grpc::WriteOptions options) {
Write(req, options.set_last_message()); Write(req, options.set_last_message());
} }
virtual void WritesDone() = 0; virtual void WritesDone() = 0;
@ -258,7 +258,9 @@ class ClientBidiReactor : public internal::ClientReactor {
/// \param[in] req The message to be written. The library does not take /// \param[in] req The message to be written. The library does not take
/// ownership but the caller must ensure that the message is /// ownership but the caller must ensure that the message is
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
void StartWrite(const Request* req) { StartWrite(req, grpc::WriteOptions()); } void StartWrite(const Request* req) {
StartWrite(req, ::grpc::WriteOptions());
}
/// Initiate/post a write operation with specified options. /// Initiate/post a write operation with specified options.
/// ///
@ -266,7 +268,7 @@ class ClientBidiReactor : public internal::ClientReactor {
/// ownership but the caller must ensure that the message is /// ownership but the caller must ensure that the message is
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
/// \param[in] options The WriteOptions to use for writing this message /// \param[in] options The WriteOptions to use for writing this message
void StartWrite(const Request* req, grpc::WriteOptions options) { void StartWrite(const Request* req, ::grpc::WriteOptions options) {
stream_->Write(req, options); stream_->Write(req, options);
} }
@ -279,7 +281,7 @@ class ClientBidiReactor : public internal::ClientReactor {
/// ownership but the caller must ensure that the message is /// ownership but the caller must ensure that the message is
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
/// \param[in] options The WriteOptions to use for writing this message /// \param[in] options The WriteOptions to use for writing this message
void StartWriteLast(const Request* req, grpc::WriteOptions options) { void StartWriteLast(const Request* req, ::grpc::WriteOptions options) {
StartWrite(req, options.set_last_message()); StartWrite(req, options.set_last_message());
} }
@ -326,7 +328,7 @@ class ClientBidiReactor : public internal::ClientReactor {
/// (like failure to remove a hold). /// (like failure to remove a hold).
/// ///
/// \param[in] s The status outcome of this RPC /// \param[in] s The status outcome of this RPC
void OnDone(const grpc::Status& /*s*/) override {} void OnDone(const ::grpc::Status& /*s*/) override {}
/// Notifies the application that a read of initial metadata from the /// Notifies the application that a read of initial metadata from the
/// server is done. If the application chooses not to implement this method, /// server is done. If the application chooses not to implement this method,
@ -383,7 +385,7 @@ class ClientReadReactor : public internal::ClientReactor {
} }
void RemoveHold() { reader_->RemoveHold(); } void RemoveHold() { reader_->RemoveHold(); }
void OnDone(const grpc::Status& /*s*/) override {} void OnDone(const ::grpc::Status& /*s*/) override {}
virtual void OnReadInitialMetadataDone(bool /*ok*/) {} virtual void OnReadInitialMetadataDone(bool /*ok*/) {}
virtual void OnReadDone(bool /*ok*/) {} virtual void OnReadDone(bool /*ok*/) {}
@ -399,11 +401,13 @@ template <class Request>
class ClientWriteReactor : public internal::ClientReactor { class ClientWriteReactor : public internal::ClientReactor {
public: public:
void StartCall() { writer_->StartCall(); } void StartCall() { writer_->StartCall(); }
void StartWrite(const Request* req) { StartWrite(req, grpc::WriteOptions()); } void StartWrite(const Request* req) {
void StartWrite(const Request* req, grpc::WriteOptions options) { StartWrite(req, ::grpc::WriteOptions());
}
void StartWrite(const Request* req, ::grpc::WriteOptions options) {
writer_->Write(req, options); writer_->Write(req, options);
} }
void StartWriteLast(const Request* req, grpc::WriteOptions options) { void StartWriteLast(const Request* req, ::grpc::WriteOptions options) {
StartWrite(req, options.set_last_message()); StartWrite(req, options.set_last_message());
} }
void StartWritesDone() { writer_->WritesDone(); } void StartWritesDone() { writer_->WritesDone(); }
@ -415,7 +419,7 @@ class ClientWriteReactor : public internal::ClientReactor {
} }
void RemoveHold() { writer_->RemoveHold(); } void RemoveHold() { writer_->RemoveHold(); }
void OnDone(const grpc::Status& /*s*/) override {} void OnDone(const ::grpc::Status& /*s*/) override {}
virtual void OnReadInitialMetadataDone(bool /*ok*/) {} virtual void OnReadInitialMetadataDone(bool /*ok*/) {}
virtual void OnWriteDone(bool /*ok*/) {} virtual void OnWriteDone(bool /*ok*/) {}
virtual void OnWritesDoneDone(bool /*ok*/) {} virtual void OnWritesDoneDone(bool /*ok*/) {}
@ -441,7 +445,7 @@ class ClientWriteReactor : public internal::ClientReactor {
class ClientUnaryReactor : public internal::ClientReactor { class ClientUnaryReactor : public internal::ClientReactor {
public: public:
void StartCall() { call_->StartCall(); } void StartCall() { call_->StartCall(); }
void OnDone(const grpc::Status& /*s*/) override {} void OnDone(const ::grpc::Status& /*s*/) override {}
virtual void OnReadInitialMetadataDone(bool /*ok*/) {} virtual void OnReadInitialMetadataDone(bool /*ok*/) {}
private: private:
@ -530,7 +534,7 @@ class ClientCallbackReaderWriterImpl
call_.PerformOps(&read_ops_); call_.PerformOps(&read_ops_);
} }
void Write(const Request* msg, grpc::WriteOptions options) void Write(const Request* msg, ::grpc::WriteOptions options)
ABSL_LOCKS_EXCLUDED(start_mu_) override { ABSL_LOCKS_EXCLUDED(start_mu_) override {
if (options.is_last_message()) { if (options.is_last_message()) {
options.set_buffer_hint(); options.set_buffer_hint();
@ -589,7 +593,7 @@ class ClientCallbackReaderWriterImpl
friend class ClientCallbackReaderWriterFactory<Request, Response>; friend class ClientCallbackReaderWriterFactory<Request, Response>;
ClientCallbackReaderWriterImpl(grpc::internal::Call call, ClientCallbackReaderWriterImpl(grpc::internal::Call call,
grpc::ClientContext* context, ::grpc::ClientContext* context,
ClientBidiReactor<Request, Response>* reactor) ClientBidiReactor<Request, Response>* reactor)
: context_(context), : context_(context),
call_(call), call_(call),
@ -647,11 +651,11 @@ class ClientCallbackReaderWriterImpl
void MaybeFinish(bool from_reaction) { void MaybeFinish(bool from_reaction) {
if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub( if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub(
1, std::memory_order_acq_rel) == 1)) { 1, std::memory_order_acq_rel) == 1)) {
grpc::Status s = std::move(finish_status_); ::grpc::Status s = std::move(finish_status_);
auto* reactor = reactor_; auto* reactor = reactor_;
auto* call = call_.call(); auto* call = call_.call();
this->~ClientCallbackReaderWriterImpl(); this->~ClientCallbackReaderWriterImpl();
grpc::g_core_codegen_interface->grpc_call_unref(call); ::grpc::g_core_codegen_interface->grpc_call_unref(call);
if (GPR_LIKELY(from_reaction)) { if (GPR_LIKELY(from_reaction)) {
reactor->OnDone(s); reactor->OnDone(s);
} else { } else {
@ -660,7 +664,7 @@ class ClientCallbackReaderWriterImpl
} }
} }
grpc::ClientContext* const context_; ::grpc::ClientContext* const context_;
grpc::internal::Call call_; grpc::internal::Call call_;
ClientBidiReactor<Request, Response>* const reactor_; ClientBidiReactor<Request, Response>* const reactor_;
@ -674,7 +678,7 @@ class ClientCallbackReaderWriterImpl
grpc::internal::CallOpSet<grpc::internal::CallOpClientRecvStatus> finish_ops_; grpc::internal::CallOpSet<grpc::internal::CallOpClientRecvStatus> finish_ops_;
grpc::internal::CallbackWithSuccessTag finish_tag_; grpc::internal::CallbackWithSuccessTag finish_tag_;
grpc::Status finish_status_; ::grpc::Status finish_status_;
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, grpc::internal::CallOpSendMessage,
@ -707,15 +711,15 @@ class ClientCallbackReaderWriterImpl
template <class Request, class Response> template <class Request, class Response>
class ClientCallbackReaderWriterFactory { class ClientCallbackReaderWriterFactory {
public: public:
static void Create(grpc::ChannelInterface* channel, static void Create(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, ::grpc::ClientContext* context,
ClientBidiReactor<Request, Response>* reactor) { ClientBidiReactor<Request, Response>* reactor) {
grpc::internal::Call call = grpc::internal::Call call =
channel->CreateCall(method, context, channel->CallbackCQ()); channel->CreateCall(method, context, channel->CallbackCQ());
grpc::g_core_codegen_interface->grpc_call_ref(call.call()); ::grpc::g_core_codegen_interface->grpc_call_ref(call.call());
new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientCallbackReaderWriterImpl<Request, Response>))) call.call(), sizeof(ClientCallbackReaderWriterImpl<Request, Response>)))
ClientCallbackReaderWriterImpl<Request, Response>(call, context, ClientCallbackReaderWriterImpl<Request, Response>(call, context,
reactor); reactor);
@ -806,8 +810,8 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
friend class ClientCallbackReaderFactory<Response>; friend class ClientCallbackReaderFactory<Response>;
template <class Request> template <class Request>
ClientCallbackReaderImpl(grpc::internal::Call call, ClientCallbackReaderImpl(::grpc::internal::Call call,
grpc::ClientContext* context, Request* request, ::grpc::ClientContext* context, Request* request,
ClientReadReactor<Response>* reactor) ClientReadReactor<Response>* reactor)
: context_(context), call_(call), reactor_(reactor) { : context_(context), call_(call), reactor_(reactor) {
this->BindReactor(reactor); this->BindReactor(reactor);
@ -820,11 +824,11 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
void MaybeFinish(bool from_reaction) { void MaybeFinish(bool from_reaction) {
if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub( if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub(
1, std::memory_order_acq_rel) == 1)) { 1, std::memory_order_acq_rel) == 1)) {
grpc::Status s = std::move(finish_status_); ::grpc::Status s = std::move(finish_status_);
auto* reactor = reactor_; auto* reactor = reactor_;
auto* call = call_.call(); auto* call = call_.call();
this->~ClientCallbackReaderImpl(); this->~ClientCallbackReaderImpl();
grpc::g_core_codegen_interface->grpc_call_unref(call); ::grpc::g_core_codegen_interface->grpc_call_unref(call);
if (GPR_LIKELY(from_reaction)) { if (GPR_LIKELY(from_reaction)) {
reactor->OnDone(s); reactor->OnDone(s);
} else { } else {
@ -833,7 +837,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
} }
} }
grpc::ClientContext* const context_; ::grpc::ClientContext* const context_;
grpc::internal::Call call_; grpc::internal::Call call_;
ClientReadReactor<Response>* const reactor_; ClientReadReactor<Response>* const reactor_;
@ -846,7 +850,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
grpc::internal::CallOpSet<grpc::internal::CallOpClientRecvStatus> finish_ops_; grpc::internal::CallOpSet<grpc::internal::CallOpClientRecvStatus> finish_ops_;
grpc::internal::CallbackWithSuccessTag finish_tag_; grpc::internal::CallbackWithSuccessTag finish_tag_;
grpc::Status finish_status_; ::grpc::Status finish_status_;
grpc::internal::CallOpSet<grpc::internal::CallOpRecvMessage<Response>> grpc::internal::CallOpSet<grpc::internal::CallOpRecvMessage<Response>>
read_ops_; read_ops_;
@ -867,15 +871,15 @@ template <class Response>
class ClientCallbackReaderFactory { class ClientCallbackReaderFactory {
public: public:
template <class Request> template <class Request>
static void Create(grpc::ChannelInterface* channel, static void Create(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, const Request* request, ::grpc::ClientContext* context, const Request* request,
ClientReadReactor<Response>* reactor) { ClientReadReactor<Response>* reactor) {
grpc::internal::Call call = grpc::internal::Call call =
channel->CreateCall(method, context, channel->CallbackCQ()); channel->CreateCall(method, context, channel->CallbackCQ());
grpc::g_core_codegen_interface->grpc_call_ref(call.call()); ::grpc::g_core_codegen_interface->grpc_call_ref(call.call());
new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientCallbackReaderImpl<Response>))) call.call(), sizeof(ClientCallbackReaderImpl<Response>)))
ClientCallbackReaderImpl<Response>(call, context, request, reactor); ClientCallbackReaderImpl<Response>(call, context, request, reactor);
} }
@ -928,7 +932,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
this->MaybeFinish(/*from_reaction=*/false); this->MaybeFinish(/*from_reaction=*/false);
} }
void Write(const Request* msg, grpc::WriteOptions options) void Write(const Request* msg, ::grpc::WriteOptions options)
ABSL_LOCKS_EXCLUDED(start_mu_) override { ABSL_LOCKS_EXCLUDED(start_mu_) override {
if (GPR_UNLIKELY(options.is_last_message())) { if (GPR_UNLIKELY(options.is_last_message())) {
options.set_buffer_hint(); options.set_buffer_hint();
@ -991,8 +995,8 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
friend class ClientCallbackWriterFactory<Request>; friend class ClientCallbackWriterFactory<Request>;
template <class Response> template <class Response>
ClientCallbackWriterImpl(grpc::internal::Call call, ClientCallbackWriterImpl(::grpc::internal::Call call,
grpc::ClientContext* context, Response* response, ::grpc::ClientContext* context, Response* response,
ClientWriteReactor<Request>* reactor) ClientWriteReactor<Request>* reactor)
: context_(context), : context_(context),
call_(call), call_(call),
@ -1038,11 +1042,11 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
void MaybeFinish(bool from_reaction) { void MaybeFinish(bool from_reaction) {
if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub( if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub(
1, std::memory_order_acq_rel) == 1)) { 1, std::memory_order_acq_rel) == 1)) {
grpc::Status s = std::move(finish_status_); ::grpc::Status s = std::move(finish_status_);
auto* reactor = reactor_; auto* reactor = reactor_;
auto* call = call_.call(); auto* call = call_.call();
this->~ClientCallbackWriterImpl(); this->~ClientCallbackWriterImpl();
grpc::g_core_codegen_interface->grpc_call_unref(call); ::grpc::g_core_codegen_interface->grpc_call_unref(call);
if (GPR_LIKELY(from_reaction)) { if (GPR_LIKELY(from_reaction)) {
reactor->OnDone(s); reactor->OnDone(s);
} else { } else {
@ -1051,7 +1055,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
} }
} }
grpc::ClientContext* const context_; ::grpc::ClientContext* const context_;
grpc::internal::Call call_; grpc::internal::Call call_;
ClientWriteReactor<Request>* const reactor_; ClientWriteReactor<Request>* const reactor_;
@ -1067,7 +1071,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
grpc::internal::CallOpClientRecvStatus> grpc::internal::CallOpClientRecvStatus>
finish_ops_; finish_ops_;
grpc::internal::CallbackWithSuccessTag finish_tag_; grpc::internal::CallbackWithSuccessTag finish_tag_;
grpc::Status finish_status_; ::grpc::Status finish_status_;
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, grpc::internal::CallOpSendMessage,
@ -1096,15 +1100,15 @@ template <class Request>
class ClientCallbackWriterFactory { class ClientCallbackWriterFactory {
public: public:
template <class Response> template <class Response>
static void Create(grpc::ChannelInterface* channel, static void Create(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, Response* response, ::grpc::ClientContext* context, Response* response,
ClientWriteReactor<Request>* reactor) { ClientWriteReactor<Request>* reactor) {
grpc::internal::Call call = grpc::internal::Call call =
channel->CreateCall(method, context, channel->CallbackCQ()); channel->CreateCall(method, context, channel->CallbackCQ());
grpc::g_core_codegen_interface->grpc_call_ref(call.call()); ::grpc::g_core_codegen_interface->grpc_call_ref(call.call());
new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientCallbackWriterImpl<Request>))) call.call(), sizeof(ClientCallbackWriterImpl<Request>)))
ClientCallbackWriterImpl<Request>(call, context, response, reactor); ClientCallbackWriterImpl<Request>(call, context, response, reactor);
} }
@ -1155,8 +1159,8 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
friend class ClientCallbackUnaryFactory; friend class ClientCallbackUnaryFactory;
template <class Request, class Response> template <class Request, class Response>
ClientCallbackUnaryImpl(grpc::internal::Call call, ClientCallbackUnaryImpl(::grpc::internal::Call call,
grpc::ClientContext* context, Request* request, ::grpc::ClientContext* context, Request* request,
Response* response, ClientUnaryReactor* reactor) Response* response, ClientUnaryReactor* reactor)
: context_(context), call_(call), reactor_(reactor) { : context_(context), call_(call), reactor_(reactor) {
this->BindReactor(reactor); this->BindReactor(reactor);
@ -1173,16 +1177,16 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
void MaybeFinish() { void MaybeFinish() {
if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub( if (GPR_UNLIKELY(callbacks_outstanding_.fetch_sub(
1, std::memory_order_acq_rel) == 1)) { 1, std::memory_order_acq_rel) == 1)) {
grpc::Status s = std::move(finish_status_); ::grpc::Status s = std::move(finish_status_);
auto* reactor = reactor_; auto* reactor = reactor_;
auto* call = call_.call(); auto* call = call_.call();
this->~ClientCallbackUnaryImpl(); this->~ClientCallbackUnaryImpl();
grpc::g_core_codegen_interface->grpc_call_unref(call); ::grpc::g_core_codegen_interface->grpc_call_unref(call);
reactor->OnDone(s); reactor->OnDone(s);
} }
} }
grpc::ClientContext* const context_; ::grpc::ClientContext* const context_;
grpc::internal::Call call_; grpc::internal::Call call_;
ClientUnaryReactor* const reactor_; ClientUnaryReactor* const reactor_;
@ -1197,7 +1201,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
grpc::internal::CallOpClientRecvStatus> grpc::internal::CallOpClientRecvStatus>
finish_ops_; finish_ops_;
grpc::internal::CallbackWithSuccessTag finish_tag_; grpc::internal::CallbackWithSuccessTag finish_tag_;
grpc::Status finish_status_; ::grpc::Status finish_status_;
// This call will have 2 callbacks: start and finish // This call will have 2 callbacks: start and finish
std::atomic<intptr_t> callbacks_outstanding_{2}; std::atomic<intptr_t> callbacks_outstanding_{2};
@ -1207,16 +1211,16 @@ class ClientCallbackUnaryFactory {
public: public:
template <class Request, class Response, class BaseRequest = Request, template <class Request, class Response, class BaseRequest = Request,
class BaseResponse = Response> class BaseResponse = Response>
static void Create(grpc::ChannelInterface* channel, static void Create(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, const Request* request, ::grpc::ClientContext* context, const Request* request,
Response* response, ClientUnaryReactor* reactor) { Response* response, ClientUnaryReactor* reactor) {
grpc::internal::Call call = grpc::internal::Call call =
channel->CreateCall(method, context, channel->CallbackCQ()); channel->CreateCall(method, context, channel->CallbackCQ());
grpc::g_core_codegen_interface->grpc_call_ref(call.call()); ::grpc::g_core_codegen_interface->grpc_call_ref(call.call());
new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientCallbackUnaryImpl))) call.call(), sizeof(ClientCallbackUnaryImpl)))
ClientCallbackUnaryImpl(call, context, ClientCallbackUnaryImpl(call, context,
static_cast<const BaseRequest*>(request), static_cast<const BaseRequest*>(request),

View File

@ -430,38 +430,38 @@ class ClientContext {
ClientContext(const ClientContext&); ClientContext(const ClientContext&);
ClientContext& operator=(const ClientContext&); ClientContext& operator=(const ClientContext&);
friend class grpc::testing::InteropClientContextInspector; friend class ::grpc::testing::InteropClientContextInspector;
friend class grpc::testing::ClientContextTestPeer; friend class ::grpc::testing::ClientContextTestPeer;
friend class grpc::internal::CallOpClientRecvStatus; friend class ::grpc::internal::CallOpClientRecvStatus;
friend class grpc::internal::CallOpRecvInitialMetadata; friend class ::grpc::internal::CallOpRecvInitialMetadata;
friend class grpc::Channel; friend class ::grpc::Channel;
template <class R> template <class R>
friend class grpc::ClientReader; friend class ::grpc::ClientReader;
template <class W> template <class W>
friend class grpc::ClientWriter; friend class ::grpc::ClientWriter;
template <class W, class R> template <class W, class R>
friend class grpc::ClientReaderWriter; friend class ::grpc::ClientReaderWriter;
template <class R> template <class R>
friend class grpc::ClientAsyncReader; friend class ::grpc::ClientAsyncReader;
template <class W> template <class W>
friend class grpc::ClientAsyncWriter; friend class ::grpc::ClientAsyncWriter;
template <class W, class R> template <class W, class R>
friend class grpc::ClientAsyncReaderWriter; friend class ::grpc::ClientAsyncReaderWriter;
template <class R> template <class R>
friend class grpc::ClientAsyncResponseReader; friend class ::grpc::ClientAsyncResponseReader;
friend class grpc::internal::ClientAsyncResponseReaderHelper; friend class ::grpc::internal::ClientAsyncResponseReaderHelper;
template <class InputMessage, class OutputMessage> template <class InputMessage, class OutputMessage>
friend class grpc::internal::BlockingUnaryCallImpl; friend class ::grpc::internal::BlockingUnaryCallImpl;
template <class InputMessage, class OutputMessage> template <class InputMessage, class OutputMessage>
friend class grpc::internal::CallbackUnaryCallImpl; friend class ::grpc::internal::CallbackUnaryCallImpl;
template <class Request, class Response> template <class Request, class Response>
friend class grpc::internal::ClientCallbackReaderWriterImpl; friend class ::grpc::internal::ClientCallbackReaderWriterImpl;
template <class Response> template <class Response>
friend class grpc::internal::ClientCallbackReaderImpl; friend class ::grpc::internal::ClientCallbackReaderImpl;
template <class Request> template <class Request>
friend class grpc::internal::ClientCallbackWriterImpl; friend class ::grpc::internal::ClientCallbackWriterImpl;
friend class grpc::internal::ClientCallbackUnaryImpl; friend class ::grpc::internal::ClientCallbackUnaryImpl;
friend class grpc::internal::ClientContextAccessor; friend class ::grpc::internal::ClientContextAccessor;
// Used by friend class CallOpClientRecvStatus // Used by friend class CallOpClientRecvStatus
void set_debug_error_string(const std::string& debug_error_string) { void set_debug_error_string(const std::string& debug_error_string) {

View File

@ -60,10 +60,10 @@ class BlockingUnaryCallImpl {
BlockingUnaryCallImpl(ChannelInterface* channel, const RpcMethod& method, BlockingUnaryCallImpl(ChannelInterface* channel, const RpcMethod& method,
grpc::ClientContext* context, grpc::ClientContext* context,
const InputMessage& request, OutputMessage* result) { const InputMessage& request, OutputMessage* result) {
grpc::CompletionQueue cq(grpc_completion_queue_attributes{ ::grpc::CompletionQueue cq(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,
nullptr}); // Pluckable completion queue nullptr}); // Pluckable completion queue
grpc::internal::Call call(channel->CreateCall(method, context, &cq)); ::grpc::internal::Call call(channel->CreateCall(method, context, &cq));
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpRecvInitialMetadata, CallOpRecvMessage<OutputMessage>, CallOpRecvInitialMetadata, CallOpRecvMessage<OutputMessage>,
CallOpClientSendClose, CallOpClientRecvStatus> CallOpClientSendClose, CallOpClientRecvStatus>

View File

@ -64,8 +64,8 @@ class ServerReaderWriterBody;
template <class ResponseType> template <class ResponseType>
void UnaryRunHandlerHelper( void UnaryRunHandlerHelper(
const grpc::internal::MethodHandler::HandlerParameter&, ResponseType*, const ::grpc::internal::MethodHandler::HandlerParameter&, ResponseType*,
grpc::Status&); ::grpc::Status&);
template <class ServiceType, class RequestType, class ResponseType, template <class ServiceType, class RequestType, class ResponseType,
class BaseRequestType, class BaseResponseType> class BaseRequestType, class BaseResponseType>
class RpcMethodHandler; class RpcMethodHandler;
@ -101,7 +101,7 @@ extern CoreCodegenInterface* g_core_codegen_interface;
/// src/core/lib/surface/completion_queue.h). /// src/core/lib/surface/completion_queue.h).
/// See \ref doc/cpp/perf_notes.md for notes on best practices for high /// See \ref doc/cpp/perf_notes.md for notes on best practices for high
/// performance servers. /// performance servers.
class CompletionQueue : private grpc::GrpcLibraryCodegen { class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
public: public:
/// Default constructor. Implicitly creates a \a grpc_completion_queue /// Default constructor. Implicitly creates a \a grpc_completion_queue
/// instance. /// instance.
@ -117,7 +117,7 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
/// Destructor. Destroys the owned wrapped completion queue / instance. /// Destructor. Destroys the owned wrapped completion queue / instance.
~CompletionQueue() override { ~CompletionQueue() override {
grpc::g_core_codegen_interface->grpc_completion_queue_destroy(cq_); ::grpc::g_core_codegen_interface->grpc_completion_queue_destroy(cq_);
} }
/// Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT. /// Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
@ -183,7 +183,7 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
// false. // false.
// GOT_EVENT - we actually got an event, return true. // GOT_EVENT - we actually got an event, return true.
return (AsyncNextInternal(tag, ok, return (AsyncNextInternal(tag, ok,
grpc::g_core_codegen_interface->gpr_inf_future( ::grpc::g_core_codegen_interface->gpr_inf_future(
GPR_CLOCK_REALTIME)) == GOT_EVENT); GPR_CLOCK_REALTIME)) == GOT_EVENT);
} }
@ -200,7 +200,7 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
/// \return The type of event read. /// \return The type of event read.
template <typename T> template <typename T>
NextStatus AsyncNext(void** tag, bool* ok, const T& deadline) { NextStatus AsyncNext(void** tag, bool* ok, const T& deadline) {
grpc::TimePoint<T> deadline_tp(deadline); ::grpc::TimePoint<T> deadline_tp(deadline);
return AsyncNextInternal(tag, ok, deadline_tp.raw_time()); return AsyncNextInternal(tag, ok, deadline_tp.raw_time());
} }
@ -251,8 +251,8 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
protected: protected:
/// Private constructor of CompletionQueue only visible to friend classes /// Private constructor of CompletionQueue only visible to friend classes
explicit CompletionQueue(const grpc_completion_queue_attributes& attributes) { explicit CompletionQueue(const grpc_completion_queue_attributes& attributes) {
cq_ = grpc::g_core_codegen_interface->grpc_completion_queue_create( cq_ = ::grpc::g_core_codegen_interface->grpc_completion_queue_create(
grpc::g_core_codegen_interface->grpc_completion_queue_factory_lookup( ::grpc::g_core_codegen_interface->grpc_completion_queue_factory_lookup(
&attributes), &attributes),
&attributes, nullptr); &attributes, nullptr);
InitialAvalanching(); // reserve this for the future shutdown InitialAvalanching(); // reserve this for the future shutdown
@ -261,46 +261,46 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
private: private:
// Friends for access to server registration lists that enable checking and // Friends for access to server registration lists that enable checking and
// logging on shutdown // logging on shutdown
friend class grpc::ServerBuilder; friend class ::grpc::ServerBuilder;
friend class grpc::Server; friend class ::grpc::Server;
// Friend synchronous wrappers so that they can access Pluck(), which is // Friend synchronous wrappers so that they can access Pluck(), which is
// a semi-private API geared towards the synchronous implementation. // a semi-private API geared towards the synchronous implementation.
template <class R> template <class R>
friend class grpc::ClientReader; friend class ::grpc::ClientReader;
template <class W> template <class W>
friend class grpc::ClientWriter; friend class ::grpc::ClientWriter;
template <class W, class R> template <class W, class R>
friend class grpc::ClientReaderWriter; friend class ::grpc::ClientReaderWriter;
template <class R> template <class R>
friend class grpc::ServerReader; friend class ::grpc::ServerReader;
template <class W> template <class W>
friend class grpc::ServerWriter; friend class ::grpc::ServerWriter;
template <class W, class R> template <class W, class R>
friend class grpc::internal::ServerReaderWriterBody; friend class ::grpc::internal::ServerReaderWriterBody;
template <class ResponseType> template <class ResponseType>
friend void grpc::internal::UnaryRunHandlerHelper( friend void ::grpc::internal::UnaryRunHandlerHelper(
const grpc::internal::MethodHandler::HandlerParameter&, ResponseType*, const ::grpc::internal::MethodHandler::HandlerParameter&, ResponseType*,
grpc::Status&); ::grpc::Status&);
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
friend class grpc::internal::ClientStreamingHandler; friend class ::grpc::internal::ClientStreamingHandler;
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
friend class grpc::internal::ServerStreamingHandler; friend class ::grpc::internal::ServerStreamingHandler;
template <class Streamer, bool WriteNeeded> template <class Streamer, bool WriteNeeded>
friend class grpc::internal::TemplatedBidiStreamingHandler; friend class ::grpc::internal::TemplatedBidiStreamingHandler;
template <::grpc::StatusCode code> template <::grpc::StatusCode code>
friend class grpc::internal::ErrorMethodHandler; friend class ::grpc::internal::ErrorMethodHandler;
friend class grpc::ServerContextBase; friend class ::grpc::ServerContextBase;
friend class grpc::ServerInterface; friend class ::grpc::ServerInterface;
template <class InputMessage, class OutputMessage> template <class InputMessage, class OutputMessage>
friend class grpc::internal::BlockingUnaryCallImpl; friend class ::grpc::internal::BlockingUnaryCallImpl;
// Friends that need access to constructor for callback CQ // Friends that need access to constructor for callback CQ
friend class grpc::Channel; friend class ::grpc::Channel;
// For access to Register/CompleteAvalanching // For access to Register/CompleteAvalanching
template <class Op1, class Op2, class Op3, class Op4, class Op5, class Op6> template <class Op1, class Op2, class Op3, class Op4, class Op5, class Op6>
friend class grpc::internal::CallOpSet; friend class ::grpc::internal::CallOpSet;
/// EXPERIMENTAL /// EXPERIMENTAL
/// Creates a Thread Local cache to store the first event /// Creates a Thread Local cache to store the first event
@ -321,11 +321,11 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
/// Wraps \a grpc_completion_queue_pluck. /// Wraps \a grpc_completion_queue_pluck.
/// \warning Must not be mixed with calls to \a Next. /// \warning Must not be mixed with calls to \a Next.
bool Pluck(grpc::internal::CompletionQueueTag* tag) { bool Pluck(::grpc::internal::CompletionQueueTag* tag) {
auto deadline = auto deadline =
grpc::g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_REALTIME); ::grpc::g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_REALTIME);
while (true) { while (true) {
auto ev = grpc::g_core_codegen_interface->grpc_completion_queue_pluck( auto ev = ::grpc::g_core_codegen_interface->grpc_completion_queue_pluck(
cq_, tag, deadline, nullptr); cq_, tag, deadline, nullptr);
bool ok = ev.success != 0; bool ok = ev.success != 0;
void* ignored = tag; void* ignored = tag;
@ -344,10 +344,10 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
/// implementation to simple call the other TryPluck function with a zero /// implementation to simple call the other TryPluck function with a zero
/// timeout. i.e: /// timeout. i.e:
/// TryPluck(tag, gpr_time_0(GPR_CLOCK_REALTIME)) /// TryPluck(tag, gpr_time_0(GPR_CLOCK_REALTIME))
void TryPluck(grpc::internal::CompletionQueueTag* tag) { void TryPluck(::grpc::internal::CompletionQueueTag* tag) {
auto deadline = auto deadline =
grpc::g_core_codegen_interface->gpr_time_0(GPR_CLOCK_REALTIME); ::grpc::g_core_codegen_interface->gpr_time_0(GPR_CLOCK_REALTIME);
auto ev = grpc::g_core_codegen_interface->grpc_completion_queue_pluck( auto ev = ::grpc::g_core_codegen_interface->grpc_completion_queue_pluck(
cq_, tag, deadline, nullptr); cq_, tag, deadline, nullptr);
if (ev.type == GRPC_QUEUE_TIMEOUT) return; if (ev.type == GRPC_QUEUE_TIMEOUT) return;
bool ok = ev.success != 0; bool ok = ev.success != 0;
@ -361,9 +361,9 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
/// ///
/// This exects tag->FinalizeResult (if called) to return 'false' i.e expects /// This exects tag->FinalizeResult (if called) to return 'false' i.e expects
/// that the tag is internal not something that is returned to the user. /// that the tag is internal not something that is returned to the user.
void TryPluck(grpc::internal::CompletionQueueTag* tag, void TryPluck(::grpc::internal::CompletionQueueTag* tag,
gpr_timespec deadline) { gpr_timespec deadline) {
auto ev = grpc::g_core_codegen_interface->grpc_completion_queue_pluck( auto ev = ::grpc::g_core_codegen_interface->grpc_completion_queue_pluck(
cq_, tag, deadline, nullptr); cq_, tag, deadline, nullptr);
if (ev.type == GRPC_QUEUE_TIMEOUT || ev.type == GRPC_QUEUE_SHUTDOWN) { if (ev.type == GRPC_QUEUE_TIMEOUT || ev.type == GRPC_QUEUE_SHUTDOWN) {
return; return;
@ -390,18 +390,18 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
void CompleteAvalanching() { void CompleteAvalanching() {
if (gpr_atm_no_barrier_fetch_add(&avalanches_in_flight_, if (gpr_atm_no_barrier_fetch_add(&avalanches_in_flight_,
static_cast<gpr_atm>(-1)) == 1) { static_cast<gpr_atm>(-1)) == 1) {
grpc::g_core_codegen_interface->grpc_completion_queue_shutdown(cq_); ::grpc::g_core_codegen_interface->grpc_completion_queue_shutdown(cq_);
} }
} }
void RegisterServer(const grpc::Server* server) { void RegisterServer(const ::grpc::Server* server) {
(void)server; (void)server;
#ifndef NDEBUG #ifndef NDEBUG
grpc::internal::MutexLock l(&server_list_mutex_); grpc::internal::MutexLock l(&server_list_mutex_);
server_list_.push_back(server); server_list_.push_back(server);
#endif #endif
} }
void UnregisterServer(const grpc::Server* server) { void UnregisterServer(const ::grpc::Server* server) {
(void)server; (void)server;
#ifndef NDEBUG #ifndef NDEBUG
grpc::internal::MutexLock l(&server_list_mutex_); grpc::internal::MutexLock l(&server_list_mutex_);
@ -427,7 +427,7 @@ class CompletionQueue : private grpc::GrpcLibraryCodegen {
// NDEBUG, instantiate it in all cases since otherwise the size will be // NDEBUG, instantiate it in all cases since otherwise the size will be
// inconsistent. // inconsistent.
mutable grpc::internal::Mutex server_list_mutex_; mutable grpc::internal::Mutex server_list_mutex_;
std::list<const grpc::Server*> std::list<const ::grpc::Server*>
server_list_ /* GUARDED_BY(server_list_mutex_) */; server_list_ /* GUARDED_BY(server_list_mutex_) */;
}; };
@ -457,8 +457,8 @@ class ServerCompletionQueue : public CompletionQueue {
polling_type_(polling_type) {} polling_type_(polling_type) {}
grpc_cq_polling_type polling_type_; grpc_cq_polling_type polling_type_;
friend class grpc::ServerBuilder; friend class ::grpc::ServerBuilder;
friend class grpc::Server; friend class ::grpc::Server;
}; };
} // namespace grpc } // namespace grpc

View File

@ -28,7 +28,7 @@
namespace grpc { namespace grpc {
namespace experimental { namespace experimental {
class DelegatingChannel : public grpc::ChannelInterface { class DelegatingChannel : public ::grpc::ChannelInterface {
public: public:
~DelegatingChannel() override {} ~DelegatingChannel() override {}
@ -47,7 +47,7 @@ class DelegatingChannel : public grpc::ChannelInterface {
private: private:
internal::Call CreateCall(const internal::RpcMethod& method, internal::Call CreateCall(const internal::RpcMethod& method,
ClientContext* context, ClientContext* context,
grpc::CompletionQueue* cq) final { ::grpc::CompletionQueue* cq) final {
return delegate_channel()->CreateCall(method, context, cq); return delegate_channel()->CreateCall(method, context, cq);
} }
@ -61,7 +61,8 @@ class DelegatingChannel : public grpc::ChannelInterface {
} }
void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline, grpc::CompletionQueue* cq, gpr_timespec deadline,
::grpc::CompletionQueue* cq,
void* tag) override { void* tag) override {
delegate_channel()->NotifyOnStateChangeImpl(last_observed, deadline, cq, delegate_channel()->NotifyOnStateChangeImpl(last_observed, deadline, cq,
tag); tag);
@ -74,13 +75,13 @@ class DelegatingChannel : public grpc::ChannelInterface {
internal::Call CreateCallInternal(const internal::RpcMethod& method, internal::Call CreateCallInternal(const internal::RpcMethod& method,
ClientContext* context, ClientContext* context,
grpc::CompletionQueue* cq, ::grpc::CompletionQueue* cq,
size_t interceptor_pos) final { size_t interceptor_pos) final {
return delegate_channel()->CreateCallInternal(method, context, cq, return delegate_channel()->CreateCallInternal(method, context, cq,
interceptor_pos); interceptor_pos);
} }
grpc::CompletionQueue* CallbackCQ() final { ::grpc::CompletionQueue* CallbackCQ() final {
return delegate_channel()->CallbackCQ(); return delegate_channel()->CallbackCQ();
} }

View File

@ -48,8 +48,8 @@ class InterceptedChannel : public ChannelInterface {
InterceptedChannel(ChannelInterface* channel, size_t pos) InterceptedChannel(ChannelInterface* channel, size_t pos)
: channel_(channel), interceptor_pos_(pos) {} : channel_(channel), interceptor_pos_(pos) {}
Call CreateCall(const RpcMethod& method, grpc::ClientContext* context, Call CreateCall(const RpcMethod& method, ::grpc::ClientContext* context,
grpc::CompletionQueue* cq) override { ::grpc::CompletionQueue* cq) override {
return channel_->CreateCallInternal(method, context, cq, interceptor_pos_); return channel_->CreateCallInternal(method, context, cq, interceptor_pos_);
} }
@ -61,7 +61,8 @@ class InterceptedChannel : public ChannelInterface {
} }
void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline, grpc::CompletionQueue* cq, gpr_timespec deadline,
::grpc::CompletionQueue* cq,
void* tag) override { void* tag) override {
return channel_->NotifyOnStateChangeImpl(last_observed, deadline, cq, tag); return channel_->NotifyOnStateChangeImpl(last_observed, deadline, cq, tag);
} }
@ -70,7 +71,7 @@ class InterceptedChannel : public ChannelInterface {
return channel_->WaitForStateChangeImpl(last_observed, deadline); return channel_->WaitForStateChangeImpl(last_observed, deadline);
} }
grpc::CompletionQueue* CallbackCQ() override { ::grpc::CompletionQueue* CallbackCQ() override {
return channel_->CallbackCQ(); return channel_->CallbackCQ();
} }

View File

@ -43,8 +43,8 @@ template <class Callable>
try { try {
return handler(); return handler();
} catch (...) { } catch (...) {
return grpc::Status(grpc::StatusCode::UNKNOWN, return ::grpc::Status(::grpc::StatusCode::UNKNOWN,
"Unexpected error in RPC handling"); "Unexpected error in RPC handling");
} }
#else // GRPC_ALLOW_EXCEPTIONS #else // GRPC_ALLOW_EXCEPTIONS
return handler(); return handler();
@ -57,11 +57,11 @@ template <class Callable>
template <class ResponseType> template <class ResponseType>
void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter& param, void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter& param,
ResponseType* rsp, grpc::Status& status) { ResponseType* rsp, ::grpc::Status& status) {
GPR_CODEGEN_ASSERT(!param.server_context->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!param.server_context->sent_initial_metadata_);
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
ops; ops;
ops.SendInitialMetadata(&param.server_context->initial_metadata_, ops.SendInitialMetadata(&param.server_context->initial_metadata_,
param.server_context->initial_metadata_flags()); param.server_context->initial_metadata_flags());
@ -79,11 +79,11 @@ void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter& param,
/// A helper function with reduced templating to do deserializing. /// A helper function with reduced templating to do deserializing.
template <class RequestType> template <class RequestType>
void* UnaryDeserializeHelper(grpc_byte_buffer* req, grpc::Status* status, void* UnaryDeserializeHelper(grpc_byte_buffer* req, ::grpc::Status* status,
RequestType* request) { RequestType* request) {
grpc::ByteBuffer buf; ::grpc::ByteBuffer buf;
buf.set_buffer(req); buf.set_buffer(req);
*status = grpc::SerializationTraits<RequestType>::Deserialize( *status = ::grpc::SerializationTraits<RequestType>::Deserialize(
&buf, static_cast<RequestType*>(request)); &buf, static_cast<RequestType*>(request));
buf.Release(); buf.Release();
if (status->ok()) { if (status->ok()) {
@ -97,10 +97,10 @@ void* UnaryDeserializeHelper(grpc_byte_buffer* req, grpc::Status* status,
template <class ServiceType, class RequestType, class ResponseType, template <class ServiceType, class RequestType, class ResponseType,
class BaseRequestType = RequestType, class BaseRequestType = RequestType,
class BaseResponseType = ResponseType> class BaseResponseType = ResponseType>
class RpcMethodHandler : public grpc::internal::MethodHandler { class RpcMethodHandler : public ::grpc::internal::MethodHandler {
public: public:
RpcMethodHandler( RpcMethodHandler(
std::function<::grpc::Status(ServiceType*, grpc::ServerContext*, std::function<::grpc::Status(ServiceType*, ::grpc::ServerContext*,
const RequestType*, ResponseType*)> const RequestType*, ResponseType*)>
func, func,
ServiceType* service) ServiceType* service)
@ -108,11 +108,11 @@ class RpcMethodHandler : public grpc::internal::MethodHandler {
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
ResponseType rsp; ResponseType rsp;
grpc::Status status = param.status; ::grpc::Status status = param.status;
if (status.ok()) { if (status.ok()) {
status = CatchingFunctionHandler([this, &param, &rsp] { status = CatchingFunctionHandler([this, &param, &rsp] {
return func_(service_, return func_(service_,
static_cast<grpc::ServerContext*>(param.server_context), static_cast<::grpc::ServerContext*>(param.server_context),
static_cast<RequestType*>(param.request), &rsp); static_cast<RequestType*>(param.request), &rsp);
}); });
static_cast<RequestType*>(param.request)->~RequestType(); static_cast<RequestType*>(param.request)->~RequestType();
@ -121,16 +121,17 @@ class RpcMethodHandler : public grpc::internal::MethodHandler {
} }
void* Deserialize(grpc_call* call, grpc_byte_buffer* req, void* Deserialize(grpc_call* call, grpc_byte_buffer* req,
grpc::Status* status, void** /*handler_data*/) final { ::grpc::Status* status, void** /*handler_data*/) final {
auto* request = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( auto* request =
call, sizeof(RequestType))) RequestType; new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call, sizeof(RequestType))) RequestType;
return UnaryDeserializeHelper(req, status, return UnaryDeserializeHelper(req, status,
static_cast<BaseRequestType*>(request)); static_cast<BaseRequestType*>(request));
} }
private: private:
/// Application provided rpc handler function. /// Application provided rpc handler function.
std::function<::grpc::Status(ServiceType*, grpc::ServerContext*, std::function<::grpc::Status(ServiceType*, ::grpc::ServerContext*,
const RequestType*, ResponseType*)> const RequestType*, ResponseType*)>
func_; func_;
// The class the above handler function lives in. // The class the above handler function lives in.
@ -139,10 +140,10 @@ class RpcMethodHandler : public grpc::internal::MethodHandler {
/// A wrapper class of an application provided client streaming handler. /// A wrapper class of an application provided client streaming handler.
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
class ClientStreamingHandler : public grpc::internal::MethodHandler { class ClientStreamingHandler : public ::grpc::internal::MethodHandler {
public: public:
ClientStreamingHandler( ClientStreamingHandler(
std::function<::grpc::Status(ServiceType*, grpc::ServerContext*, std::function<::grpc::Status(ServiceType*, ::grpc::ServerContext*,
ServerReader<RequestType>*, ResponseType*)> ServerReader<RequestType>*, ResponseType*)>
func, func,
ServiceType* service) ServiceType* service)
@ -150,18 +151,18 @@ class ClientStreamingHandler : public grpc::internal::MethodHandler {
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
ServerReader<RequestType> reader( ServerReader<RequestType> reader(
param.call, static_cast<grpc::ServerContext*>(param.server_context)); param.call, static_cast<::grpc::ServerContext*>(param.server_context));
ResponseType rsp; ResponseType rsp;
grpc::Status status = ::grpc::Status status = CatchingFunctionHandler([this, &param, &reader,
CatchingFunctionHandler([this, &param, &reader, &rsp] { &rsp] {
return func_(service_, return func_(service_,
static_cast<grpc::ServerContext*>(param.server_context), static_cast<::grpc::ServerContext*>(param.server_context),
&reader, &rsp); &reader, &rsp);
}); });
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
ops; ops;
if (!param.server_context->sent_initial_metadata_) { if (!param.server_context->sent_initial_metadata_) {
ops.SendInitialMetadata(&param.server_context->initial_metadata_, ops.SendInitialMetadata(&param.server_context->initial_metadata_,
@ -179,7 +180,7 @@ class ClientStreamingHandler : public grpc::internal::MethodHandler {
} }
private: private:
std::function<::grpc::Status(ServiceType*, grpc::ServerContext*, std::function<::grpc::Status(ServiceType*, ::grpc::ServerContext*,
ServerReader<RequestType>*, ResponseType*)> ServerReader<RequestType>*, ResponseType*)>
func_; func_;
ServiceType* service_; ServiceType* service_;
@ -187,30 +188,31 @@ class ClientStreamingHandler : public grpc::internal::MethodHandler {
/// A wrapper class of an application provided server streaming handler. /// A wrapper class of an application provided server streaming handler.
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
class ServerStreamingHandler : public grpc::internal::MethodHandler { class ServerStreamingHandler : public ::grpc::internal::MethodHandler {
public: public:
ServerStreamingHandler(std::function<::grpc::Status( ServerStreamingHandler(std::function<::grpc::Status(
ServiceType*, grpc::ServerContext*, ServiceType*, ::grpc::ServerContext*,
const RequestType*, ServerWriter<ResponseType>*)> const RequestType*, ServerWriter<ResponseType>*)>
func, func,
ServiceType* service) ServiceType* service)
: func_(func), service_(service) {} : func_(func), service_(service) {}
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
grpc::Status status = param.status; ::grpc::Status status = param.status;
if (status.ok()) { if (status.ok()) {
ServerWriter<ResponseType> writer( ServerWriter<ResponseType> writer(
param.call, static_cast<grpc::ServerContext*>(param.server_context)); param.call,
static_cast<::grpc::ServerContext*>(param.server_context));
status = CatchingFunctionHandler([this, &param, &writer] { status = CatchingFunctionHandler([this, &param, &writer] {
return func_(service_, return func_(service_,
static_cast<grpc::ServerContext*>(param.server_context), static_cast<::grpc::ServerContext*>(param.server_context),
static_cast<RequestType*>(param.request), &writer); static_cast<RequestType*>(param.request), &writer);
}); });
static_cast<RequestType*>(param.request)->~RequestType(); static_cast<RequestType*>(param.request)->~RequestType();
} }
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
ops; ops;
if (!param.server_context->sent_initial_metadata_) { if (!param.server_context->sent_initial_metadata_) {
ops.SendInitialMetadata(&param.server_context->initial_metadata_, ops.SendInitialMetadata(&param.server_context->initial_metadata_,
@ -228,13 +230,14 @@ class ServerStreamingHandler : public grpc::internal::MethodHandler {
} }
void* Deserialize(grpc_call* call, grpc_byte_buffer* req, void* Deserialize(grpc_call* call, grpc_byte_buffer* req,
grpc::Status* status, void** /*handler_data*/) final { ::grpc::Status* status, void** /*handler_data*/) final {
grpc::ByteBuffer buf; ::grpc::ByteBuffer buf;
buf.set_buffer(req); buf.set_buffer(req);
auto* request = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( auto* request =
call, sizeof(RequestType))) RequestType(); new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call, sizeof(RequestType))) RequestType();
*status = *status =
grpc::SerializationTraits<RequestType>::Deserialize(&buf, request); ::grpc::SerializationTraits<RequestType>::Deserialize(&buf, request);
buf.Release(); buf.Release();
if (status->ok()) { if (status->ok()) {
return request; return request;
@ -244,7 +247,7 @@ class ServerStreamingHandler : public grpc::internal::MethodHandler {
} }
private: private:
std::function<::grpc::Status(ServiceType*, grpc::ServerContext*, std::function<::grpc::Status(ServiceType*, ::grpc::ServerContext*,
const RequestType*, ServerWriter<ResponseType>*)> const RequestType*, ServerWriter<ResponseType>*)>
func_; func_;
ServiceType* service_; ServiceType* service_;
@ -258,22 +261,22 @@ class ServerStreamingHandler : public grpc::internal::MethodHandler {
/// Instead, it is expected to be an implicitly-captured argument of func /// Instead, it is expected to be an implicitly-captured argument of func
/// (through bind or something along those lines) /// (through bind or something along those lines)
template <class Streamer, bool WriteNeeded> template <class Streamer, bool WriteNeeded>
class TemplatedBidiStreamingHandler : public grpc::internal::MethodHandler { class TemplatedBidiStreamingHandler : public ::grpc::internal::MethodHandler {
public: public:
explicit TemplatedBidiStreamingHandler( explicit TemplatedBidiStreamingHandler(
std::function<::grpc::Status(grpc::ServerContext*, Streamer*)> func) std::function<::grpc::Status(::grpc::ServerContext*, Streamer*)> func)
: func_(func), write_needed_(WriteNeeded) {} : func_(func), write_needed_(WriteNeeded) {}
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
Streamer stream(param.call, Streamer stream(param.call,
static_cast<grpc::ServerContext*>(param.server_context)); static_cast<::grpc::ServerContext*>(param.server_context));
grpc::Status status = CatchingFunctionHandler([this, &param, &stream] { ::grpc::Status status = CatchingFunctionHandler([this, &param, &stream] {
return func_(static_cast<grpc::ServerContext*>(param.server_context), return func_(static_cast<::grpc::ServerContext*>(param.server_context),
&stream); &stream);
}); });
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
ops; ops;
if (!param.server_context->sent_initial_metadata_) { if (!param.server_context->sent_initial_metadata_) {
ops.SendInitialMetadata(&param.server_context->initial_metadata_, ops.SendInitialMetadata(&param.server_context->initial_metadata_,
@ -284,8 +287,8 @@ class TemplatedBidiStreamingHandler : public grpc::internal::MethodHandler {
if (write_needed_ && status.ok()) { if (write_needed_ && status.ok()) {
// If we needed a write but never did one, we need to mark the // If we needed a write but never did one, we need to mark the
// status as a fail // status as a fail
status = grpc::Status(grpc::StatusCode::INTERNAL, status = ::grpc::Status(::grpc::StatusCode::INTERNAL,
"Service did not provide response message"); "Service did not provide response message");
} }
} }
ops.ServerSendStatus(&param.server_context->trailing_metadata_, status); ops.ServerSendStatus(&param.server_context->trailing_metadata_, status);
@ -297,7 +300,7 @@ class TemplatedBidiStreamingHandler : public grpc::internal::MethodHandler {
} }
private: private:
std::function<::grpc::Status(grpc::ServerContext*, Streamer*)> func_; std::function<::grpc::Status(::grpc::ServerContext*, Streamer*)> func_;
const bool write_needed_; const bool write_needed_;
}; };
@ -307,7 +310,7 @@ class BidiStreamingHandler
ServerReaderWriter<ResponseType, RequestType>, false> { ServerReaderWriter<ResponseType, RequestType>, false> {
public: public:
BidiStreamingHandler(std::function<::grpc::Status( BidiStreamingHandler(std::function<::grpc::Status(
ServiceType*, grpc::ServerContext*, ServiceType*, ::grpc::ServerContext*,
ServerReaderWriter<ResponseType, RequestType>*)> ServerReaderWriter<ResponseType, RequestType>*)>
func, func,
ServiceType* service) ServiceType* service)
@ -315,7 +318,7 @@ class BidiStreamingHandler
: TemplatedBidiStreamingHandler< : TemplatedBidiStreamingHandler<
ServerReaderWriter<ResponseType, RequestType>, false>( ServerReaderWriter<ResponseType, RequestType>, false>(
[func, service]( [func, service](
grpc::ServerContext* ctx, ::grpc::ServerContext* ctx,
ServerReaderWriter<ResponseType, RequestType>* streamer) { ServerReaderWriter<ResponseType, RequestType>* streamer) {
return func(service, ctx, streamer); return func(service, ctx, streamer);
}) {} }) {}
@ -328,8 +331,8 @@ class StreamedUnaryHandler
public: public:
explicit StreamedUnaryHandler( explicit StreamedUnaryHandler(
std::function< std::function<
grpc::Status(grpc::ServerContext*, ::grpc::Status(::grpc::ServerContext*,
ServerUnaryStreamer<RequestType, ResponseType>*)> ServerUnaryStreamer<RequestType, ResponseType>*)>
func) func)
: TemplatedBidiStreamingHandler< : TemplatedBidiStreamingHandler<
ServerUnaryStreamer<RequestType, ResponseType>, true>( ServerUnaryStreamer<RequestType, ResponseType>, true>(
@ -343,8 +346,8 @@ class SplitServerStreamingHandler
public: public:
explicit SplitServerStreamingHandler( explicit SplitServerStreamingHandler(
std::function< std::function<
grpc::Status(grpc::ServerContext*, ::grpc::Status(::grpc::ServerContext*,
ServerSplitStreamer<RequestType, ResponseType>*)> ServerSplitStreamer<RequestType, ResponseType>*)>
func) func)
: TemplatedBidiStreamingHandler< : TemplatedBidiStreamingHandler<
ServerSplitStreamer<RequestType, ResponseType>, false>( ServerSplitStreamer<RequestType, ResponseType>, false>(
@ -354,14 +357,14 @@ class SplitServerStreamingHandler
/// General method handler class for errors that prevent real method use /// General method handler class for errors that prevent real method use
/// e.g., handle unknown method by returning UNIMPLEMENTED error. /// e.g., handle unknown method by returning UNIMPLEMENTED error.
template <::grpc::StatusCode code> template <::grpc::StatusCode code>
class ErrorMethodHandler : public grpc::internal::MethodHandler { class ErrorMethodHandler : public ::grpc::internal::MethodHandler {
public: public:
explicit ErrorMethodHandler(const std::string& message) : message_(message) {} explicit ErrorMethodHandler(const std::string& message) : message_(message) {}
template <class T> template <class T>
static void FillOps(grpc::ServerContextBase* context, static void FillOps(::grpc::ServerContextBase* context,
const std::string& message, T* ops) { const std::string& message, T* ops) {
grpc::Status status(code, message); ::grpc::Status status(code, message);
if (!context->sent_initial_metadata_) { if (!context->sent_initial_metadata_) {
ops->SendInitialMetadata(&context->initial_metadata_, ops->SendInitialMetadata(&context->initial_metadata_,
context->initial_metadata_flags()); context->initial_metadata_flags());
@ -374,8 +377,8 @@ class ErrorMethodHandler : public grpc::internal::MethodHandler {
} }
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
ops; ops;
FillOps(param.server_context, message_, &ops); FillOps(param.server_context, message_, &ops);
param.call->PerformOps(&ops); param.call->PerformOps(&ops);
@ -383,10 +386,10 @@ class ErrorMethodHandler : public grpc::internal::MethodHandler {
} }
void* Deserialize(grpc_call* /*call*/, grpc_byte_buffer* req, void* Deserialize(grpc_call* /*call*/, grpc_byte_buffer* req,
grpc::Status* /*status*/, void** /*handler_data*/) final { ::grpc::Status* /*status*/, void** /*handler_data*/) final {
// We have to destroy any request payload // We have to destroy any request payload
if (req != nullptr) { if (req != nullptr) {
grpc::g_core_codegen_interface->grpc_byte_buffer_destroy(req); ::grpc::g_core_codegen_interface->grpc_byte_buffer_destroy(req);
} }
return nullptr; return nullptr;
} }

View File

@ -45,7 +45,7 @@ extern CoreCodegenInterface* g_core_codegen_interface;
/// ///
/// Read more about ZeroCopyInputStream interface here: /// Read more about ZeroCopyInputStream interface here:
/// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyInputStream /// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyInputStream
class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream {
public: public:
/// Constructs buffer reader from \a buffer. Will set \a status() to non ok /// Constructs buffer reader from \a buffer. Will set \a status() to non ok
/// if \a buffer is invalid (the internal buffer has not been initialized). /// if \a buffer is invalid (the internal buffer has not been initialized).

View File

@ -52,7 +52,7 @@ const int kProtoBufferWriterMaxBufferLength = 1024 * 1024;
/// ///
/// Read more about ZeroCopyOutputStream interface here: /// Read more about ZeroCopyOutputStream interface here:
/// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyOutputStream /// https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.zero_copy_stream#ZeroCopyOutputStream
class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
public: public:
/// Constructor for this derived class /// Constructor for this derived class
/// ///

View File

@ -51,7 +51,7 @@ class MethodHandler {
/// \param requester : used only by the callback API. It is a function /// \param requester : used only by the callback API. It is a function
/// called by the RPC Controller to request another RPC (and also /// called by the RPC Controller to request another RPC (and also
/// to set up the state required to make that request possible) /// to set up the state required to make that request possible)
HandlerParameter(Call* c, grpc::ServerContextBase* context, void* req, HandlerParameter(Call* c, ::grpc::ServerContextBase* context, void* req,
Status req_status, void* handler_data, Status req_status, void* handler_data,
std::function<void()> requester) std::function<void()> requester)
: call(c), : call(c),
@ -62,7 +62,7 @@ class MethodHandler {
call_requester(std::move(requester)) {} call_requester(std::move(requester)) {}
~HandlerParameter() {} ~HandlerParameter() {}
Call* const call; Call* const call;
grpc::ServerContextBase* const server_context; ::grpc::ServerContextBase* const server_context;
void* const request; void* const request;
const Status status; const Status status;
void* const internal_data; void* const internal_data;

View File

@ -193,7 +193,7 @@ class ServerBidiReactor;
class ServerCallbackUnary : public internal::ServerCallbackCall { class ServerCallbackUnary : public internal::ServerCallbackCall {
public: public:
~ServerCallbackUnary() override {} ~ServerCallbackUnary() override {}
virtual void Finish(grpc::Status s) = 0; virtual void Finish(::grpc::Status s) = 0;
virtual void SendInitialMetadata() = 0; virtual void SendInitialMetadata() = 0;
protected: protected:
@ -209,7 +209,7 @@ template <class Request>
class ServerCallbackReader : public internal::ServerCallbackCall { class ServerCallbackReader : public internal::ServerCallbackCall {
public: public:
~ServerCallbackReader() override {} ~ServerCallbackReader() override {}
virtual void Finish(grpc::Status s) = 0; virtual void Finish(::grpc::Status s) = 0;
virtual void SendInitialMetadata() = 0; virtual void SendInitialMetadata() = 0;
virtual void Read(Request* msg) = 0; virtual void Read(Request* msg) = 0;
@ -224,11 +224,11 @@ class ServerCallbackWriter : public internal::ServerCallbackCall {
public: public:
~ServerCallbackWriter() override {} ~ServerCallbackWriter() override {}
virtual void Finish(grpc::Status s) = 0; virtual void Finish(::grpc::Status s) = 0;
virtual void SendInitialMetadata() = 0; virtual void SendInitialMetadata() = 0;
virtual void Write(const Response* msg, grpc::WriteOptions options) = 0; virtual void Write(const Response* msg, ::grpc::WriteOptions options) = 0;
virtual void WriteAndFinish(const Response* msg, grpc::WriteOptions options, virtual void WriteAndFinish(const Response* msg, ::grpc::WriteOptions options,
grpc::Status s) = 0; ::grpc::Status s) = 0;
protected: protected:
void BindReactor(ServerWriteReactor<Response>* reactor) { void BindReactor(ServerWriteReactor<Response>* reactor) {
@ -241,12 +241,12 @@ class ServerCallbackReaderWriter : public internal::ServerCallbackCall {
public: public:
~ServerCallbackReaderWriter() override {} ~ServerCallbackReaderWriter() override {}
virtual void Finish(grpc::Status s) = 0; virtual void Finish(::grpc::Status s) = 0;
virtual void SendInitialMetadata() = 0; virtual void SendInitialMetadata() = 0;
virtual void Read(Request* msg) = 0; virtual void Read(Request* msg) = 0;
virtual void Write(const Response* msg, grpc::WriteOptions options) = 0; virtual void Write(const Response* msg, ::grpc::WriteOptions options) = 0;
virtual void WriteAndFinish(const Response* msg, grpc::WriteOptions options, virtual void WriteAndFinish(const Response* msg, ::grpc::WriteOptions options,
grpc::Status s) = 0; ::grpc::Status s) = 0;
protected: protected:
void BindReactor(ServerBidiReactor<Request, Response>* reactor) { void BindReactor(ServerBidiReactor<Request, Response>* reactor) {
@ -318,7 +318,7 @@ class ServerBidiReactor : public internal::ServerReactor {
/// ownership but the caller must ensure that the message is /// ownership but the caller must ensure that the message is
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
void StartWrite(const Response* resp) { void StartWrite(const Response* resp) {
StartWrite(resp, grpc::WriteOptions()); StartWrite(resp, ::grpc::WriteOptions());
} }
/// Initiate a write operation with specified options. /// Initiate a write operation with specified options.
@ -327,7 +327,7 @@ class ServerBidiReactor : public internal::ServerReactor {
/// ownership but the caller must ensure that the message is /// ownership but the caller must ensure that the message is
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
/// \param[in] options The WriteOptions to use for writing this message /// \param[in] options The WriteOptions to use for writing this message
void StartWrite(const Response* resp, grpc::WriteOptions options) void StartWrite(const Response* resp, ::grpc::WriteOptions options)
ABSL_LOCKS_EXCLUDED(stream_mu_) { ABSL_LOCKS_EXCLUDED(stream_mu_) {
ServerCallbackReaderWriter<Request, Response>* stream = ServerCallbackReaderWriter<Request, Response>* stream =
stream_.load(std::memory_order_acquire); stream_.load(std::memory_order_acquire);
@ -356,8 +356,8 @@ class ServerBidiReactor : public internal::ServerReactor {
/// not deleted or modified until OnDone is called. /// not deleted or modified until OnDone is called.
/// \param[in] options The WriteOptions to use for writing this message /// \param[in] options The WriteOptions to use for writing this message
/// \param[in] s The status outcome of this RPC /// \param[in] s The status outcome of this RPC
void StartWriteAndFinish(const Response* resp, grpc::WriteOptions options, void StartWriteAndFinish(const Response* resp, ::grpc::WriteOptions options,
grpc::Status s) ABSL_LOCKS_EXCLUDED(stream_mu_) { ::grpc::Status s) ABSL_LOCKS_EXCLUDED(stream_mu_) {
ServerCallbackReaderWriter<Request, Response>* stream = ServerCallbackReaderWriter<Request, Response>* stream =
stream_.load(std::memory_order_acquire); stream_.load(std::memory_order_acquire);
if (stream == nullptr) { if (stream == nullptr) {
@ -382,7 +382,7 @@ class ServerBidiReactor : public internal::ServerReactor {
/// ownership but the caller must ensure that the message is /// ownership but the caller must ensure that the message is
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
/// \param[in] options The WriteOptions to use for writing this message /// \param[in] options The WriteOptions to use for writing this message
void StartWriteLast(const Response* resp, grpc::WriteOptions options) { void StartWriteLast(const Response* resp, ::grpc::WriteOptions options) {
StartWrite(resp, options.set_last_message()); StartWrite(resp, options.set_last_message());
} }
@ -392,7 +392,7 @@ class ServerBidiReactor : public internal::ServerReactor {
/// cancelled. /// cancelled.
/// ///
/// \param[in] s The status outcome of this RPC /// \param[in] s The status outcome of this RPC
void Finish(grpc::Status s) ABSL_LOCKS_EXCLUDED(stream_mu_) { void Finish(::grpc::Status s) ABSL_LOCKS_EXCLUDED(stream_mu_) {
ServerCallbackReaderWriter<Request, Response>* stream = ServerCallbackReaderWriter<Request, Response>* stream =
stream_.load(std::memory_order_acquire); stream_.load(std::memory_order_acquire);
if (stream == nullptr) { if (stream == nullptr) {
@ -481,8 +481,8 @@ class ServerBidiReactor : public internal::ServerReactor {
bool finish_wanted = false; bool finish_wanted = false;
Request* read_wanted = nullptr; Request* read_wanted = nullptr;
const Response* write_wanted = nullptr; const Response* write_wanted = nullptr;
grpc::WriteOptions write_options_wanted; ::grpc::WriteOptions write_options_wanted;
grpc::Status status_wanted; ::grpc::Status status_wanted;
}; };
PreBindBacklog backlog_ ABSL_GUARDED_BY(stream_mu_); PreBindBacklog backlog_ ABSL_GUARDED_BY(stream_mu_);
}; };
@ -521,7 +521,7 @@ class ServerReadReactor : public internal::ServerReactor {
} }
reader->Read(req); reader->Read(req);
} }
void Finish(grpc::Status s) ABSL_LOCKS_EXCLUDED(reader_mu_) { void Finish(::grpc::Status s) ABSL_LOCKS_EXCLUDED(reader_mu_) {
ServerCallbackReader<Request>* reader = ServerCallbackReader<Request>* reader =
reader_.load(std::memory_order_acquire); reader_.load(std::memory_order_acquire);
if (reader == nullptr) { if (reader == nullptr) {
@ -570,7 +570,7 @@ class ServerReadReactor : public internal::ServerReactor {
bool send_initial_metadata_wanted = false; bool send_initial_metadata_wanted = false;
bool finish_wanted = false; bool finish_wanted = false;
Request* read_wanted = nullptr; Request* read_wanted = nullptr;
grpc::Status status_wanted; ::grpc::Status status_wanted;
}; };
PreBindBacklog backlog_ ABSL_GUARDED_BY(reader_mu_); PreBindBacklog backlog_ ABSL_GUARDED_BY(reader_mu_);
}; };
@ -597,9 +597,9 @@ class ServerWriteReactor : public internal::ServerReactor {
writer->SendInitialMetadata(); writer->SendInitialMetadata();
} }
void StartWrite(const Response* resp) { void StartWrite(const Response* resp) {
StartWrite(resp, grpc::WriteOptions()); StartWrite(resp, ::grpc::WriteOptions());
} }
void StartWrite(const Response* resp, grpc::WriteOptions options) void StartWrite(const Response* resp, ::grpc::WriteOptions options)
ABSL_LOCKS_EXCLUDED(writer_mu_) { ABSL_LOCKS_EXCLUDED(writer_mu_) {
ServerCallbackWriter<Response>* writer = ServerCallbackWriter<Response>* writer =
writer_.load(std::memory_order_acquire); writer_.load(std::memory_order_acquire);
@ -614,8 +614,8 @@ class ServerWriteReactor : public internal::ServerReactor {
} }
writer->Write(resp, options); writer->Write(resp, options);
} }
void StartWriteAndFinish(const Response* resp, grpc::WriteOptions options, void StartWriteAndFinish(const Response* resp, ::grpc::WriteOptions options,
grpc::Status s) ABSL_LOCKS_EXCLUDED(writer_mu_) { ::grpc::Status s) ABSL_LOCKS_EXCLUDED(writer_mu_) {
ServerCallbackWriter<Response>* writer = ServerCallbackWriter<Response>* writer =
writer_.load(std::memory_order_acquire); writer_.load(std::memory_order_acquire);
if (writer == nullptr) { if (writer == nullptr) {
@ -631,10 +631,10 @@ class ServerWriteReactor : public internal::ServerReactor {
} }
writer->WriteAndFinish(resp, options, std::move(s)); writer->WriteAndFinish(resp, options, std::move(s));
} }
void StartWriteLast(const Response* resp, grpc::WriteOptions options) { void StartWriteLast(const Response* resp, ::grpc::WriteOptions options) {
StartWrite(resp, options.set_last_message()); StartWrite(resp, options.set_last_message());
} }
void Finish(grpc::Status s) ABSL_LOCKS_EXCLUDED(writer_mu_) { void Finish(::grpc::Status s) ABSL_LOCKS_EXCLUDED(writer_mu_) {
ServerCallbackWriter<Response>* writer = ServerCallbackWriter<Response>* writer =
writer_.load(std::memory_order_acquire); writer_.load(std::memory_order_acquire);
if (writer == nullptr) { if (writer == nullptr) {
@ -690,8 +690,8 @@ class ServerWriteReactor : public internal::ServerReactor {
bool write_and_finish_wanted = false; bool write_and_finish_wanted = false;
bool finish_wanted = false; bool finish_wanted = false;
const Response* write_wanted = nullptr; const Response* write_wanted = nullptr;
grpc::WriteOptions write_options_wanted; ::grpc::WriteOptions write_options_wanted;
grpc::Status status_wanted; ::grpc::Status status_wanted;
}; };
PreBindBacklog backlog_ ABSL_GUARDED_BY(writer_mu_); PreBindBacklog backlog_ ABSL_GUARDED_BY(writer_mu_);
}; };
@ -717,7 +717,7 @@ class ServerUnaryReactor : public internal::ServerReactor {
/// Finish is similar to ServerBidiReactor except for one detail. /// Finish is similar to ServerBidiReactor except for one detail.
/// If the status is non-OK, any message will not be sent. Instead, /// If the status is non-OK, any message will not be sent. Instead,
/// the client will only receive the status and any trailing metadata. /// the client will only receive the status and any trailing metadata.
void Finish(grpc::Status s) ABSL_LOCKS_EXCLUDED(call_mu_) { void Finish(::grpc::Status s) ABSL_LOCKS_EXCLUDED(call_mu_) {
ServerCallbackUnary* call = call_.load(std::memory_order_acquire); ServerCallbackUnary* call = call_.load(std::memory_order_acquire);
if (call == nullptr) { if (call == nullptr) {
grpc::internal::MutexLock l(&call_mu_); grpc::internal::MutexLock l(&call_mu_);
@ -759,7 +759,7 @@ class ServerUnaryReactor : public internal::ServerReactor {
struct PreBindBacklog { struct PreBindBacklog {
bool send_initial_metadata_wanted = false; bool send_initial_metadata_wanted = false;
bool finish_wanted = false; bool finish_wanted = false;
grpc::Status status_wanted; ::grpc::Status status_wanted;
}; };
PreBindBacklog backlog_ ABSL_GUARDED_BY(call_mu_); PreBindBacklog backlog_ ABSL_GUARDED_BY(call_mu_);
}; };
@ -769,7 +769,7 @@ namespace internal {
template <class Base> template <class Base>
class FinishOnlyReactor : public Base { class FinishOnlyReactor : public Base {
public: public:
explicit FinishOnlyReactor(grpc::Status s) { this->Finish(std::move(s)); } explicit FinishOnlyReactor(::grpc::Status s) { this->Finish(std::move(s)); }
void OnDone() override { this->~FinishOnlyReactor(); } void OnDone() override { this->~FinishOnlyReactor(); }
}; };

View File

@ -30,10 +30,10 @@ namespace grpc {
namespace internal { namespace internal {
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
class CallbackUnaryHandler : public grpc::internal::MethodHandler { class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
public: public:
explicit CallbackUnaryHandler( explicit CallbackUnaryHandler(
std::function<ServerUnaryReactor*(grpc::CallbackServerContext*, std::function<ServerUnaryReactor*(::grpc::CallbackServerContext*,
const RequestType*, ResponseType*)> const RequestType*, ResponseType*)>
get_reactor) get_reactor)
: get_reactor_(std::move(get_reactor)) {} : get_reactor_(std::move(get_reactor)) {}
@ -45,12 +45,12 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
// Arena allocate a controller structure (that includes request/response) // Arena allocate a controller structure (that includes request/response)
grpc::g_core_codegen_interface->grpc_call_ref(param.call->call()); ::grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
auto* allocator_state = auto* allocator_state =
static_cast<MessageHolder<RequestType, ResponseType>*>( static_cast<MessageHolder<RequestType, ResponseType>*>(
param.internal_data); param.internal_data);
auto* call = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( auto* call = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackUnaryImpl))) param.call->call(), sizeof(ServerCallbackUnaryImpl)))
ServerCallbackUnaryImpl( ServerCallbackUnaryImpl(
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
@ -60,7 +60,7 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
ServerUnaryReactor* reactor = nullptr; ServerUnaryReactor* reactor = nullptr;
if (param.status.ok()) { if (param.status.ok()) {
reactor = grpc::internal::CatchingReactorGetter<ServerUnaryReactor>( reactor = ::grpc::internal::CatchingReactorGetter<ServerUnaryReactor>(
get_reactor_, get_reactor_,
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
call->request(), call->response()); call->request(), call->response());
@ -68,10 +68,10 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
if (reactor == nullptr) { if (reactor == nullptr) {
// if deserialization or reactor creator failed, we need to fail the call // if deserialization or reactor creator failed, we need to fail the call
reactor = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( reactor = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(UnimplementedUnaryReactor))) param.call->call(), sizeof(UnimplementedUnaryReactor)))
UnimplementedUnaryReactor( UnimplementedUnaryReactor(
grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "")); ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""));
} }
/// Invoke SetupReactor as the last part of the handler /// Invoke SetupReactor as the last part of the handler
@ -79,8 +79,8 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
} }
void* Deserialize(grpc_call* call, grpc_byte_buffer* req, void* Deserialize(grpc_call* call, grpc_byte_buffer* req,
grpc::Status* status, void** handler_data) final { ::grpc::Status* status, void** handler_data) final {
grpc::ByteBuffer buf; ::grpc::ByteBuffer buf;
buf.set_buffer(req); buf.set_buffer(req);
RequestType* request = nullptr; RequestType* request = nullptr;
MessageHolder<RequestType, ResponseType>* allocator_state; MessageHolder<RequestType, ResponseType>* allocator_state;
@ -88,14 +88,14 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
allocator_state = allocator_->AllocateMessages(); allocator_state = allocator_->AllocateMessages();
} else { } else {
allocator_state = allocator_state =
new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call, sizeof(DefaultMessageHolder<RequestType, ResponseType>))) call, sizeof(DefaultMessageHolder<RequestType, ResponseType>)))
DefaultMessageHolder<RequestType, ResponseType>(); DefaultMessageHolder<RequestType, ResponseType>();
} }
*handler_data = allocator_state; *handler_data = allocator_state;
request = allocator_state->request(); request = allocator_state->request();
*status = *status =
grpc::SerializationTraits<RequestType>::Deserialize(&buf, request); ::grpc::SerializationTraits<RequestType>::Deserialize(&buf, request);
buf.Release(); buf.Release();
if (status->ok()) { if (status->ok()) {
return request; return request;
@ -104,14 +104,14 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
} }
private: private:
std::function<ServerUnaryReactor*(grpc::CallbackServerContext*, std::function<ServerUnaryReactor*(::grpc::CallbackServerContext*,
const RequestType*, ResponseType*)> const RequestType*, ResponseType*)>
get_reactor_; get_reactor_;
MessageAllocator<RequestType, ResponseType>* allocator_ = nullptr; MessageAllocator<RequestType, ResponseType>* allocator_ = nullptr;
class ServerCallbackUnaryImpl : public ServerCallbackUnary { class ServerCallbackUnaryImpl : public ServerCallbackUnary {
public: public:
void Finish(grpc::Status s) override { void Finish(::grpc::Status s) override {
// A callback that only contains a call to MaybeDone can be run as an // A callback that only contains a call to MaybeDone can be run as an
// inline callback regardless of whether or not OnDone is inlineable // inline callback regardless of whether or not OnDone is inlineable
// because if the actual OnDone callback needs to be scheduled, MaybeDone // because if the actual OnDone callback needs to be scheduled, MaybeDone
@ -177,7 +177,7 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
friend class CallbackUnaryHandler<RequestType, ResponseType>; friend class CallbackUnaryHandler<RequestType, ResponseType>;
ServerCallbackUnaryImpl( ServerCallbackUnaryImpl(
grpc::CallbackServerContext* ctx, grpc::internal::Call* call, ::grpc::CallbackServerContext* ctx, ::grpc::internal::Call* call,
MessageHolder<RequestType, ResponseType>* allocator_state, MessageHolder<RequestType, ResponseType>* allocator_state,
std::function<void()> call_requester) std::function<void()> call_requester)
: ctx_(ctx), : ctx_(ctx),
@ -210,7 +210,7 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
ctx_->context_allocator()->Release(ctx_); ctx_->context_allocator()->Release(ctx_);
} }
this->~ServerCallbackUnaryImpl(); // explicitly call destructor this->~ServerCallbackUnaryImpl(); // explicitly call destructor
grpc::g_core_codegen_interface->grpc_call_unref(call); ::grpc::g_core_codegen_interface->grpc_call_unref(call);
call_requester(); call_requester();
} }
@ -218,17 +218,17 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
return reactor_.load(std::memory_order_relaxed); return reactor_.load(std::memory_order_relaxed);
} }
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallbackWithSuccessTag meta_tag_; ::grpc::internal::CallbackWithSuccessTag meta_tag_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
finish_ops_; finish_ops_;
grpc::internal::CallbackWithSuccessTag finish_tag_; ::grpc::internal::CallbackWithSuccessTag finish_tag_;
grpc::CallbackServerContext* const ctx_; ::grpc::CallbackServerContext* const ctx_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
MessageHolder<RequestType, ResponseType>* const allocator_state_; MessageHolder<RequestType, ResponseType>* const allocator_state_;
std::function<void()> call_requester_; std::function<void()> call_requester_;
// reactor_ can always be loaded/stored with relaxed memory ordering because // reactor_ can always be loaded/stored with relaxed memory ordering because
@ -249,18 +249,18 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
}; };
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
class CallbackClientStreamingHandler : public grpc::internal::MethodHandler { class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler {
public: public:
explicit CallbackClientStreamingHandler( explicit CallbackClientStreamingHandler(
std::function<ServerReadReactor<RequestType>*( std::function<ServerReadReactor<RequestType>*(
grpc::CallbackServerContext*, ResponseType*)> ::grpc::CallbackServerContext*, ResponseType*)>
get_reactor) get_reactor)
: get_reactor_(std::move(get_reactor)) {} : get_reactor_(std::move(get_reactor)) {}
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
// Arena allocate a reader structure (that includes response) // Arena allocate a reader structure (that includes response)
grpc::g_core_codegen_interface->grpc_call_ref(param.call->call()); ::grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
auto* reader = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( auto* reader = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackReaderImpl))) param.call->call(), sizeof(ServerCallbackReaderImpl)))
ServerCallbackReaderImpl( ServerCallbackReaderImpl(
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
@ -275,32 +275,32 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
ServerReadReactor<RequestType>* reactor = nullptr; ServerReadReactor<RequestType>* reactor = nullptr;
if (param.status.ok()) { if (param.status.ok()) {
reactor = reactor = ::grpc::internal::CatchingReactorGetter<
grpc::internal::CatchingReactorGetter<ServerReadReactor<RequestType>>( ServerReadReactor<RequestType>>(
get_reactor_, get_reactor_,
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
reader->response()); reader->response());
} }
if (reactor == nullptr) { if (reactor == nullptr) {
// if deserialization or reactor creator failed, we need to fail the call // if deserialization or reactor creator failed, we need to fail the call
reactor = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( reactor = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(UnimplementedReadReactor<RequestType>))) param.call->call(), sizeof(UnimplementedReadReactor<RequestType>)))
UnimplementedReadReactor<RequestType>( UnimplementedReadReactor<RequestType>(
grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "")); ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""));
} }
reader->SetupReactor(reactor); reader->SetupReactor(reactor);
} }
private: private:
std::function<ServerReadReactor<RequestType>*(grpc::CallbackServerContext*, std::function<ServerReadReactor<RequestType>*(::grpc::CallbackServerContext*,
ResponseType*)> ResponseType*)>
get_reactor_; get_reactor_;
class ServerCallbackReaderImpl : public ServerCallbackReader<RequestType> { class ServerCallbackReaderImpl : public ServerCallbackReader<RequestType> {
public: public:
void Finish(grpc::Status s) override { void Finish(::grpc::Status s) override {
// A finish tag with only MaybeDone can have its callback inlined // A finish tag with only MaybeDone can have its callback inlined
// regardless even if OnDone is not inlineable because this callback just // regardless even if OnDone is not inlineable because this callback just
// checks a ref and then decides whether or not to dispatch OnDone. // checks a ref and then decides whether or not to dispatch OnDone.
@ -366,8 +366,8 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
private: private:
friend class CallbackClientStreamingHandler<RequestType, ResponseType>; friend class CallbackClientStreamingHandler<RequestType, ResponseType>;
ServerCallbackReaderImpl(grpc::CallbackServerContext* ctx, ServerCallbackReaderImpl(::grpc::CallbackServerContext* ctx,
grpc::internal::Call* call, ::grpc::internal::Call* call,
std::function<void()> call_requester) std::function<void()> call_requester)
: ctx_(ctx), call_(*call), call_requester_(std::move(call_requester)) {} : ctx_(ctx), call_(*call), call_requester_(std::move(call_requester)) {}
@ -407,7 +407,7 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
ctx_->context_allocator()->Release(ctx_); ctx_->context_allocator()->Release(ctx_);
} }
this->~ServerCallbackReaderImpl(); // explicitly call destructor this->~ServerCallbackReaderImpl(); // explicitly call destructor
grpc::g_core_codegen_interface->grpc_call_unref(call); ::grpc::g_core_codegen_interface->grpc_call_unref(call);
call_requester(); call_requester();
} }
@ -415,20 +415,21 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
return reactor_.load(std::memory_order_relaxed); return reactor_.load(std::memory_order_relaxed);
} }
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallbackWithSuccessTag meta_tag_; ::grpc::internal::CallbackWithSuccessTag meta_tag_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
finish_ops_; finish_ops_;
grpc::internal::CallbackWithSuccessTag finish_tag_; ::grpc::internal::CallbackWithSuccessTag finish_tag_;
grpc::internal::CallOpSet<grpc::internal::CallOpRecvMessage<RequestType>> ::grpc::internal::CallOpSet<
::grpc::internal::CallOpRecvMessage<RequestType>>
read_ops_; read_ops_;
grpc::internal::CallbackWithSuccessTag read_tag_; ::grpc::internal::CallbackWithSuccessTag read_tag_;
grpc::CallbackServerContext* const ctx_; ::grpc::CallbackServerContext* const ctx_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
ResponseType resp_; ResponseType resp_;
std::function<void()> call_requester_; std::function<void()> call_requester_;
// The memory ordering of reactor_ follows ServerCallbackUnaryImpl. // The memory ordering of reactor_ follows ServerCallbackUnaryImpl.
@ -440,18 +441,18 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
}; };
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { class CallbackServerStreamingHandler : public ::grpc::internal::MethodHandler {
public: public:
explicit CallbackServerStreamingHandler( explicit CallbackServerStreamingHandler(
std::function<ServerWriteReactor<ResponseType>*( std::function<ServerWriteReactor<ResponseType>*(
grpc::CallbackServerContext*, const RequestType*)> ::grpc::CallbackServerContext*, const RequestType*)>
get_reactor) get_reactor)
: get_reactor_(std::move(get_reactor)) {} : get_reactor_(std::move(get_reactor)) {}
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
// Arena allocate a writer structure // Arena allocate a writer structure
grpc::g_core_codegen_interface->grpc_call_ref(param.call->call()); ::grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
auto* writer = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( auto* writer = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackWriterImpl))) param.call->call(), sizeof(ServerCallbackWriterImpl)))
ServerCallbackWriterImpl( ServerCallbackWriterImpl(
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
@ -467,7 +468,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
ServerWriteReactor<ResponseType>* reactor = nullptr; ServerWriteReactor<ResponseType>* reactor = nullptr;
if (param.status.ok()) { if (param.status.ok()) {
reactor = grpc::internal::CatchingReactorGetter< reactor = ::grpc::internal::CatchingReactorGetter<
ServerWriteReactor<ResponseType>>( ServerWriteReactor<ResponseType>>(
get_reactor_, get_reactor_,
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
@ -475,23 +476,24 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
} }
if (reactor == nullptr) { if (reactor == nullptr) {
// if deserialization or reactor creator failed, we need to fail the call // if deserialization or reactor creator failed, we need to fail the call
reactor = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( reactor = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(UnimplementedWriteReactor<ResponseType>))) param.call->call(), sizeof(UnimplementedWriteReactor<ResponseType>)))
UnimplementedWriteReactor<ResponseType>( UnimplementedWriteReactor<ResponseType>(
grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "")); ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""));
} }
writer->SetupReactor(reactor); writer->SetupReactor(reactor);
} }
void* Deserialize(grpc_call* call, grpc_byte_buffer* req, void* Deserialize(grpc_call* call, grpc_byte_buffer* req,
grpc::Status* status, void** /*handler_data*/) final { ::grpc::Status* status, void** /*handler_data*/) final {
grpc::ByteBuffer buf; ::grpc::ByteBuffer buf;
buf.set_buffer(req); buf.set_buffer(req);
auto* request = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( auto* request =
call, sizeof(RequestType))) RequestType(); new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call, sizeof(RequestType))) RequestType();
*status = *status =
grpc::SerializationTraits<RequestType>::Deserialize(&buf, request); ::grpc::SerializationTraits<RequestType>::Deserialize(&buf, request);
buf.Release(); buf.Release();
if (status->ok()) { if (status->ok()) {
return request; return request;
@ -501,13 +503,13 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
} }
private: private:
std::function<ServerWriteReactor<ResponseType>*(grpc::CallbackServerContext*, std::function<ServerWriteReactor<ResponseType>*(
const RequestType*)> ::grpc::CallbackServerContext*, const RequestType*)>
get_reactor_; get_reactor_;
class ServerCallbackWriterImpl : public ServerCallbackWriter<ResponseType> { class ServerCallbackWriterImpl : public ServerCallbackWriter<ResponseType> {
public: public:
void Finish(grpc::Status s) override { void Finish(::grpc::Status s) override {
// A finish tag with only MaybeDone can have its callback inlined // A finish tag with only MaybeDone can have its callback inlined
// regardless even if OnDone is not inlineable because this callback just // regardless even if OnDone is not inlineable because this callback just
// checks a ref and then decides whether or not to dispatch OnDone. // checks a ref and then decides whether or not to dispatch OnDone.
@ -559,7 +561,8 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
call_.PerformOps(&meta_ops_); call_.PerformOps(&meta_ops_);
} }
void Write(const ResponseType* resp, grpc::WriteOptions options) override { void Write(const ResponseType* resp,
::grpc::WriteOptions options) override {
this->Ref(); this->Ref();
if (options.is_last_message()) { if (options.is_last_message()) {
options.set_buffer_hint(); options.set_buffer_hint();
@ -577,8 +580,8 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void WriteAndFinish(const ResponseType* resp, grpc::WriteOptions options, void WriteAndFinish(const ResponseType* resp, ::grpc::WriteOptions options,
grpc::Status s) override { ::grpc::Status s) override {
// This combines the write into the finish callback // This combines the write into the finish callback
// TODO(vjpai): don't assert // TODO(vjpai): don't assert
GPR_CODEGEN_ASSERT(finish_ops_.SendMessagePtr(resp, options).ok()); GPR_CODEGEN_ASSERT(finish_ops_.SendMessagePtr(resp, options).ok());
@ -588,8 +591,9 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
private: private:
friend class CallbackServerStreamingHandler<RequestType, ResponseType>; friend class CallbackServerStreamingHandler<RequestType, ResponseType>;
ServerCallbackWriterImpl(grpc::CallbackServerContext* ctx, ServerCallbackWriterImpl(::grpc::CallbackServerContext* ctx,
grpc::internal::Call* call, const RequestType* req, ::grpc::internal::Call* call,
const RequestType* req,
std::function<void()> call_requester) std::function<void()> call_requester)
: ctx_(ctx), : ctx_(ctx),
call_(*call), call_(*call),
@ -632,7 +636,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
ctx_->context_allocator()->Release(ctx_); ctx_->context_allocator()->Release(ctx_);
} }
this->~ServerCallbackWriterImpl(); // explicitly call destructor this->~ServerCallbackWriterImpl(); // explicitly call destructor
grpc::g_core_codegen_interface->grpc_call_unref(call); ::grpc::g_core_codegen_interface->grpc_call_unref(call);
call_requester(); call_requester();
} }
@ -640,21 +644,21 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
return reactor_.load(std::memory_order_relaxed); return reactor_.load(std::memory_order_relaxed);
} }
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallbackWithSuccessTag meta_tag_; ::grpc::internal::CallbackWithSuccessTag meta_tag_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
finish_ops_; finish_ops_;
grpc::internal::CallbackWithSuccessTag finish_tag_; ::grpc::internal::CallbackWithSuccessTag finish_tag_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage> ::grpc::internal::CallOpSendMessage>
write_ops_; write_ops_;
grpc::internal::CallbackWithSuccessTag write_tag_; ::grpc::internal::CallbackWithSuccessTag write_tag_;
grpc::CallbackServerContext* const ctx_; ::grpc::CallbackServerContext* const ctx_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
const RequestType* req_; const RequestType* req_;
std::function<void()> call_requester_; std::function<void()> call_requester_;
// The memory ordering of reactor_ follows ServerCallbackUnaryImpl. // The memory ordering of reactor_ follows ServerCallbackUnaryImpl.
@ -666,17 +670,17 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
}; };
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
class CallbackBidiHandler : public grpc::internal::MethodHandler { class CallbackBidiHandler : public ::grpc::internal::MethodHandler {
public: public:
explicit CallbackBidiHandler( explicit CallbackBidiHandler(
std::function<ServerBidiReactor<RequestType, ResponseType>*( std::function<ServerBidiReactor<RequestType, ResponseType>*(
grpc::CallbackServerContext*)> ::grpc::CallbackServerContext*)>
get_reactor) get_reactor)
: get_reactor_(std::move(get_reactor)) {} : get_reactor_(std::move(get_reactor)) {}
void RunHandler(const HandlerParameter& param) final { void RunHandler(const HandlerParameter& param) final {
grpc::g_core_codegen_interface->grpc_call_ref(param.call->call()); ::grpc::g_core_codegen_interface->grpc_call_ref(param.call->call());
auto* stream = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( auto* stream = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackReaderWriterImpl))) param.call->call(), sizeof(ServerCallbackReaderWriterImpl)))
ServerCallbackReaderWriterImpl( ServerCallbackReaderWriterImpl(
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
@ -691,7 +695,7 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
ServerBidiReactor<RequestType, ResponseType>* reactor = nullptr; ServerBidiReactor<RequestType, ResponseType>* reactor = nullptr;
if (param.status.ok()) { if (param.status.ok()) {
reactor = grpc::internal::CatchingReactorGetter< reactor = ::grpc::internal::CatchingReactorGetter<
ServerBidiReactor<RequestType, ResponseType>>( ServerBidiReactor<RequestType, ResponseType>>(
get_reactor_, get_reactor_,
static_cast<::grpc::CallbackServerContext*>(param.server_context)); static_cast<::grpc::CallbackServerContext*>(param.server_context));
@ -699,11 +703,11 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
if (reactor == nullptr) { if (reactor == nullptr) {
// if deserialization or reactor creator failed, we need to fail the call // if deserialization or reactor creator failed, we need to fail the call
reactor = new (grpc::g_core_codegen_interface->grpc_call_arena_alloc( reactor = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), param.call->call(),
sizeof(UnimplementedBidiReactor<RequestType, ResponseType>))) sizeof(UnimplementedBidiReactor<RequestType, ResponseType>)))
UnimplementedBidiReactor<RequestType, ResponseType>( UnimplementedBidiReactor<RequestType, ResponseType>(
grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "")); ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""));
} }
stream->SetupReactor(reactor); stream->SetupReactor(reactor);
@ -711,13 +715,13 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
private: private:
std::function<ServerBidiReactor<RequestType, ResponseType>*( std::function<ServerBidiReactor<RequestType, ResponseType>*(
grpc::CallbackServerContext*)> ::grpc::CallbackServerContext*)>
get_reactor_; get_reactor_;
class ServerCallbackReaderWriterImpl class ServerCallbackReaderWriterImpl
: public ServerCallbackReaderWriter<RequestType, ResponseType> { : public ServerCallbackReaderWriter<RequestType, ResponseType> {
public: public:
void Finish(grpc::Status s) override { void Finish(::grpc::Status s) override {
// A finish tag with only MaybeDone can have its callback inlined // A finish tag with only MaybeDone can have its callback inlined
// regardless even if OnDone is not inlineable because this callback just // regardless even if OnDone is not inlineable because this callback just
// checks a ref and then decides whether or not to dispatch OnDone. // checks a ref and then decides whether or not to dispatch OnDone.
@ -769,7 +773,8 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
call_.PerformOps(&meta_ops_); call_.PerformOps(&meta_ops_);
} }
void Write(const ResponseType* resp, grpc::WriteOptions options) override { void Write(const ResponseType* resp,
::grpc::WriteOptions options) override {
this->Ref(); this->Ref();
if (options.is_last_message()) { if (options.is_last_message()) {
options.set_buffer_hint(); options.set_buffer_hint();
@ -787,8 +792,8 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void WriteAndFinish(const ResponseType* resp, grpc::WriteOptions options, void WriteAndFinish(const ResponseType* resp, ::grpc::WriteOptions options,
grpc::Status s) override { ::grpc::Status s) override {
// TODO(vjpai): don't assert // TODO(vjpai): don't assert
GPR_CODEGEN_ASSERT(finish_ops_.SendMessagePtr(resp, options).ok()); GPR_CODEGEN_ASSERT(finish_ops_.SendMessagePtr(resp, options).ok());
Finish(std::move(s)); Finish(std::move(s));
@ -803,8 +808,8 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
private: private:
friend class CallbackBidiHandler<RequestType, ResponseType>; friend class CallbackBidiHandler<RequestType, ResponseType>;
ServerCallbackReaderWriterImpl(grpc::CallbackServerContext* ctx, ServerCallbackReaderWriterImpl(::grpc::CallbackServerContext* ctx,
grpc::internal::Call* call, ::grpc::internal::Call* call,
std::function<void()> call_requester) std::function<void()> call_requester)
: ctx_(ctx), call_(*call), call_requester_(std::move(call_requester)) {} : ctx_(ctx), call_(*call), call_requester_(std::move(call_requester)) {}
@ -848,7 +853,7 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
ctx_->context_allocator()->Release(ctx_); ctx_->context_allocator()->Release(ctx_);
} }
this->~ServerCallbackReaderWriterImpl(); // explicitly call destructor this->~ServerCallbackReaderWriterImpl(); // explicitly call destructor
grpc::g_core_codegen_interface->grpc_call_unref(call); ::grpc::g_core_codegen_interface->grpc_call_unref(call);
call_requester(); call_requester();
} }
@ -856,24 +861,25 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
return reactor_.load(std::memory_order_relaxed); return reactor_.load(std::memory_order_relaxed);
} }
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
meta_ops_; meta_ops_;
grpc::internal::CallbackWithSuccessTag meta_tag_; ::grpc::internal::CallbackWithSuccessTag meta_tag_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus> ::grpc::internal::CallOpServerSendStatus>
finish_ops_; finish_ops_;
grpc::internal::CallbackWithSuccessTag finish_tag_; ::grpc::internal::CallbackWithSuccessTag finish_tag_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage> ::grpc::internal::CallOpSendMessage>
write_ops_; write_ops_;
grpc::internal::CallbackWithSuccessTag write_tag_; ::grpc::internal::CallbackWithSuccessTag write_tag_;
grpc::internal::CallOpSet<grpc::internal::CallOpRecvMessage<RequestType>> ::grpc::internal::CallOpSet<
::grpc::internal::CallOpRecvMessage<RequestType>>
read_ops_; read_ops_;
grpc::internal::CallbackWithSuccessTag read_tag_; ::grpc::internal::CallbackWithSuccessTag read_tag_;
grpc::CallbackServerContext* const ctx_; ::grpc::CallbackServerContext* const ctx_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
std::function<void()> call_requester_; std::function<void()> call_requester_;
// The memory ordering of reactor_ follows ServerCallbackUnaryImpl. // The memory ordering of reactor_ follows ServerCallbackUnaryImpl.
std::atomic<ServerBidiReactor<RequestType, ResponseType>*> reactor_; std::atomic<ServerBidiReactor<RequestType, ResponseType>*> reactor_;

View File

@ -124,7 +124,7 @@ class ServerContextBase {
/// Return the deadline for the server call. /// Return the deadline for the server call.
std::chrono::system_clock::time_point deadline() const { std::chrono::system_clock::time_point deadline() const {
return grpc::Timespec2Timepoint(deadline_); return ::grpc::Timespec2Timepoint(deadline_);
} }
/// Return a \a gpr_timespec representation of the server call's deadline. /// Return a \a gpr_timespec representation of the server call's deadline.
@ -263,9 +263,9 @@ class ServerContextBase {
/// Return the authentication context for this server call. /// Return the authentication context for this server call.
/// ///
/// \see grpc::AuthContext. /// \see grpc::AuthContext.
std::shared_ptr<const grpc::AuthContext> auth_context() const { std::shared_ptr<const ::grpc::AuthContext> auth_context() const {
if (auth_context_ == nullptr) { if (auth_context_ == nullptr) {
auth_context_ = grpc::CreateAuthContext(call_.call); auth_context_ = ::grpc::CreateAuthContext(call_.call);
} }
return auth_context_; return auth_context_;
} }
@ -313,7 +313,7 @@ class ServerContextBase {
/// ///
/// This method should not be called more than once or called after return /// This method should not be called more than once or called after return
/// from the method handler. /// from the method handler.
grpc::ServerUnaryReactor* DefaultReactor() { ::grpc::ServerUnaryReactor* DefaultReactor() {
// Short-circuit the case where a default reactor was already set up by // Short-circuit the case where a default reactor was already set up by
// the TestPeer. // the TestPeer.
if (test_unary_ != nullptr) { if (test_unary_ != nullptr) {
@ -341,53 +341,53 @@ class ServerContextBase {
ContextAllocator* context_allocator() const { return context_allocator_; } ContextAllocator* context_allocator() const { return context_allocator_; }
private: private:
friend class grpc::testing::InteropServerContextInspector; friend class ::grpc::testing::InteropServerContextInspector;
friend class grpc::testing::ServerContextTestSpouse; friend class ::grpc::testing::ServerContextTestSpouse;
friend class grpc::testing::DefaultReactorTestPeer; friend class ::grpc::testing::DefaultReactorTestPeer;
friend class grpc::ServerInterface; friend class ::grpc::ServerInterface;
friend class grpc::Server; friend class ::grpc::Server;
template <class W, class R> template <class W, class R>
friend class grpc::ServerAsyncReader; friend class ::grpc::ServerAsyncReader;
template <class W> template <class W>
friend class grpc::ServerAsyncWriter; friend class ::grpc::ServerAsyncWriter;
template <class W> template <class W>
friend class grpc::ServerAsyncResponseWriter; friend class ::grpc::ServerAsyncResponseWriter;
template <class W, class R> template <class W, class R>
friend class grpc::ServerAsyncReaderWriter; friend class ::grpc::ServerAsyncReaderWriter;
template <class R> template <class R>
friend class grpc::ServerReader; friend class ::grpc::ServerReader;
template <class W> template <class W>
friend class grpc::ServerWriter; friend class ::grpc::ServerWriter;
template <class W, class R> template <class W, class R>
friend class grpc::internal::ServerReaderWriterBody; friend class ::grpc::internal::ServerReaderWriterBody;
template <class ResponseType> template <class ResponseType>
friend void grpc::internal::UnaryRunHandlerHelper( friend void ::grpc::internal::UnaryRunHandlerHelper(
const internal::MethodHandler::HandlerParameter& param, ResponseType* rsp, const internal::MethodHandler::HandlerParameter& param, ResponseType* rsp,
Status& status); Status& status);
template <class ServiceType, class RequestType, class ResponseType, template <class ServiceType, class RequestType, class ResponseType,
class BaseRequestType, class BaseResponseType> class BaseRequestType, class BaseResponseType>
friend class grpc::internal::RpcMethodHandler; friend class ::grpc::internal::RpcMethodHandler;
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
friend class grpc::internal::ClientStreamingHandler; friend class ::grpc::internal::ClientStreamingHandler;
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
friend class grpc::internal::ServerStreamingHandler; friend class ::grpc::internal::ServerStreamingHandler;
template <class Streamer, bool WriteNeeded> template <class Streamer, bool WriteNeeded>
friend class grpc::internal::TemplatedBidiStreamingHandler; friend class ::grpc::internal::TemplatedBidiStreamingHandler;
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
friend class grpc::internal::CallbackUnaryHandler; friend class ::grpc::internal::CallbackUnaryHandler;
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
friend class grpc::internal::CallbackClientStreamingHandler; friend class ::grpc::internal::CallbackClientStreamingHandler;
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
friend class grpc::internal::CallbackServerStreamingHandler; friend class ::grpc::internal::CallbackServerStreamingHandler;
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
friend class grpc::internal::CallbackBidiHandler; friend class ::grpc::internal::CallbackBidiHandler;
template <::grpc::StatusCode code> template <::grpc::StatusCode code>
friend class grpc::internal::ErrorMethodHandler; friend class ::grpc::internal::ErrorMethodHandler;
template <class Base> template <class Base>
friend class grpc::internal::FinishOnlyReactor; friend class ::grpc::internal::FinishOnlyReactor;
friend class grpc::ClientContext; friend class ::grpc::ClientContext;
friend class grpc::GenericServerContext; friend class ::grpc::GenericServerContext;
friend class grpc::GenericCallbackServerContext; friend class ::grpc::GenericCallbackServerContext;
/// Prevent copying. /// Prevent copying.
ServerContextBase(const ServerContextBase&); ServerContextBase(const ServerContextBase&);
@ -396,10 +396,10 @@ class ServerContextBase {
class CompletionOp; class CompletionOp;
void BeginCompletionOp( void BeginCompletionOp(
grpc::internal::Call* call, std::function<void(bool)> callback, ::grpc::internal::Call* call, std::function<void(bool)> callback,
grpc::internal::ServerCallbackCall* callback_controller); ::grpc::internal::ServerCallbackCall* callback_controller);
/// Return the tag queued by BeginCompletionOp() /// Return the tag queued by BeginCompletionOp()
grpc::internal::CompletionQueueTag* GetCompletionOpTag(); ::grpc::internal::CompletionQueueTag* GetCompletionOpTag();
void set_call(grpc_call* call) { call_.call = call; } void set_call(grpc_call* call) { call_.call = call; }
@ -407,12 +407,12 @@ class ServerContextBase {
uint32_t initial_metadata_flags() const { return 0; } uint32_t initial_metadata_flags() const { return 0; }
grpc::experimental::ServerRpcInfo* set_server_rpc_info( ::grpc::experimental::ServerRpcInfo* set_server_rpc_info(
const char* method, grpc::internal::RpcMethod::RpcType type, const char* method, ::grpc::internal::RpcMethod::RpcType type,
const std::vector<std::unique_ptr< const std::vector<std::unique_ptr<
grpc::experimental::ServerInterceptorFactoryInterface>>& creators) { ::grpc::experimental::ServerInterceptorFactoryInterface>>& creators) {
if (!creators.empty()) { if (!creators.empty()) {
rpc_info_ = new grpc::experimental::ServerRpcInfo(this, method, type); rpc_info_ = new ::grpc::experimental::ServerRpcInfo(this, method, type);
rpc_info_->RegisterInterceptors(creators); rpc_info_->RegisterInterceptors(creators);
} }
return rpc_info_; return rpc_info_;
@ -444,13 +444,13 @@ class ServerContextBase {
CompletionOp* completion_op_ = nullptr; CompletionOp* completion_op_ = nullptr;
bool has_notify_when_done_tag_ = false; bool has_notify_when_done_tag_ = false;
void* async_notify_when_done_tag_ = nullptr; void* async_notify_when_done_tag_ = nullptr;
grpc::internal::CallbackWithSuccessTag completion_tag_; ::grpc::internal::CallbackWithSuccessTag completion_tag_;
gpr_timespec deadline_; gpr_timespec deadline_;
grpc::CompletionQueue* cq_ = nullptr; ::grpc::CompletionQueue* cq_ = nullptr;
bool sent_initial_metadata_ = false; bool sent_initial_metadata_ = false;
mutable std::shared_ptr<const grpc::AuthContext> auth_context_; mutable std::shared_ptr<const ::grpc::AuthContext> auth_context_;
mutable grpc::internal::MetadataMap client_metadata_; mutable ::grpc::internal::MetadataMap client_metadata_;
std::multimap<std::string, std::string> initial_metadata_; std::multimap<std::string, std::string> initial_metadata_;
std::multimap<std::string, std::string> trailing_metadata_; std::multimap<std::string, std::string> trailing_metadata_;
@ -458,16 +458,16 @@ class ServerContextBase {
grpc_compression_level compression_level_; grpc_compression_level compression_level_;
grpc_compression_algorithm compression_algorithm_; grpc_compression_algorithm compression_algorithm_;
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage> ::grpc::internal::CallOpSendMessage>
pending_ops_; pending_ops_;
bool has_pending_ops_ = false; bool has_pending_ops_ = false;
grpc::experimental::ServerRpcInfo* rpc_info_ = nullptr; ::grpc::experimental::ServerRpcInfo* rpc_info_ = nullptr;
RpcAllocatorState* message_allocator_state_ = nullptr; RpcAllocatorState* message_allocator_state_ = nullptr;
ContextAllocator* context_allocator_ = nullptr; ContextAllocator* context_allocator_ = nullptr;
class Reactor : public grpc::ServerUnaryReactor { class Reactor : public ::grpc::ServerUnaryReactor {
public: public:
void OnCancel() override {} void OnCancel() override {}
void OnDone() override {} void OnDone() override {}
@ -478,23 +478,23 @@ class ServerContextBase {
bool InternalInlineable() override { return true; } bool InternalInlineable() override { return true; }
}; };
void SetupTestDefaultReactor(std::function<void(grpc::Status)> func) { void SetupTestDefaultReactor(std::function<void(::grpc::Status)> func) {
// NOLINTNEXTLINE(modernize-make-unique) // NOLINTNEXTLINE(modernize-make-unique)
test_unary_.reset(new TestServerCallbackUnary(this, std::move(func))); test_unary_.reset(new TestServerCallbackUnary(this, std::move(func)));
} }
bool test_status_set() const { bool test_status_set() const {
return (test_unary_ != nullptr) && test_unary_->status_set(); return (test_unary_ != nullptr) && test_unary_->status_set();
} }
grpc::Status test_status() const { return test_unary_->status(); } ::grpc::Status test_status() const { return test_unary_->status(); }
class TestServerCallbackUnary : public grpc::ServerCallbackUnary { class TestServerCallbackUnary : public ::grpc::ServerCallbackUnary {
public: public:
TestServerCallbackUnary(ServerContextBase* ctx, TestServerCallbackUnary(ServerContextBase* ctx,
std::function<void(grpc::Status)> func) std::function<void(::grpc::Status)> func)
: reactor_(ctx->DefaultReactor()), func_(std::move(func)) { : reactor_(ctx->DefaultReactor()), func_(std::move(func)) {
this->BindReactor(reactor_); this->BindReactor(reactor_);
} }
void Finish(grpc::Status s) override { void Finish(::grpc::Status s) override {
status_ = s; status_ = s;
func_(std::move(s)); func_(std::move(s));
status_set_.store(true, std::memory_order_release); status_set_.store(true, std::memory_order_release);
@ -504,16 +504,16 @@ class ServerContextBase {
bool status_set() const { bool status_set() const {
return status_set_.load(std::memory_order_acquire); return status_set_.load(std::memory_order_acquire);
} }
grpc::Status status() const { return status_; } ::grpc::Status status() const { return status_; }
private: private:
void CallOnDone() override {} void CallOnDone() override {}
grpc::internal::ServerReactor* reactor() override { return reactor_; } ::grpc::internal::ServerReactor* reactor() override { return reactor_; }
grpc::ServerUnaryReactor* const reactor_; ::grpc::ServerUnaryReactor* const reactor_;
std::atomic_bool status_set_{false}; std::atomic_bool status_set_{false};
grpc::Status status_; ::grpc::Status status_;
const std::function<void(grpc::Status s)> func_; const std::function<void(::grpc::Status s)> func_;
}; };
typename std::aligned_storage<sizeof(Reactor), alignof(Reactor)>::type typename std::aligned_storage<sizeof(Reactor), alignof(Reactor)>::type
@ -568,7 +568,7 @@ class ServerContext : public ServerContextBase {
private: private:
// Constructor for internal use by server only // Constructor for internal use by server only
friend class grpc::Server; friend class ::grpc::Server;
ServerContext(gpr_timespec deadline, grpc_metadata_array* arr) ServerContext(gpr_timespec deadline, grpc_metadata_array* arr)
: ServerContextBase(deadline, arr) {} : ServerContextBase(deadline, arr) {}
@ -643,15 +643,16 @@ class ContextAllocator {
} // namespace grpc } // namespace grpc
static_assert( static_assert(
std::is_base_of<grpc::ServerContextBase, grpc::ServerContext>::value, std::is_base_of<::grpc::ServerContextBase, ::grpc::ServerContext>::value,
"improper base class"); "improper base class");
static_assert(std::is_base_of<grpc::ServerContextBase, static_assert(std::is_base_of<::grpc::ServerContextBase,
grpc::CallbackServerContext>::value, ::grpc::CallbackServerContext>::value,
"improper base class"); "improper base class");
static_assert(sizeof(grpc::ServerContextBase) == sizeof(grpc::ServerContext), static_assert(sizeof(::grpc::ServerContextBase) ==
sizeof(::grpc::ServerContext),
"wrong size"); "wrong size");
static_assert(sizeof(grpc::ServerContextBase) == static_assert(sizeof(::grpc::ServerContextBase) ==
sizeof(grpc::CallbackServerContext), sizeof(::grpc::CallbackServerContext),
"wrong size"); "wrong size");
#endif // GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H #endif // GRPCPP_IMPL_CODEGEN_SERVER_CONTEXT_H

View File

@ -116,7 +116,7 @@ class ServerInterface : public internal::CallHook {
virtual void Wait() = 0; virtual void Wait() = 0;
protected: protected:
friend class grpc::Service; friend class ::grpc::Service;
/// Register a service. This call does not take ownership of the service. /// Register a service. This call does not take ownership of the service.
/// The service must exist for the lifetime of the Server instance. /// The service must exist for the lifetime of the Server instance.
@ -153,7 +153,7 @@ class ServerInterface : public internal::CallHook {
/// caller is required to keep all completion queues live until the server is /// caller is required to keep all completion queues live until the server is
/// destroyed. /// destroyed.
/// \param num_cqs How many completion queues does \a cqs hold. /// \param num_cqs How many completion queues does \a cqs hold.
virtual void Start(grpc::ServerCompletionQueue** cqs, size_t num_cqs) = 0; virtual void Start(::grpc::ServerCompletionQueue** cqs, size_t num_cqs) = 0;
virtual void ShutdownInternal(gpr_timespec deadline) = 0; virtual void ShutdownInternal(gpr_timespec deadline) = 0;
@ -166,10 +166,10 @@ class ServerInterface : public internal::CallHook {
class BaseAsyncRequest : public internal::CompletionQueueTag { class BaseAsyncRequest : public internal::CompletionQueueTag {
public: public:
BaseAsyncRequest(ServerInterface* server, grpc::ServerContext* context, BaseAsyncRequest(ServerInterface* server, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag, ::grpc::ServerCompletionQueue* notification_cq, void* tag,
bool delete_on_finalize); bool delete_on_finalize);
~BaseAsyncRequest() override; ~BaseAsyncRequest() override;
@ -180,10 +180,10 @@ class ServerInterface : public internal::CallHook {
protected: protected:
ServerInterface* const server_; ServerInterface* const server_;
grpc::ServerContext* const context_; ::grpc::ServerContext* const context_;
internal::ServerAsyncStreamingInterface* const stream_; internal::ServerAsyncStreamingInterface* const stream_;
grpc::CompletionQueue* const call_cq_; ::grpc::CompletionQueue* const call_cq_;
grpc::ServerCompletionQueue* const notification_cq_; ::grpc::ServerCompletionQueue* const notification_cq_;
void* const tag_; void* const tag_;
const bool delete_on_finalize_; const bool delete_on_finalize_;
grpc_call* call_; grpc_call* call_;
@ -196,10 +196,10 @@ class ServerInterface : public internal::CallHook {
class RegisteredAsyncRequest : public BaseAsyncRequest { class RegisteredAsyncRequest : public BaseAsyncRequest {
public: public:
RegisteredAsyncRequest(ServerInterface* server, RegisteredAsyncRequest(ServerInterface* server,
grpc::ServerContext* context, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, ::grpc::ServerCompletionQueue* notification_cq,
void* tag, const char* name, void* tag, const char* name,
internal::RpcMethod::RpcType type); internal::RpcMethod::RpcType type);
@ -208,7 +208,7 @@ class ServerInterface : public internal::CallHook {
if (done_intercepting_) { if (done_intercepting_) {
return BaseAsyncRequest::FinalizeResult(tag, status); return BaseAsyncRequest::FinalizeResult(tag, status);
} }
call_wrapper_ = grpc::internal::Call( call_wrapper_ = ::grpc::internal::Call(
call_, server_, call_cq_, server_->max_receive_message_size(), call_, server_, call_cq_, server_->max_receive_message_size(),
context_->set_server_rpc_info(name_, type_, context_->set_server_rpc_info(name_, type_,
*server_->interceptor_creators())); *server_->interceptor_creators()));
@ -217,7 +217,7 @@ class ServerInterface : public internal::CallHook {
protected: protected:
void IssueRequest(void* registered_method, grpc_byte_buffer** payload, void IssueRequest(void* registered_method, grpc_byte_buffer** payload,
grpc::ServerCompletionQueue* notification_cq); ::grpc::ServerCompletionQueue* notification_cq);
const char* name_; const char* name_;
const internal::RpcMethod::RpcType type_; const internal::RpcMethod::RpcType type_;
}; };
@ -225,10 +225,11 @@ class ServerInterface : public internal::CallHook {
class NoPayloadAsyncRequest final : public RegisteredAsyncRequest { class NoPayloadAsyncRequest final : public RegisteredAsyncRequest {
public: public:
NoPayloadAsyncRequest(internal::RpcServiceMethod* registered_method, NoPayloadAsyncRequest(internal::RpcServiceMethod* registered_method,
ServerInterface* server, grpc::ServerContext* context, ServerInterface* server,
::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, ::grpc::ServerCompletionQueue* notification_cq,
void* tag) void* tag)
: RegisteredAsyncRequest( : RegisteredAsyncRequest(
server, context, stream, call_cq, notification_cq, tag, server, context, stream, call_cq, notification_cq, tag,
@ -243,11 +244,11 @@ class ServerInterface : public internal::CallHook {
class PayloadAsyncRequest final : public RegisteredAsyncRequest { class PayloadAsyncRequest final : public RegisteredAsyncRequest {
public: public:
PayloadAsyncRequest(internal::RpcServiceMethod* registered_method, PayloadAsyncRequest(internal::RpcServiceMethod* registered_method,
ServerInterface* server, grpc::ServerContext* context, ServerInterface* server, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag, ::grpc::ServerCompletionQueue* notification_cq,
Message* request) void* tag, Message* request)
: RegisteredAsyncRequest( : RegisteredAsyncRequest(
server, context, stream, call_cq, notification_cq, tag, server, context, stream, call_cq, notification_cq, tag,
registered_method->name(), registered_method->method_type()), registered_method->name(), registered_method->method_type()),
@ -301,9 +302,9 @@ class ServerInterface : public internal::CallHook {
public: public:
GenericAsyncRequest(ServerInterface* server, GenericServerContext* context, GenericAsyncRequest(ServerInterface* server, GenericServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag, ::grpc::ServerCompletionQueue* notification_cq,
bool delete_on_finalize); void* tag, bool delete_on_finalize);
bool FinalizeResult(void** tag, bool* status) override; bool FinalizeResult(void** tag, bool* status) override;
@ -313,21 +314,21 @@ class ServerInterface : public internal::CallHook {
template <class Message> template <class Message>
void RequestAsyncCall(internal::RpcServiceMethod* method, void RequestAsyncCall(internal::RpcServiceMethod* method,
grpc::ServerContext* context, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag, ::grpc::ServerCompletionQueue* notification_cq,
Message* message) { void* tag, Message* message) {
GPR_CODEGEN_ASSERT(method); GPR_CODEGEN_ASSERT(method);
new PayloadAsyncRequest<Message>(method, this, context, stream, call_cq, new PayloadAsyncRequest<Message>(method, this, context, stream, call_cq,
notification_cq, tag, message); notification_cq, tag, message);
} }
void RequestAsyncCall(internal::RpcServiceMethod* method, void RequestAsyncCall(internal::RpcServiceMethod* method,
grpc::ServerContext* context, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, ::grpc::ServerCompletionQueue* notification_cq,
void* tag) { void* tag) {
GPR_CODEGEN_ASSERT(method); GPR_CODEGEN_ASSERT(method);
new NoPayloadAsyncRequest(method, this, context, stream, call_cq, new NoPayloadAsyncRequest(method, this, context, stream, call_cq,
@ -336,8 +337,8 @@ class ServerInterface : public internal::CallHook {
void RequestAsyncGenericCall(GenericServerContext* context, void RequestAsyncGenericCall(GenericServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, ::grpc::ServerCompletionQueue* notification_cq,
void* tag) { void* tag) {
new GenericAsyncRequest(this, context, stream, call_cq, notification_cq, new GenericAsyncRequest(this, context, stream, call_cq, notification_cq,
tag, true); tag, true);
@ -362,7 +363,7 @@ class ServerInterface : public internal::CallHook {
// Returns nullptr (rather than being pure) since this is a post-1.0 method // Returns nullptr (rather than being pure) since this is a post-1.0 method
// and adding a new pure method to an interface would be a breaking change // and adding a new pure method to an interface would be a breaking change
// (even though this is private and non-API) // (even though this is private and non-API)
virtual grpc::CompletionQueue* CallbackCQ() { return nullptr; } virtual ::grpc::CompletionQueue* CallbackCQ() { return nullptr; }
}; };
} // namespace grpc } // namespace grpc

View File

@ -49,7 +49,7 @@ class ServerAsyncStreamingInterface {
virtual void SendInitialMetadata(void* tag) = 0; virtual void SendInitialMetadata(void* tag) = 0;
private: private:
friend class grpc::ServerInterface; friend class ::grpc::ServerInterface;
virtual void BindCall(Call* call) = 0; virtual void BindCall(Call* call) = 0;
}; };
} // namespace internal } // namespace internal
@ -102,11 +102,11 @@ class Service {
protected: protected:
template <class Message> template <class Message>
void RequestAsyncUnary(int index, grpc::ServerContext* context, void RequestAsyncUnary(int index, ::grpc::ServerContext* context,
Message* request, Message* request,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, ::grpc::ServerCompletionQueue* notification_cq,
void* tag) { void* tag) {
// Typecast the index to size_t for indexing into a vector // Typecast the index to size_t for indexing into a vector
// while preserving the API that existed before a compiler // while preserving the API that existed before a compiler
@ -116,29 +116,29 @@ class Service {
notification_cq, tag, request); notification_cq, tag, request);
} }
void RequestAsyncClientStreaming( void RequestAsyncClientStreaming(
int index, grpc::ServerContext* context, int index, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag) { ::grpc::ServerCompletionQueue* notification_cq, void* tag) {
size_t idx = static_cast<size_t>(index); size_t idx = static_cast<size_t>(index);
server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq,
notification_cq, tag); notification_cq, tag);
} }
template <class Message> template <class Message>
void RequestAsyncServerStreaming( void RequestAsyncServerStreaming(
int index, grpc::ServerContext* context, Message* request, int index, ::grpc::ServerContext* context, Message* request,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag) { ::grpc::ServerCompletionQueue* notification_cq, void* tag) {
size_t idx = static_cast<size_t>(index); size_t idx = static_cast<size_t>(index);
server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq,
notification_cq, tag, request); notification_cq, tag, request);
} }
void RequestAsyncBidiStreaming( void RequestAsyncBidiStreaming(
int index, grpc::ServerContext* context, int index, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream, internal::ServerAsyncStreamingInterface* stream,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag) { ::grpc::ServerCompletionQueue* notification_cq, void* tag) {
size_t idx = static_cast<size_t>(index); size_t idx = static_cast<size_t>(index);
server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq, server_->RequestAsyncCall(methods_[idx].get(), context, stream, call_cq,
notification_cq, tag); notification_cq, tag);

View File

@ -61,7 +61,7 @@ class ClientStreamingInterface {
/// - \a Status contains the status code, message and details for the call /// - \a Status contains the status code, message and details for the call
/// - the \a ClientContext associated with this call is updated with /// - the \a ClientContext associated with this call is updated with
/// possible trailing metadata sent from the server. /// possible trailing metadata sent from the server.
virtual grpc::Status Finish() = 0; virtual ::grpc::Status Finish() = 0;
}; };
/// Common interface for all synchronous server side streaming. /// Common interface for all synchronous server side streaming.
@ -114,7 +114,7 @@ class WriterInterface {
/// \param options The WriteOptions affecting the write operation. /// \param options The WriteOptions affecting the write operation.
/// ///
/// \return \a true on success, \a false when the stream has been closed. /// \return \a true on success, \a false when the stream has been closed.
virtual bool Write(const W& msg, grpc::WriteOptions options) = 0; virtual bool Write(const W& msg, ::grpc::WriteOptions options) = 0;
/// Block to write \a msg to the stream with default write options. /// Block to write \a msg to the stream with default write options.
/// This is thread-safe with respect to \a ReaderInterface::Read /// This is thread-safe with respect to \a ReaderInterface::Read
@ -122,7 +122,7 @@ class WriterInterface {
/// \param msg The message to be written to the stream. /// \param msg The message to be written to the stream.
/// ///
/// \return \a true on success, \a false when the stream has been closed. /// \return \a true on success, \a false when the stream has been closed.
inline bool Write(const W& msg) { return Write(msg, grpc::WriteOptions()); } inline bool Write(const W& msg) { return Write(msg, ::grpc::WriteOptions()); }
/// Write \a msg and coalesce it with the writing of trailing metadata, using /// Write \a msg and coalesce it with the writing of trailing metadata, using
/// WriteOptions \a options. /// WriteOptions \a options.
@ -138,7 +138,7 @@ class WriterInterface {
/// ///
/// \param[in] msg The message to be written to the stream. /// \param[in] msg The message to be written to the stream.
/// \param[in] options The WriteOptions to be used to write this message. /// \param[in] options The WriteOptions to be used to write this message.
void WriteLast(const W& msg, grpc::WriteOptions options) { void WriteLast(const W& msg, ::grpc::WriteOptions options) {
Write(msg, options.set_last_message()); Write(msg, options.set_last_message());
} }
}; };
@ -162,9 +162,9 @@ template <class R>
class ClientReaderFactory { class ClientReaderFactory {
public: public:
template <class W> template <class W>
static ClientReader<R>* Create(grpc::ChannelInterface* channel, static ClientReader<R>* Create(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, ::grpc::ClientContext* context,
const W& request) { const W& request) {
return new ClientReader<R>(channel, method, context, request); return new ClientReader<R>(channel, method, context, request);
} }
@ -187,7 +187,8 @@ class ClientReader final : public ClientReaderInterface<R> {
void WaitForInitialMetadata() override { void WaitForInitialMetadata() override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata>
ops;
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
call_.PerformOps(&ops); call_.PerformOps(&ops);
cq_.Pluck(&ops); /// status ignored cq_.Pluck(&ops); /// status ignored
@ -205,8 +206,8 @@ class ClientReader final : public ClientReaderInterface<R> {
/// already received (if initial metadata is received, it can be then /// already received (if initial metadata is received, it can be then
/// accessed through the \a ClientContext associated with this call). /// accessed through the \a ClientContext associated with this call).
bool Read(R* msg) override { bool Read(R* msg) override {
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpRecvMessage<R>> ::grpc::internal::CallOpRecvMessage<R>>
ops; ops;
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
@ -221,9 +222,9 @@ class ClientReader final : public ClientReaderInterface<R> {
/// Side effect: /// Side effect:
/// The \a ClientContext associated with this call is updated with /// The \a ClientContext associated with this call is updated with
/// possible metadata received from the server. /// possible metadata received from the server.
grpc::Status Finish() override { ::grpc::Status Finish() override {
grpc::internal::CallOpSet<::grpc::internal::CallOpClientRecvStatus> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpClientRecvStatus> ops;
grpc::Status status; ::grpc::Status status;
ops.ClientRecvStatus(context_, &status); ops.ClientRecvStatus(context_, &status);
call_.PerformOps(&ops); call_.PerformOps(&ops);
GPR_CODEGEN_ASSERT(cq_.Pluck(&ops)); GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
@ -232,25 +233,25 @@ class ClientReader final : public ClientReaderInterface<R> {
private: private:
friend class internal::ClientReaderFactory<R>; friend class internal::ClientReaderFactory<R>;
grpc::ClientContext* context_; ::grpc::ClientContext* context_;
grpc::CompletionQueue cq_; ::grpc::CompletionQueue cq_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
/// Block to create a stream and write the initial metadata and \a request /// Block to create a stream and write the initial metadata and \a request
/// out. Note that \a context will be used to fill in custom initial /// out. Note that \a context will be used to fill in custom initial
/// metadata used to send to the server when starting the call. /// metadata used to send to the server when starting the call.
template <class W> template <class W>
ClientReader(grpc::ChannelInterface* channel, ClientReader(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, const W& request) ::grpc::ClientContext* context, const W& request)
: context_(context), : context_(context),
cq_(grpc_completion_queue_attributes{ cq_(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,
nullptr}), // Pluckable cq nullptr}), // Pluckable cq
call_(channel->CreateCall(method, context, &cq_)) { call_(channel->CreateCall(method, context, &cq_)) {
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpClientSendClose> ::grpc::internal::CallOpClientSendClose>
ops; ops;
ops.SendInitialMetadata(&context->send_initial_metadata_, ops.SendInitialMetadata(&context->send_initial_metadata_,
context->initial_metadata_flags()); context->initial_metadata_flags());
@ -281,9 +282,9 @@ template <class W>
class ClientWriterFactory { class ClientWriterFactory {
public: public:
template <class R> template <class R>
static ClientWriter<W>* Create(grpc::ChannelInterface* channel, static ClientWriter<W>* Create(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, R* response) { ::grpc::ClientContext* context, R* response) {
return new ClientWriter<W>(channel, method, context, response); return new ClientWriter<W>(channel, method, context, response);
} }
}; };
@ -304,7 +305,8 @@ class ClientWriter : public ClientWriterInterface<W> {
void WaitForInitialMetadata() { void WaitForInitialMetadata() {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata>
ops;
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
call_.PerformOps(&ops); call_.PerformOps(&ops);
cq_.Pluck(&ops); // status ignored cq_.Pluck(&ops); // status ignored
@ -317,10 +319,10 @@ class ClientWriter : public ClientWriterInterface<W> {
/// Also sends initial metadata if not already sent (using the /// Also sends initial metadata if not already sent (using the
/// \a ClientContext associated with this call). /// \a ClientContext associated with this call).
using internal::WriterInterface<W>::Write; using internal::WriterInterface<W>::Write;
bool Write(const W& msg, grpc::WriteOptions options) override { bool Write(const W& msg, ::grpc::WriteOptions options) override {
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpClientSendClose> ::grpc::internal::CallOpClientSendClose>
ops; ops;
if (options.is_last_message()) { if (options.is_last_message()) {
@ -341,7 +343,7 @@ class ClientWriter : public ClientWriterInterface<W> {
} }
bool WritesDone() override { bool WritesDone() override {
grpc::internal::CallOpSet<::grpc::internal::CallOpClientSendClose> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpClientSendClose> ops;
ops.ClientSendClose(); ops.ClientSendClose();
call_.PerformOps(&ops); call_.PerformOps(&ops);
return cq_.Pluck(&ops); return cq_.Pluck(&ops);
@ -353,8 +355,8 @@ class ClientWriter : public ClientWriterInterface<W> {
/// - Attempts to fill in the \a response parameter passed /// - Attempts to fill in the \a response parameter passed
/// to the constructor of this instance with the response /// to the constructor of this instance with the response
/// message from the server. /// message from the server.
grpc::Status Finish() override { ::grpc::Status Finish() override {
grpc::Status status; ::grpc::Status status;
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_); finish_ops_.RecvInitialMetadata(context_);
} }
@ -373,9 +375,9 @@ class ClientWriter : public ClientWriterInterface<W> {
/// single expected response message from the server upon a successful /// single expected response message from the server upon a successful
/// call to the \a Finish method of this instance. /// call to the \a Finish method of this instance.
template <class R> template <class R>
ClientWriter(grpc::ChannelInterface* channel, ClientWriter(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context, R* response) ::grpc::ClientContext* context, R* response)
: context_(context), : context_(context),
cq_(grpc_completion_queue_attributes{ cq_(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,
@ -385,7 +387,7 @@ class ClientWriter : public ClientWriterInterface<W> {
finish_ops_.AllowNoMessage(); finish_ops_.AllowNoMessage();
if (!context_->initial_metadata_corked_) { if (!context_->initial_metadata_corked_) {
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
ops; ops;
ops.SendInitialMetadata(&context->send_initial_metadata_, ops.SendInitialMetadata(&context->send_initial_metadata_,
context->initial_metadata_flags()); context->initial_metadata_flags());
@ -394,13 +396,13 @@ class ClientWriter : public ClientWriterInterface<W> {
} }
} }
grpc::ClientContext* context_; ::grpc::ClientContext* context_;
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpGenericRecvMessage, ::grpc::internal::CallOpGenericRecvMessage,
grpc::internal::CallOpClientRecvStatus> ::grpc::internal::CallOpClientRecvStatus>
finish_ops_; finish_ops_;
grpc::CompletionQueue cq_; ::grpc::CompletionQueue cq_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
}; };
/// Client-side interface for bi-directional streaming with /// Client-side interface for bi-directional streaming with
@ -431,8 +433,9 @@ template <class W, class R>
class ClientReaderWriterFactory { class ClientReaderWriterFactory {
public: public:
static ClientReaderWriter<W, R>* Create( static ClientReaderWriter<W, R>* Create(
grpc::ChannelInterface* channel, const grpc::internal::RpcMethod& method, ::grpc::ChannelInterface* channel,
grpc::ClientContext* context) { const ::grpc::internal::RpcMethod& method,
::grpc::ClientContext* context) {
return new ClientReaderWriter<W, R>(channel, method, context); return new ClientReaderWriter<W, R>(channel, method, context);
} }
}; };
@ -454,7 +457,8 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
void WaitForInitialMetadata() override { void WaitForInitialMetadata() override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata>
ops;
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
call_.PerformOps(&ops); call_.PerformOps(&ops);
cq_.Pluck(&ops); // status ignored cq_.Pluck(&ops); // status ignored
@ -471,8 +475,8 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
/// Also receives initial metadata if not already received (updates the \a /// Also receives initial metadata if not already received (updates the \a
/// ClientContext associated with this call in that case). /// ClientContext associated with this call in that case).
bool Read(R* msg) override { bool Read(R* msg) override {
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpRecvMessage<R>> ::grpc::internal::CallOpRecvMessage<R>>
ops; ops;
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
@ -488,10 +492,10 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
/// Also sends initial metadata if not already sent (using the /// Also sends initial metadata if not already sent (using the
/// \a ClientContext associated with this call to fill in values). /// \a ClientContext associated with this call to fill in values).
using internal::WriterInterface<W>::Write; using internal::WriterInterface<W>::Write;
bool Write(const W& msg, grpc::WriteOptions options) override { bool Write(const W& msg, ::grpc::WriteOptions options) override {
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage, ::grpc::internal::CallOpSendMessage,
grpc::internal::CallOpClientSendClose> ::grpc::internal::CallOpClientSendClose>
ops; ops;
if (options.is_last_message()) { if (options.is_last_message()) {
@ -512,7 +516,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
} }
bool WritesDone() override { bool WritesDone() override {
grpc::internal::CallOpSet<::grpc::internal::CallOpClientSendClose> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpClientSendClose> ops;
ops.ClientSendClose(); ops.ClientSendClose();
call_.PerformOps(&ops); call_.PerformOps(&ops);
return cq_.Pluck(&ops); return cq_.Pluck(&ops);
@ -523,14 +527,14 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
/// Side effect: /// Side effect:
/// - the \a ClientContext associated with this call is updated with /// - the \a ClientContext associated with this call is updated with
/// possible trailing metadata sent from the server. /// possible trailing metadata sent from the server.
grpc::Status Finish() override { ::grpc::Status Finish() override {
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata, ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
grpc::internal::CallOpClientRecvStatus> ::grpc::internal::CallOpClientRecvStatus>
ops; ops;
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
} }
grpc::Status status; ::grpc::Status status;
ops.ClientRecvStatus(context_, &status); ops.ClientRecvStatus(context_, &status);
call_.PerformOps(&ops); call_.PerformOps(&ops);
GPR_CODEGEN_ASSERT(cq_.Pluck(&ops)); GPR_CODEGEN_ASSERT(cq_.Pluck(&ops));
@ -540,23 +544,23 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
private: private:
friend class internal::ClientReaderWriterFactory<W, R>; friend class internal::ClientReaderWriterFactory<W, R>;
grpc::ClientContext* context_; ::grpc::ClientContext* context_;
grpc::CompletionQueue cq_; ::grpc::CompletionQueue cq_;
grpc::internal::Call call_; ::grpc::internal::Call call_;
/// Block to create a stream and write the initial metadata and \a request /// Block to create a stream and write the initial metadata and \a request
/// out. Note that \a context will be used to fill in custom initial metadata /// out. Note that \a context will be used to fill in custom initial metadata
/// used to send to the server when starting the call. /// used to send to the server when starting the call.
ClientReaderWriter(grpc::ChannelInterface* channel, ClientReaderWriter(::grpc::ChannelInterface* channel,
const grpc::internal::RpcMethod& method, const ::grpc::internal::RpcMethod& method,
grpc::ClientContext* context) ::grpc::ClientContext* context)
: context_(context), : context_(context),
cq_(grpc_completion_queue_attributes{ cq_(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,
nullptr}), // Pluckable cq nullptr}), // Pluckable cq
call_(channel->CreateCall(method, context, &cq_)) { call_(channel->CreateCall(method, context, &cq_)) {
if (!context_->initial_metadata_corked_) { if (!context_->initial_metadata_corked_) {
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
ops; ops;
ops.SendInitialMetadata(&context->send_initial_metadata_, ops.SendInitialMetadata(&context->send_initial_metadata_,
context->initial_metadata_flags()); context->initial_metadata_flags());
@ -583,7 +587,8 @@ class ServerReader final : public ServerReaderInterface<R> {
void SendInitialMetadata() override { void SendInitialMetadata() override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
ops;
ops.SendInitialMetadata(&ctx_->initial_metadata_, ops.SendInitialMetadata(&ctx_->initial_metadata_,
ctx_->initial_metadata_flags()); ctx_->initial_metadata_flags());
if (ctx_->compression_level_set()) { if (ctx_->compression_level_set()) {
@ -601,7 +606,7 @@ class ServerReader final : public ServerReaderInterface<R> {
} }
bool Read(R* msg) override { bool Read(R* msg) override {
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> ops;
ops.RecvMessage(msg); ops.RecvMessage(msg);
call_->PerformOps(&ops); call_->PerformOps(&ops);
bool ok = call_->cq()->Pluck(&ops) && ops.got_message; bool ok = call_->cq()->Pluck(&ops) && ops.got_message;
@ -612,13 +617,13 @@ class ServerReader final : public ServerReaderInterface<R> {
} }
private: private:
grpc::internal::Call* const call_; ::grpc::internal::Call* const call_;
ServerContext* const ctx_; ServerContext* const ctx_;
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
friend class internal::ClientStreamingHandler; friend class internal::ClientStreamingHandler;
ServerReader(grpc::internal::Call* call, grpc::ServerContext* ctx) ServerReader(::grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: call_(call), ctx_(ctx) {} : call_(call), ctx_(ctx) {}
}; };
@ -640,7 +645,8 @@ class ServerWriter final : public ServerWriterInterface<W> {
void SendInitialMetadata() override { void SendInitialMetadata() override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata>
ops;
ops.SendInitialMetadata(&ctx_->initial_metadata_, ops.SendInitialMetadata(&ctx_->initial_metadata_,
ctx_->initial_metadata_flags()); ctx_->initial_metadata_flags());
if (ctx_->compression_level_set()) { if (ctx_->compression_level_set()) {
@ -657,7 +663,7 @@ class ServerWriter final : public ServerWriterInterface<W> {
/// Also sends initial metadata if not already sent (using the /// Also sends initial metadata if not already sent (using the
/// \a ClientContext associated with this call to fill in values). /// \a ClientContext associated with this call to fill in values).
using internal::WriterInterface<W>::Write; using internal::WriterInterface<W>::Write;
bool Write(const W& msg, grpc::WriteOptions options) override { bool Write(const W& msg, ::grpc::WriteOptions options) override {
if (options.is_last_message()) { if (options.is_last_message()) {
options.set_buffer_hint(); options.set_buffer_hint();
} }
@ -686,13 +692,13 @@ class ServerWriter final : public ServerWriterInterface<W> {
} }
private: private:
grpc::internal::Call* const call_; ::grpc::internal::Call* const call_;
grpc::ServerContext* const ctx_; ::grpc::ServerContext* const ctx_;
template <class ServiceType, class RequestType, class ResponseType> template <class ServiceType, class RequestType, class ResponseType>
friend class internal::ServerStreamingHandler; friend class internal::ServerStreamingHandler;
ServerWriter(grpc::internal::Call* call, grpc::ServerContext* ctx) ServerWriter(::grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: call_(call), ctx_(ctx) {} : call_(call), ctx_(ctx) {}
}; };
@ -707,7 +713,7 @@ namespace internal {
template <class W, class R> template <class W, class R>
class ServerReaderWriterBody final { class ServerReaderWriterBody final {
public: public:
ServerReaderWriterBody(grpc::internal::Call* call, grpc::ServerContext* ctx) ServerReaderWriterBody(grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: call_(call), ctx_(ctx) {} : call_(call), ctx_(ctx) {}
void SendInitialMetadata() { void SendInitialMetadata() {
@ -731,7 +737,7 @@ class ServerReaderWriterBody final {
} }
bool Read(R* msg) { bool Read(R* msg) {
grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> ops; ::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvMessage<R>> ops;
ops.RecvMessage(msg); ops.RecvMessage(msg);
call_->PerformOps(&ops); call_->PerformOps(&ops);
bool ok = call_->cq()->Pluck(&ops) && ops.got_message; bool ok = call_->cq()->Pluck(&ops) && ops.got_message;
@ -741,7 +747,7 @@ class ServerReaderWriterBody final {
return ok; return ok;
} }
bool Write(const W& msg, grpc::WriteOptions options) { bool Write(const W& msg, ::grpc::WriteOptions options) {
if (options.is_last_message()) { if (options.is_last_message()) {
options.set_buffer_hint(); options.set_buffer_hint();
} }
@ -770,7 +776,7 @@ class ServerReaderWriterBody final {
private: private:
grpc::internal::Call* const call_; grpc::internal::Call* const call_;
grpc::ServerContext* const ctx_; ::grpc::ServerContext* const ctx_;
}; };
} // namespace internal } // namespace internal
@ -799,7 +805,7 @@ class ServerReaderWriter final : public ServerReaderWriterInterface<W, R> {
/// Also sends initial metadata if not already sent (using the \a /// Also sends initial metadata if not already sent (using the \a
/// ServerContext associated with this call). /// ServerContext associated with this call).
using internal::WriterInterface<W>::Write; using internal::WriterInterface<W>::Write;
bool Write(const W& msg, grpc::WriteOptions options) override { bool Write(const W& msg, ::grpc::WriteOptions options) override {
return body_.Write(msg, options); return body_.Write(msg, options);
} }
@ -808,7 +814,7 @@ class ServerReaderWriter final : public ServerReaderWriterInterface<W, R> {
friend class internal::TemplatedBidiStreamingHandler<ServerReaderWriter<W, R>, friend class internal::TemplatedBidiStreamingHandler<ServerReaderWriter<W, R>,
false>; false>;
ServerReaderWriter(grpc::internal::Call* call, grpc::ServerContext* ctx) ServerReaderWriter(::grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: body_(call, ctx) {} : body_(call, ctx) {}
}; };
@ -862,7 +868,7 @@ class ServerUnaryStreamer final
/// \return \a true on success, \a false when the stream has been closed. /// \return \a true on success, \a false when the stream has been closed.
using internal::WriterInterface<ResponseType>::Write; using internal::WriterInterface<ResponseType>::Write;
bool Write(const ResponseType& response, bool Write(const ResponseType& response,
grpc::WriteOptions options) override { ::grpc::WriteOptions options) override {
if (write_done_ || !read_done_) { if (write_done_ || !read_done_) {
return false; return false;
} }
@ -877,7 +883,7 @@ class ServerUnaryStreamer final
friend class internal::TemplatedBidiStreamingHandler< friend class internal::TemplatedBidiStreamingHandler<
ServerUnaryStreamer<RequestType, ResponseType>, true>; ServerUnaryStreamer<RequestType, ResponseType>, true>;
ServerUnaryStreamer(grpc::internal::Call* call, grpc::ServerContext* ctx) ServerUnaryStreamer(::grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: body_(call, ctx), read_done_(false), write_done_(false) {} : body_(call, ctx), read_done_(false), write_done_(false) {}
}; };
@ -928,7 +934,7 @@ class ServerSplitStreamer final
/// \return \a true on success, \a false when the stream has been closed. /// \return \a true on success, \a false when the stream has been closed.
using internal::WriterInterface<ResponseType>::Write; using internal::WriterInterface<ResponseType>::Write;
bool Write(const ResponseType& response, bool Write(const ResponseType& response,
grpc::WriteOptions options) override { ::grpc::WriteOptions options) override {
return read_done_ && body_.Write(response, options); return read_done_ && body_.Write(response, options);
} }
@ -938,7 +944,7 @@ class ServerSplitStreamer final
friend class internal::TemplatedBidiStreamingHandler< friend class internal::TemplatedBidiStreamingHandler<
ServerSplitStreamer<RequestType, ResponseType>, false>; ServerSplitStreamer<RequestType, ResponseType>, false>;
ServerSplitStreamer(grpc::internal::Call* call, grpc::ServerContext* ctx) ServerSplitStreamer(::grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: body_(call, ctx), read_done_(false) {} : body_(call, ctx), read_done_(false) {}
}; };

View File

@ -31,7 +31,7 @@ namespace grpc {
/// or a client channel (via \a ChannelArguments). /// or a client channel (via \a ChannelArguments).
/// gRPC will attempt to keep memory and threads used by all attached entities /// gRPC will attempt to keep memory and threads used by all attached entities
/// below the ResourceQuota bound. /// below the ResourceQuota bound.
class ResourceQuota final : private grpc::GrpcLibraryCodegen { class ResourceQuota final : private ::grpc::GrpcLibraryCodegen {
public: public:
/// \param name - a unique name for this ResourceQuota. /// \param name - a unique name for this ResourceQuota.
explicit ResourceQuota(const std::string& name); explicit ResourceQuota(const std::string& name);

View File

@ -351,7 +351,7 @@ class ServerBuilder {
virtual ChannelArguments BuildChannelArgs(); virtual ChannelArguments BuildChannelArgs();
private: private:
friend class grpc::testing::ServerBuilderPluginTest; friend class ::grpc::testing::ServerBuilderPluginTest;
struct SyncServerSettings { struct SyncServerSettings {
SyncServerSettings() SyncServerSettings()

View File

@ -32,7 +32,7 @@ namespace grpc {
namespace testing { namespace testing {
template <class R> template <class R>
class MockClientReader : public grpc::ClientReaderInterface<R> { class MockClientReader : public ::grpc::ClientReaderInterface<R> {
public: public:
MockClientReader() = default; MockClientReader() = default;
@ -48,7 +48,7 @@ class MockClientReader : public grpc::ClientReaderInterface<R> {
}; };
template <class W> template <class W>
class MockClientWriter : public grpc::ClientWriterInterface<W> { class MockClientWriter : public ::grpc::ClientWriterInterface<W> {
public: public:
MockClientWriter() = default; MockClientWriter() = default;
@ -63,7 +63,8 @@ class MockClientWriter : public grpc::ClientWriterInterface<W> {
}; };
template <class W, class R> template <class W, class R>
class MockClientReaderWriter : public grpc::ClientReaderWriterInterface<W, R> { class MockClientReaderWriter
: public ::grpc::ClientReaderWriterInterface<W, R> {
public: public:
MockClientReaderWriter() = default; MockClientReaderWriter() = default;
@ -86,7 +87,7 @@ class MockClientReaderWriter : public grpc::ClientReaderWriterInterface<W, R> {
template <class R> template <class R>
class MockClientAsyncResponseReader class MockClientAsyncResponseReader
: public grpc::ClientAsyncResponseReaderInterface<R> { : public ::grpc::ClientAsyncResponseReaderInterface<R> {
public: public:
MockClientAsyncResponseReader() = default; MockClientAsyncResponseReader() = default;
@ -111,7 +112,7 @@ class MockClientAsyncReader : public ClientAsyncReaderInterface<R> {
}; };
template <class W> template <class W>
class MockClientAsyncWriter : public grpc::ClientAsyncWriterInterface<W> { class MockClientAsyncWriter : public ::grpc::ClientAsyncWriterInterface<W> {
public: public:
MockClientAsyncWriter() = default; MockClientAsyncWriter() = default;
@ -122,7 +123,7 @@ class MockClientAsyncWriter : public grpc::ClientAsyncWriterInterface<W> {
/// AsyncWriterInterface /// AsyncWriterInterface
MOCK_METHOD2_T(Write, void(const W&, void*)); MOCK_METHOD2_T(Write, void(const W&, void*));
MOCK_METHOD3_T(Write, void(const W&, grpc::WriteOptions, void*)); MOCK_METHOD3_T(Write, void(const W&, ::grpc::WriteOptions, void*));
/// ClientAsyncWriterInterface /// ClientAsyncWriterInterface
MOCK_METHOD1_T(WritesDone, void(void*)); MOCK_METHOD1_T(WritesDone, void(void*));
@ -141,7 +142,7 @@ class MockClientAsyncReaderWriter
/// AsyncWriterInterface /// AsyncWriterInterface
MOCK_METHOD2_T(Write, void(const W&, void*)); MOCK_METHOD2_T(Write, void(const W&, void*));
MOCK_METHOD3_T(Write, void(const W&, grpc::WriteOptions, void*)); MOCK_METHOD3_T(Write, void(const W&, ::grpc::WriteOptions, void*));
/// AsyncReaderInterface /// AsyncReaderInterface
MOCK_METHOD2_T(Read, void(R*, void*)); MOCK_METHOD2_T(Read, void(R*, void*));
@ -151,7 +152,7 @@ class MockClientAsyncReaderWriter
}; };
template <class R> template <class R>
class MockServerReader : public grpc::ServerReaderInterface<R> { class MockServerReader : public ::grpc::ServerReaderInterface<R> {
public: public:
MockServerReader() = default; MockServerReader() = default;
@ -164,7 +165,7 @@ class MockServerReader : public grpc::ServerReaderInterface<R> {
}; };
template <class W> template <class W>
class MockServerWriter : public grpc::ServerWriterInterface<W> { class MockServerWriter : public ::grpc::ServerWriterInterface<W> {
public: public:
MockServerWriter() = default; MockServerWriter() = default;

View File

@ -28,7 +28,7 @@ namespace grpc {
class XdsServerServingStatusNotifierInterface { class XdsServerServingStatusNotifierInterface {
public: public:
struct ServingStatusUpdate { struct ServingStatusUpdate {
grpc::Status status; ::grpc::Status status;
}; };
virtual ~XdsServerServingStatusNotifierInterface() = default; virtual ~XdsServerServingStatusNotifierInterface() = default;
@ -44,12 +44,12 @@ class XdsServerServingStatusNotifierInterface {
ServingStatusUpdate update) = 0; ServingStatusUpdate update) = 0;
}; };
class XdsServerBuilder : public grpc::ServerBuilder { class XdsServerBuilder : public ::grpc::ServerBuilder {
public: public:
// NOTE: class experimental_type is not part of the public API of this class // NOTE: class experimental_type is not part of the public API of this class
// TODO(yashykt): Integrate into public API when this is no longer // TODO(yashykt): Integrate into public API when this is no longer
// experimental. // experimental.
class experimental_type : public grpc::ServerBuilder::experimental_type { class experimental_type : public ::grpc::ServerBuilder::experimental_type {
public: public:
explicit experimental_type(XdsServerBuilder* builder) explicit experimental_type(XdsServerBuilder* builder)
: ServerBuilder::experimental_type(builder), builder_(builder) {} : ServerBuilder::experimental_type(builder), builder_(builder) {}

View File

@ -275,16 +275,16 @@ const char* ServerLoadReportingCallData::GetStatusTagForStatus(
grpc_status_code status) { grpc_status_code status) {
switch (status) { switch (status) {
case GRPC_STATUS_OK: case GRPC_STATUS_OK:
return grpc::load_reporter::kCallStatusOk; return ::grpc::load_reporter::kCallStatusOk;
case GRPC_STATUS_UNKNOWN: case GRPC_STATUS_UNKNOWN:
case GRPC_STATUS_DEADLINE_EXCEEDED: case GRPC_STATUS_DEADLINE_EXCEEDED:
case GRPC_STATUS_UNIMPLEMENTED: case GRPC_STATUS_UNIMPLEMENTED:
case GRPC_STATUS_INTERNAL: case GRPC_STATUS_INTERNAL:
case GRPC_STATUS_UNAVAILABLE: case GRPC_STATUS_UNAVAILABLE:
case GRPC_STATUS_DATA_LOSS: case GRPC_STATUS_DATA_LOSS:
return grpc::load_reporter::kCallStatusServerError; return ::grpc::load_reporter::kCallStatusServerError;
default: default:
return grpc::load_reporter::kCallStatusClientError; return ::grpc::load_reporter::kCallStatusClientError;
} }
} }
@ -309,12 +309,12 @@ struct ServerLoadReportingFilterStaticRegistrar {
MaybeAddServerLoadReportingFilter); MaybeAddServerLoadReportingFilter);
// Access measures to ensure they are initialized. Otherwise, we can't // Access measures to ensure they are initialized. Otherwise, we can't
// create any valid view before the first RPC. // create any valid view before the first RPC.
grpc::load_reporter::MeasureStartCount(); ::grpc::load_reporter::MeasureStartCount();
grpc::load_reporter::MeasureEndCount(); ::grpc::load_reporter::MeasureEndCount();
grpc::load_reporter::MeasureEndBytesSent(); ::grpc::load_reporter::MeasureEndBytesSent();
grpc::load_reporter::MeasureEndBytesReceived(); ::grpc::load_reporter::MeasureEndBytesReceived();
grpc::load_reporter::MeasureEndLatencyMs(); ::grpc::load_reporter::MeasureEndLatencyMs();
grpc::load_reporter::MeasureOtherCallMetric(); ::grpc::load_reporter::MeasureOtherCallMetric();
registered.store(true, std::memory_order_release); registered.store(true, std::memory_order_release);
} }
} server_load_reporting_filter_static_registrar; } server_load_reporting_filter_static_registrar;

View File

@ -144,7 +144,7 @@ std::shared_ptr<grpc::Channel> CreateCustomBinderChannel(
grpc_binder::GetSecurityPolicySetting()->Set(connection_id, security_policy); grpc_binder::GetSecurityPolicySetting()->Set(connection_id, security_policy);
auto channel = CreateChannelInternal( auto channel = CreateChannelInternal(
"", grpc::internal::CreateClientBinderChannelImpl(new_args), "", ::grpc::internal::CreateClientBinderChannelImpl(new_args),
std::vector< std::vector<
std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>()); std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>());

View File

@ -25,7 +25,7 @@
#include <memory> #include <memory>
// This file defines NdkBinder functions, variables, and types in // This file defines NdkBinder functions, variables, and types in
// grpc_binder::ndk_util namespace. This allows us to dynamically load // ::grpc_binder::ndk_util namespace. This allows us to dynamically load
// libbinder_ndk at runtime, and make it possible to compile the code without // libbinder_ndk at runtime, and make it possible to compile the code without
// the library present at compile time. // the library present at compile time.

View File

@ -194,7 +194,7 @@ class TransportFlowControlBase {
virtual void TestOnlyForceHugeWindow() {} virtual void TestOnlyForceHugeWindow() {}
protected: protected:
friend class grpc::testing::TrickledCHTTP2; friend class ::grpc::testing::TrickledCHTTP2;
int64_t remote_window_ = kDefaultWindow; int64_t remote_window_ = kDefaultWindow;
int64_t target_initial_window_size_ = kDefaultWindow; int64_t target_initial_window_size_ = kDefaultWindow;
int64_t announced_window_ = kDefaultWindow; int64_t announced_window_ = kDefaultWindow;
@ -384,7 +384,7 @@ class StreamFlowControlBase {
int64_t announced_window_delta() const { return announced_window_delta_; } int64_t announced_window_delta() const { return announced_window_delta_; }
protected: protected:
friend class grpc::testing::TrickledCHTTP2; friend class ::grpc::testing::TrickledCHTTP2;
int64_t remote_window_delta_ = 0; int64_t remote_window_delta_ = 0;
int64_t local_window_delta_ = 0; int64_t local_window_delta_ = 0;
int64_t announced_window_delta_ = 0; int64_t announced_window_delta_ = 0;

View File

@ -38,7 +38,7 @@ class DebugLocation {
const char* file_; const char* file_;
const int line_; const int line_;
}; };
#define DEBUG_LOCATION grpc_core::DebugLocation(__FILE__, __LINE__) #define DEBUG_LOCATION ::grpc_core::DebugLocation(__FILE__, __LINE__)
#else #else
class DebugLocation { class DebugLocation {
public: public:
@ -47,7 +47,7 @@ class DebugLocation {
const char* file() const { return nullptr; } const char* file() const { return nullptr; }
int line() const { return -1; } int line() const { return -1; }
}; };
#define DEBUG_LOCATION grpc_core::DebugLocation() #define DEBUG_LOCATION ::grpc_core::DebugLocation()
#endif #endif
} // namespace grpc_core } // namespace grpc_core

View File

@ -103,29 +103,29 @@ class GlobalConfigEnvString : public GlobalConfigEnv {
// for the canonical name without dynamic allocation. // for the canonical name without dynamic allocation.
// `help` argument is ignored for this implementation. // `help` argument is ignored for this implementation.
#define GPR_GLOBAL_CONFIG_DEFINE_BOOL(name, default_value, help) \ #define GPR_GLOBAL_CONFIG_DEFINE_BOOL(name, default_value, help) \
static char g_env_str_##name[] = #name; \ static char g_env_str_##name[] = #name; \
static grpc_core::GlobalConfigEnvBool g_env_##name(g_env_str_##name, \ static ::grpc_core::GlobalConfigEnvBool g_env_##name(g_env_str_##name, \
default_value); \ default_value); \
bool gpr_global_config_get_##name() { return g_env_##name.Get(); } \ bool gpr_global_config_get_##name() { return g_env_##name.Get(); } \
void gpr_global_config_set_##name(bool value) { g_env_##name.Set(value); } void gpr_global_config_set_##name(bool value) { g_env_##name.Set(value); }
#define GPR_GLOBAL_CONFIG_DEFINE_INT32(name, default_value, help) \ #define GPR_GLOBAL_CONFIG_DEFINE_INT32(name, default_value, help) \
static char g_env_str_##name[] = #name; \ static char g_env_str_##name[] = #name; \
static grpc_core::GlobalConfigEnvInt32 g_env_##name(g_env_str_##name, \ static ::grpc_core::GlobalConfigEnvInt32 g_env_##name(g_env_str_##name, \
default_value); \ default_value); \
int32_t gpr_global_config_get_##name() { return g_env_##name.Get(); } \ int32_t gpr_global_config_get_##name() { return g_env_##name.Get(); } \
void gpr_global_config_set_##name(int32_t value) { g_env_##name.Set(value); } void gpr_global_config_set_##name(int32_t value) { g_env_##name.Set(value); }
#define GPR_GLOBAL_CONFIG_DEFINE_STRING(name, default_value, help) \ #define GPR_GLOBAL_CONFIG_DEFINE_STRING(name, default_value, help) \
static char g_env_str_##name[] = #name; \ static char g_env_str_##name[] = #name; \
static grpc_core::GlobalConfigEnvString g_env_##name(g_env_str_##name, \ static ::grpc_core::GlobalConfigEnvString g_env_##name(g_env_str_##name, \
default_value); \ default_value); \
grpc_core::UniquePtr<char> gpr_global_config_get_##name() { \ ::grpc_core::UniquePtr<char> gpr_global_config_get_##name() { \
return g_env_##name.Get(); \ return g_env_##name.Get(); \
} \ } \
void gpr_global_config_set_##name(const char* value) { \ void gpr_global_config_set_##name(const char* value) { \
g_env_##name.Set(value); \ g_env_##name.Set(value); \
} }
#endif /* GRPC_CORE_LIB_GPRPP_GLOBAL_CONFIG_ENV_H */ #endif /* GRPC_CORE_LIB_GPRPP_GLOBAL_CONFIG_ENV_H */

View File

@ -85,8 +85,8 @@ class ProfileScope {
#define GPR_TIMER_SCOPE_NAME_INTERNAL(prefix, line) prefix##line #define GPR_TIMER_SCOPE_NAME_INTERNAL(prefix, line) prefix##line
#define GPR_TIMER_SCOPE_NAME(prefix, line) \ #define GPR_TIMER_SCOPE_NAME(prefix, line) \
GPR_TIMER_SCOPE_NAME_INTERNAL(prefix, line) GPR_TIMER_SCOPE_NAME_INTERNAL(prefix, line)
#define GPR_TIMER_SCOPE(tag, important) \ #define GPR_TIMER_SCOPE(tag, important) \
grpc::ProfileScope GPR_TIMER_SCOPE_NAME(_profile_scope_, __LINE__)( \ ::grpc::ProfileScope GPR_TIMER_SCOPE_NAME(_profile_scope_, __LINE__)( \
(tag), (important), __FILE__, __LINE__) (tag), (important), __FILE__, __LINE__)
#endif /* at least one profiler requested. */ #endif /* at least one profiler requested. */

View File

@ -44,12 +44,11 @@
namespace grpc { namespace grpc {
static grpc::internal::GrpcLibraryInitializer g_gli_initializer; static ::grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Channel::Channel( Channel::Channel(const std::string& host, grpc_channel* channel,
const std::string& host, grpc_channel* channel, std::vector<std::unique_ptr<
std::vector< ::grpc::experimental::ClientInterceptorFactoryInterface>>
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>> interceptor_creators)
interceptor_creators)
: host_(host), c_channel_(channel) { : host_(host), c_channel_(channel) {
interceptor_creators_ = std::move(interceptor_creators); interceptor_creators_ = std::move(interceptor_creators);
g_gli_initializer.summon(); g_gli_initializer.summon();
@ -109,9 +108,9 @@ void ChannelResetConnectionBackoff(Channel* channel) {
} // namespace experimental } // namespace experimental
grpc::internal::Call Channel::CreateCallInternal( ::grpc::internal::Call Channel::CreateCallInternal(
const grpc::internal::RpcMethod& method, grpc::ClientContext* context, const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
grpc::CompletionQueue* cq, size_t interceptor_pos) { ::grpc::CompletionQueue* cq, size_t interceptor_pos) {
const bool kRegistered = method.channel_tag() && context->authority().empty(); const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = nullptr; grpc_call* c_call = nullptr;
if (kRegistered) { if (kRegistered) {
@ -130,7 +129,7 @@ grpc::internal::Call Channel::CreateCallInternal(
SliceFromArray(method.name(), strlen(method.name())); SliceFromArray(method.name(), strlen(method.name()));
grpc_slice host_slice; grpc_slice host_slice;
if (host_str != nullptr) { if (host_str != nullptr) {
host_slice = grpc::SliceFromCopiedString(*host_str); host_slice = ::grpc::SliceFromCopiedString(*host_str);
} }
c_call = grpc_channel_create_call( c_call = grpc_channel_create_call(
c_channel_, context->propagate_from_call_, c_channel_, context->propagate_from_call_,
@ -152,17 +151,17 @@ grpc::internal::Call Channel::CreateCallInternal(
interceptor_creators_, interceptor_pos); interceptor_creators_, interceptor_pos);
context->set_call(c_call, shared_from_this()); context->set_call(c_call, shared_from_this());
return grpc::internal::Call(c_call, this, cq, info); return ::grpc::internal::Call(c_call, this, cq, info);
} }
grpc::internal::Call Channel::CreateCall( ::grpc::internal::Call Channel::CreateCall(
const grpc::internal::RpcMethod& method, grpc::ClientContext* context, const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
CompletionQueue* cq) { CompletionQueue* cq) {
return CreateCallInternal(method, context, cq, 0); return CreateCallInternal(method, context, cq, 0);
} }
void Channel::PerformOpsOnCall(grpc::internal::CallOpSetInterface* ops, void Channel::PerformOpsOnCall(::grpc::internal::CallOpSetInterface* ops,
grpc::internal::Call* call) { ::grpc::internal::Call* call) {
ops->FillOps( ops->FillOps(
call); // Make a copy of call. It's fine since Call just has pointers call); // Make a copy of call. It's fine since Call just has pointers
} }
@ -178,7 +177,7 @@ grpc_connectivity_state Channel::GetState(bool try_to_connect) {
namespace { namespace {
class TagSaver final : public grpc::internal::CompletionQueueTag { class TagSaver final : public ::grpc::internal::CompletionQueueTag {
public: public:
explicit TagSaver(void* tag) : tag_(tag) {} explicit TagSaver(void* tag) : tag_(tag) {}
~TagSaver() override {} ~TagSaver() override {}
@ -196,7 +195,7 @@ class TagSaver final : public grpc::internal::CompletionQueueTag {
void Channel::NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, void Channel::NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline, gpr_timespec deadline,
grpc::CompletionQueue* cq, void* tag) { ::grpc::CompletionQueue* cq, void* tag) {
TagSaver* tag_saver = new TagSaver(tag); TagSaver* tag_saver = new TagSaver(tag);
grpc_channel_watch_connectivity_state(c_channel_, last_observed, deadline, grpc_channel_watch_connectivity_state(c_channel_, last_observed, deadline,
cq->cq(), tag_saver); cq->cq(), tag_saver);
@ -204,7 +203,7 @@ void Channel::NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
bool Channel::WaitForStateChangeImpl(grpc_connectivity_state last_observed, bool Channel::WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) { gpr_timespec deadline) {
grpc::CompletionQueue cq; ::grpc::CompletionQueue cq;
bool ok = false; bool ok = false;
void* tag = nullptr; void* tag = nullptr;
NotifyOnStateChangeImpl(last_observed, deadline, &cq, nullptr); NotifyOnStateChangeImpl(last_observed, deadline, &cq, nullptr);
@ -226,7 +225,7 @@ class ShutdownCallback : public grpc_completion_queue_functor {
} }
// TakeCQ takes ownership of the cq into the shutdown callback // TakeCQ takes ownership of the cq into the shutdown callback
// so that the shutdown callback will be responsible for destroying it // so that the shutdown callback will be responsible for destroying it
void TakeCQ(grpc::CompletionQueue* cq) { cq_ = cq; } void TakeCQ(::grpc::CompletionQueue* cq) { cq_ = cq; }
// The Run function will get invoked by the completion queue library // The Run function will get invoked by the completion queue library
// when the shutdown is actually complete // when the shutdown is actually complete
@ -237,7 +236,7 @@ class ShutdownCallback : public grpc_completion_queue_functor {
} }
private: private:
grpc::CompletionQueue* cq_ = nullptr; ::grpc::CompletionQueue* cq_ = nullptr;
}; };
} // namespace } // namespace
@ -257,9 +256,10 @@ class ShutdownCallback : public grpc_completion_queue_functor {
// gRPC-core provides the backing needed for the preferred CQ type // gRPC-core provides the backing needed for the preferred CQ type
auto* shutdown_callback = new ShutdownCallback; auto* shutdown_callback = new ShutdownCallback;
callback_cq = new grpc::CompletionQueue(grpc_completion_queue_attributes{ callback_cq =
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_CALLBACK, GRPC_CQ_DEFAULT_POLLING, new ::grpc::CompletionQueue(grpc_completion_queue_attributes{
shutdown_callback}); GRPC_CQ_CURRENT_VERSION, GRPC_CQ_CALLBACK,
GRPC_CQ_DEFAULT_POLLING, shutdown_callback});
// Transfer ownership of the new cq to its own shutdown callback // Transfer ownership of the new cq to its own shutdown callback
shutdown_callback->TakeCQ(callback_cq); shutdown_callback->TakeCQ(callback_cq);

View File

@ -31,8 +31,8 @@ namespace grpc {
std::shared_ptr<Channel> CreateChannelInternal( std::shared_ptr<Channel> CreateChannelInternal(
const std::string& host, grpc_channel* c_channel, const std::string& host, grpc_channel* c_channel,
std::vector< std::vector<std::unique_ptr<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>> ::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) { interceptor_creators) {
return std::shared_ptr<Channel>( return std::shared_ptr<Channel>(
new Channel(host, c_channel, std::move(interceptor_creators))); new Channel(host, c_channel, std::move(interceptor_creators)));

View File

@ -33,8 +33,8 @@ namespace grpc {
std::shared_ptr<Channel> CreateChannelInternal( std::shared_ptr<Channel> CreateChannelInternal(
const std::string& host, grpc_channel* c_channel, const std::string& host, grpc_channel* c_channel,
std::vector< std::vector<std::unique_ptr<
std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>> ::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators); interceptor_creators);
} // namespace grpc } // namespace grpc

View File

@ -46,7 +46,7 @@ class InsecureChannelCredentialsImpl final : public ChannelCredentials {
grpc_channel_args channel_args; grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args); args.SetChannelArgs(&channel_args);
grpc_channel_credentials* creds = grpc_insecure_credentials_create(); grpc_channel_credentials* creds = grpc_insecure_credentials_create();
std::shared_ptr<Channel> channel = grpc::CreateChannelInternal( std::shared_ptr<Channel> channel = ::grpc::CreateChannelInternal(
"", grpc_channel_create(target.c_str(), creds, &channel_args), "", grpc_channel_create(target.c_str(), creds, &channel_args),
std::move(interceptor_creators)); std::move(interceptor_creators));
grpc_channel_credentials_release(creds); grpc_channel_credentials_release(creds);

View File

@ -66,7 +66,7 @@ SecureChannelCredentials::CreateChannelWithInterceptors(
interceptor_creators) { interceptor_creators) {
grpc_channel_args channel_args; grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args); args.SetChannelArgs(&channel_args);
return grpc::CreateChannelInternal( return ::grpc::CreateChannelInternal(
args.GetSslTargetNameOverride(), args.GetSslTargetNameOverride(),
grpc_channel_create(target.c_str(), c_creds_, &channel_args), grpc_channel_create(target.c_str(), c_creds_, &channel_args),
std::move(interceptor_creators)); std::move(interceptor_creators));

View File

@ -51,7 +51,7 @@ class SecureChannelCredentials final : public ChannelCredentials {
std::shared_ptr<Channel> CreateChannelWithInterceptors( std::shared_ptr<Channel> CreateChannelWithInterceptors(
const std::string& target, const ChannelArguments& args, const std::string& target, const ChannelArguments& args,
std::vector<std::unique_ptr< std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>> ::grpc::experimental::ClientInterceptorFactoryInterface>>
interceptor_creators) override; interceptor_creators) override;
grpc_channel_credentials* const c_creds_; grpc_channel_credentials* const c_creds_;
}; };

View File

@ -34,7 +34,7 @@
namespace grpc { namespace grpc {
namespace internal { namespace internal {
class AlarmImpl : public grpc::internal::CompletionQueueTag { class AlarmImpl : public ::grpc::internal::CompletionQueueTag {
public: public:
AlarmImpl() : cq_(nullptr), tag_(nullptr) { AlarmImpl() : cq_(nullptr), tag_(nullptr) {
gpr_ref_init(&refs_, 1); gpr_ref_init(&refs_, 1);
@ -46,7 +46,7 @@ class AlarmImpl : public grpc::internal::CompletionQueueTag {
Unref(); Unref();
return true; return true;
} }
void Set(grpc::CompletionQueue* cq, gpr_timespec deadline, void* tag) { void Set(::grpc::CompletionQueue* cq, gpr_timespec deadline, void* tag) {
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
GRPC_CQ_INTERNAL_REF(cq->cq(), "alarm"); GRPC_CQ_INTERNAL_REF(cq->cq(), "alarm");
@ -125,13 +125,13 @@ class AlarmImpl : public grpc::internal::CompletionQueueTag {
}; };
} // namespace internal } // namespace internal
static grpc::internal::GrpcLibraryInitializer g_gli_initializer; static ::grpc::internal::GrpcLibraryInitializer g_gli_initializer;
Alarm::Alarm() : alarm_(new internal::AlarmImpl()) { Alarm::Alarm() : alarm_(new internal::AlarmImpl()) {
g_gli_initializer.summon(); g_gli_initializer.summon();
} }
void Alarm::SetInternal(grpc::CompletionQueue* cq, gpr_timespec deadline, void Alarm::SetInternal(::grpc::CompletionQueue* cq, gpr_timespec deadline,
void* tag) { void* tag) {
// Note that we know that alarm_ is actually an internal::AlarmImpl // Note that we know that alarm_ is actually an internal::AlarmImpl
// but we declared it as the base pointer to avoid a forward declaration // but we declared it as the base pointer to avoid a forward declaration

View File

@ -151,7 +151,7 @@ CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal(
return SHUTDOWN; return SHUTDOWN;
case GRPC_OP_COMPLETE: case GRPC_OP_COMPLETE:
auto core_cq_tag = auto core_cq_tag =
static_cast<grpc::internal::CompletionQueueTag*>(ev.tag); static_cast<::grpc::internal::CompletionQueueTag*>(ev.tag);
*ok = ev.success != 0; *ok = ev.success != 0;
*tag = core_cq_tag; *tag = core_cq_tag;
if (core_cq_tag->FinalizeResult(tag, ok)) { if (core_cq_tag->FinalizeResult(tag, ok)) {
@ -179,7 +179,7 @@ bool CompletionQueue::CompletionQueueTLSCache::Flush(void** tag, bool* ok) {
if (grpc_completion_queue_thread_local_cache_flush(cq_->cq_, &res_tag, if (grpc_completion_queue_thread_local_cache_flush(cq_->cq_, &res_tag,
&res)) { &res)) {
auto core_cq_tag = auto core_cq_tag =
static_cast<grpc::internal::CompletionQueueTag*>(res_tag); static_cast<::grpc::internal::CompletionQueueTag*>(res_tag);
*ok = res == 1; *ok = res == 1;
if (core_cq_tag->FinalizeResult(tag, ok)) { if (core_cq_tag->FinalizeResult(tag, ok)) {
return true; return true;

View File

@ -58,15 +58,15 @@ bool ProtoServerReflectionPlugin::has_async_methods() const {
return false; return false;
} }
static std::unique_ptr<grpc::ServerBuilderPlugin> CreateProtoReflection() { static std::unique_ptr< ::grpc::ServerBuilderPlugin> CreateProtoReflection() {
return std::unique_ptr<grpc::ServerBuilderPlugin>( return std::unique_ptr< ::grpc::ServerBuilderPlugin>(
new ProtoServerReflectionPlugin()); new ProtoServerReflectionPlugin());
} }
void InitProtoReflectionServerBuilderPlugin() { void InitProtoReflectionServerBuilderPlugin() {
static struct Initialize { static struct Initialize {
Initialize() { Initialize() {
grpc::ServerBuilder::InternalAddPluginFactory(&CreateProtoReflection); ::grpc::ServerBuilder::InternalAddPluginFactory(&CreateProtoReflection);
} }
} initializer; } initializer;
} }

View File

@ -23,8 +23,8 @@ namespace grpc {
void AsyncGenericService::RequestCall( void AsyncGenericService::RequestCall(
GenericServerContext* ctx, GenericServerAsyncReaderWriter* reader_writer, GenericServerContext* ctx, GenericServerAsyncReaderWriter* reader_writer,
grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag) { ::grpc::ServerCompletionQueue* notification_cq, void* tag) {
server_->RequestAsyncGenericCall(ctx, reader_writer, call_cq, notification_cq, server_->RequestAsyncGenericCall(ctx, reader_writer, call_cq, notification_cq,
tag); tag);
} }

View File

@ -29,7 +29,7 @@ namespace grpc {
namespace channelz { namespace channelz {
namespace experimental { namespace experimental {
class ChannelzServicePlugin : public grpc::ServerBuilderPlugin { class ChannelzServicePlugin : public ::grpc::ServerBuilderPlugin {
public: public:
ChannelzServicePlugin() : channelz_service_(new grpc::ChannelzService()) {} ChannelzServicePlugin() : channelz_service_(new grpc::ChannelzService()) {}
@ -61,16 +61,16 @@ class ChannelzServicePlugin : public grpc::ServerBuilderPlugin {
std::shared_ptr<grpc::ChannelzService> channelz_service_; std::shared_ptr<grpc::ChannelzService> channelz_service_;
}; };
static std::unique_ptr<grpc::ServerBuilderPlugin> static std::unique_ptr< ::grpc::ServerBuilderPlugin>
CreateChannelzServicePlugin() { CreateChannelzServicePlugin() {
return std::unique_ptr<grpc::ServerBuilderPlugin>( return std::unique_ptr< ::grpc::ServerBuilderPlugin>(
new ChannelzServicePlugin()); new ChannelzServicePlugin());
} }
void InitChannelzService() { void InitChannelzService() {
static struct Initializer { static struct Initializer {
Initializer() { Initializer() {
grpc::ServerBuilder::InternalAddPluginFactory( ::grpc::ServerBuilder::InternalAddPluginFactory(
&grpc::channelz::experimental::CreateChannelzServicePlugin); &grpc::channelz::experimental::CreateChannelzServicePlugin);
} }
} initialize; } initialize;

View File

@ -53,7 +53,7 @@ class ExternalConnectionAcceptorImpl
ServerCredentials* GetCredentials() { return creds_.get(); } ServerCredentials* GetCredentials() { return creds_.get(); }
void SetToChannelArgs(grpc::ChannelArguments* args); void SetToChannelArgs(::grpc::ChannelArguments* args);
private: private:
const std::string name_; const std::string name_;

View File

@ -252,7 +252,7 @@ LoadReporter::GenerateLoadBalancingFeedback() {
feedback_records_.pop_front(); feedback_records_.pop_front();
} }
if (feedback_records_.size() < 2) { if (feedback_records_.size() < 2) {
return grpc::lb::v1::LoadBalancingFeedback::default_instance(); return ::grpc::lb::v1::LoadBalancingFeedback::default_instance();
} }
// Find the longest range with valid ends. // Find the longest range with valid ends.
auto oldest = feedback_records_.begin(); auto oldest = feedback_records_.begin();
@ -267,7 +267,7 @@ LoadReporter::GenerateLoadBalancingFeedback() {
if (std::distance(oldest, newest) < 1 || if (std::distance(oldest, newest) < 1 ||
oldest->end_time == newest->end_time || oldest->end_time == newest->end_time ||
newest->cpu_limit == oldest->cpu_limit) { newest->cpu_limit == oldest->cpu_limit) {
return grpc::lb::v1::LoadBalancingFeedback::default_instance(); return ::grpc::lb::v1::LoadBalancingFeedback::default_instance();
} }
uint64_t rpcs = 0; uint64_t rpcs = 0;
uint64_t errors = 0; uint64_t errors = 0;
@ -282,7 +282,7 @@ LoadReporter::GenerateLoadBalancingFeedback() {
std::chrono::duration<double> duration_seconds = std::chrono::duration<double> duration_seconds =
newest->end_time - oldest->end_time; newest->end_time - oldest->end_time;
lock.Release(); lock.Release();
grpc::lb::v1::LoadBalancingFeedback feedback; ::grpc::lb::v1::LoadBalancingFeedback feedback;
feedback.set_server_utilization(static_cast<float>(cpu_usage / cpu_limit)); feedback.set_server_utilization(static_cast<float>(cpu_usage / cpu_limit));
feedback.set_calls_per_second( feedback.set_calls_per_second(
static_cast<float>(rpcs / duration_seconds.count())); static_cast<float>(rpcs / duration_seconds.count()));
@ -354,7 +354,7 @@ LoadReporter::GenerateLoads(const std::string& hostname,
} }
void LoadReporter::AttachOrphanLoadId( void LoadReporter::AttachOrphanLoadId(
grpc::lb::v1::Load* load, const PerBalancerStore& per_balancer_store) { ::grpc::lb::v1::Load* load, const PerBalancerStore& per_balancer_store) {
if (per_balancer_store.lb_id() == kInvalidLbId) { if (per_balancer_store.lb_id() == kInvalidLbId) {
load->set_load_key_unknown(true); load->set_load_key_unknown(true);
} else { } else {

View File

@ -146,7 +146,7 @@ class LoadReporter {
// The feedback is calculated from the stats data recorded in the sliding // The feedback is calculated from the stats data recorded in the sliding
// window. Outdated records are discarded. // window. Outdated records are discarded.
// Thread-safe. // Thread-safe.
grpc::lb::v1::LoadBalancingFeedback GenerateLoadBalancingFeedback(); ::grpc::lb::v1::LoadBalancingFeedback GenerateLoadBalancingFeedback();
// Wrapper around LoadDataStore::ReportStreamCreated. // Wrapper around LoadDataStore::ReportStreamCreated.
// Thread-safe. // Thread-safe.
@ -209,7 +209,7 @@ class LoadReporter {
// Extracts an OrphanedLoadIdentifier from the per-balancer store and attaches // Extracts an OrphanedLoadIdentifier from the per-balancer store and attaches
// it to the load. // it to the load.
void AttachOrphanLoadId(grpc::lb::v1::Load* load, void AttachOrphanLoadId(::grpc::lb::v1::Load* load,
const PerBalancerStore& per_balancer_store); const PerBalancerStore& per_balancer_store);
std::atomic<int64_t> next_lb_id_{0}; std::atomic<int64_t> next_lb_id_{0};

View File

@ -285,7 +285,7 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::SendReport(
Shutdown(std::move(self), "SendReport"); Shutdown(std::move(self), "SendReport");
return; return;
} }
grpc::lb::v1::LoadReportResponse response; ::grpc::lb::v1::LoadReportResponse response;
auto loads = load_reporter_->GenerateLoads(load_balanced_hostname_, lb_id_); auto loads = load_reporter_->GenerateLoads(load_balanced_hostname_, lb_id_);
response.mutable_load()->Swap(&loads); response.mutable_load()->Swap(&loads);
auto feedback = load_reporter_->GenerateLoadBalancingFeedback(); auto feedback = load_reporter_->GenerateLoadBalancingFeedback();
@ -294,7 +294,7 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::SendReport(
auto initial_response = response.mutable_initial_response(); auto initial_response = response.mutable_initial_response();
initial_response->set_load_balancer_id(lb_id_); initial_response->set_load_balancer_id(lb_id_);
initial_response->set_implementation_id( initial_response->set_implementation_id(
grpc::lb::v1::InitialLoadReportResponse::CPP); ::grpc::lb::v1::InitialLoadReportResponse::CPP);
initial_response->set_server_version(kVersion); initial_response->set_server_version(kVersion);
call_status_ = INITIAL_RESPONSE_SENT; call_status_ = INITIAL_RESPONSE_SENT;
} }

View File

@ -142,14 +142,14 @@ class LoadReporterAsyncServiceImpl
// The data for RPC communication with the load reportee. // The data for RPC communication with the load reportee.
ServerContext ctx_; ServerContext ctx_;
grpc::lb::v1::LoadReportRequest request_; ::grpc::lb::v1::LoadReportRequest request_;
// The members passed down from LoadReporterAsyncServiceImpl. // The members passed down from LoadReporterAsyncServiceImpl.
ServerCompletionQueue* cq_; ServerCompletionQueue* cq_;
LoadReporterAsyncServiceImpl* service_; LoadReporterAsyncServiceImpl* service_;
LoadReporter* load_reporter_; LoadReporter* load_reporter_;
ServerAsyncReaderWriter<::grpc::lb::v1::LoadReportResponse, ServerAsyncReaderWriter<::grpc::lb::v1::LoadReportResponse,
grpc::lb::v1::LoadReportRequest> ::grpc::lb::v1::LoadReportRequest>
stream_; stream_;
// The status of the RPC progress. // The status of the RPC progress.

View File

@ -27,7 +27,7 @@ namespace load_reporter {
namespace experimental { namespace experimental {
void LoadReportingServiceServerBuilderOption::UpdateArguments( void LoadReportingServiceServerBuilderOption::UpdateArguments(
grpc::ChannelArguments* args) { ::grpc::ChannelArguments* args) {
args->SetInt(GRPC_ARG_ENABLE_LOAD_REPORTING, true); args->SetInt(GRPC_ARG_ENABLE_LOAD_REPORTING, true);
} }

View File

@ -48,7 +48,7 @@ class ServerContextBase::CompletionOp final
// initial refs: one in the server context, one in the cq // initial refs: one in the server context, one in the cq
// must ref the call before calling constructor and after deleting this // must ref the call before calling constructor and after deleting this
CompletionOp(internal::Call* call, CompletionOp(internal::Call* call,
grpc::internal::ServerCallbackCall* callback_controller) ::grpc::internal::ServerCallbackCall* callback_controller)
: call_(*call), : call_(*call),
callback_controller_(callback_controller), callback_controller_(callback_controller),
has_tag_(false), has_tag_(false),
@ -141,7 +141,7 @@ class ServerContextBase::CompletionOp final
} }
internal::Call call_; internal::Call call_;
grpc::internal::ServerCallbackCall* const callback_controller_; ::grpc::internal::ServerCallbackCall* const callback_controller_;
bool has_tag_; bool has_tag_;
void* tag_; void* tag_;
void* core_cq_tag_; void* core_cq_tag_;
@ -275,7 +275,7 @@ ServerContextBase::CallWrapper::~CallWrapper() {
void ServerContextBase::BeginCompletionOp( void ServerContextBase::BeginCompletionOp(
internal::Call* call, std::function<void(bool)> callback, internal::Call* call, std::function<void(bool)> callback,
grpc::internal::ServerCallbackCall* callback_controller) { ::grpc::internal::ServerCallbackCall* callback_controller) {
GPR_ASSERT(!completion_op_); GPR_ASSERT(!completion_op_);
if (rpc_info_) { if (rpc_info_) {
rpc_info_->Ref(); rpc_info_->Ref();

View File

@ -51,7 +51,7 @@ void TryConnectAndDestroy(const char* fake_metadata_server_address) {
args.SetInt("grpc.testing.google_c2p_resolver_pretend_running_on_gcp", 1); args.SetInt("grpc.testing.google_c2p_resolver_pretend_running_on_gcp", 1);
args.SetString("grpc.testing.google_c2p_resolver_metadata_server_override", args.SetString("grpc.testing.google_c2p_resolver_metadata_server_override",
fake_metadata_server_address); fake_metadata_server_address);
auto channel = grpc::CreateCustomChannel( auto channel = ::grpc::CreateCustomChannel(
target, grpc::InsecureChannelCredentials(), args); target, grpc::InsecureChannelCredentials(), args);
// Start connecting, and give some time for the google-c2p resolver to begin // Start connecting, and give some time for the google-c2p resolver to begin
// resolution and start trying to contact the metadata server. // resolution and start trying to contact the metadata server.

View File

@ -29,7 +29,7 @@ static ConfigBuilderFunction g_mock_builder;
} // namespace testing } // namespace testing
void BuildCoreConfiguration(CoreConfiguration::Builder* builder) { void BuildCoreConfiguration(CoreConfiguration::Builder* builder) {
testing::g_mock_builder(builder); ::grpc_core::testing::g_mock_builder(builder);
} }
namespace testing { namespace testing {

View File

@ -110,7 +110,7 @@ class TlsSecurityConnectorTest : public ::testing::Test {
HostNameCertificateVerifier hostname_certificate_verifier_; HostNameCertificateVerifier hostname_certificate_verifier_;
}; };
class TlsTestCertificateProvider : public grpc_tls_certificate_provider { class TlsTestCertificateProvider : public ::grpc_tls_certificate_provider {
public: public:
explicit TlsTestCertificateProvider( explicit TlsTestCertificateProvider(
RefCountedPtr<grpc_tls_certificate_distributor> distributor) RefCountedPtr<grpc_tls_certificate_distributor> distributor)

View File

@ -368,7 +368,7 @@ int main(int argc, char** argv) {
// are capable of sending and receiving even in the case that we don't have an // are capable of sending and receiving even in the case that we don't have an
// active RPC operation on the fd. // active RPC operation on the fd.
GPR_GLOBAL_CONFIG_SET(grpc_client_channel_backup_poll_interval_ms, 1); GPR_GLOBAL_CONFIG_SET(grpc_client_channel_backup_poll_interval_ms, 1);
grpc_core::chttp2::g_test_only_transport_flow_control_window_check = true; ::grpc_core::chttp2::g_test_only_transport_flow_control_window_check = true;
g_target_initial_window_size_mocker = new TransportTargetWindowSizeMocker(); g_target_initial_window_size_mocker = new TransportTargetWindowSizeMocker();
grpc_core::chttp2::g_test_only_transport_target_window_estimates_mocker = grpc_core::chttp2::g_test_only_transport_target_window_estimates_mocker =
g_target_initial_window_size_mocker; g_target_initial_window_size_mocker;

View File

@ -114,7 +114,7 @@ class FakeContainer {
void Set(IntptrTrait, intptr_t x) { SetIntptr(x); } void Set(IntptrTrait, intptr_t x) { SetIntptr(x); }
void Set(StringTrait, std::string x) { SetString(x); } void Set(StringTrait, std::string x) { SetString(x); }
void Set(const ParsedMetadata<FakeContainer>& metadata) { void Set(const ::grpc_core::ParsedMetadata<FakeContainer>& metadata) {
metadata.SetOnContainer(this); metadata.SetOnContainer(this);
} }

View File

@ -281,8 +281,8 @@ class ClientChannelStressTest {
response_generator_.get()); response_generator_.get());
std::ostringstream uri; std::ostringstream uri;
uri << "fake:///servername_not_used"; uri << "fake:///servername_not_used";
channel_ = grpc::CreateCustomChannel(uri.str(), channel_ = ::grpc::CreateCustomChannel(uri.str(),
InsecureChannelCredentials(), args); InsecureChannelCredentials(), args);
stub_ = grpc::testing::EchoTestService::NewStub(channel_); stub_ = grpc::testing::EchoTestService::NewStub(channel_);
} }

View File

@ -85,7 +85,7 @@ void TryConnectAndDestroy() {
grpc_test_slowdown_factor() * 100); grpc_test_slowdown_factor() * 100);
std::ostringstream uri; std::ostringstream uri;
uri << "fake:///servername_not_used"; uri << "fake:///servername_not_used";
auto channel = grpc::CreateCustomChannel( auto channel = ::grpc::CreateCustomChannel(
uri.str(), grpc::InsecureChannelCredentials(), args); uri.str(), grpc::InsecureChannelCredentials(), args);
// Start connecting, and give some time for the TCP connection attempt to the // Start connecting, and give some time for the TCP connection attempt to the
// unreachable balancer to begin. The connection should never become ready // unreachable balancer to begin. The connection should never become ready

View File

@ -41,7 +41,7 @@ class AdminServicesTest : public ::testing::Test {
grpc::reflection::InitProtoReflectionServerBuilderPlugin(); grpc::reflection::InitProtoReflectionServerBuilderPlugin();
ServerBuilder builder; ServerBuilder builder;
builder.AddListeningPort(address, InsecureServerCredentials()); builder.AddListeningPort(address, InsecureServerCredentials());
grpc::AddAdminServices(&builder); ::grpc::AddAdminServices(&builder);
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();
// Create channel // Create channel
auto reflection_stub = reflection::v1alpha::ServerReflection::NewStub( auto reflection_stub = reflection::v1alpha::ServerReflection::NewStub(

View File

@ -211,7 +211,7 @@ bool plugin_has_sync_methods(std::unique_ptr<ServerBuilderPlugin>& plugin) {
// the server. If there are sync services, UnimplementedRpc test will triger // the server. If there are sync services, UnimplementedRpc test will triger
// the sync unknown rpc routine on the server side, rather than the async one // the sync unknown rpc routine on the server side, rather than the async one
// that needs to be tested here. // that needs to be tested here.
class ServerBuilderSyncPluginDisabler : public grpc::ServerBuilderOption { class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption {
public: public:
void UpdateArguments(ChannelArguments* /*arg*/) override {} void UpdateArguments(ChannelArguments* /*arg*/) override {}
@ -303,8 +303,8 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
auto channel_creds = GetCredentialsProvider()->GetChannelCredentials( auto channel_creds = GetCredentialsProvider()->GetChannelCredentials(
GetParam().credentials_type, &args); GetParam().credentials_type, &args);
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =
!(GetParam().inproc) ? grpc::CreateCustomChannel(server_address_.str(), !(GetParam().inproc) ? ::grpc::CreateCustomChannel(
channel_creds, args) server_address_.str(), channel_creds, args)
: server_->InProcessChannel(args); : server_->InProcessChannel(args);
stub_ = grpc::testing::EchoTestService::NewStub(channel); stub_ = grpc::testing::EchoTestService::NewStub(channel);
} }
@ -1311,8 +1311,8 @@ TEST_P(AsyncEnd2endTest, UnimplementedRpc) {
const auto& channel_creds = GetCredentialsProvider()->GetChannelCredentials( const auto& channel_creds = GetCredentialsProvider()->GetChannelCredentials(
GetParam().credentials_type, &args); GetParam().credentials_type, &args);
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =
!(GetParam().inproc) ? grpc::CreateCustomChannel(server_address_.str(), !(GetParam().inproc) ? ::grpc::CreateCustomChannel(server_address_.str(),
channel_creds, args) channel_creds, args)
: server_->InProcessChannel(args); : server_->InProcessChannel(args);
std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub; std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub;
stub = grpc::testing::UnimplementedEchoService::NewStub(channel); stub = grpc::testing::UnimplementedEchoService::NewStub(channel);
@ -1491,7 +1491,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
cli_stream->Finish(&recv_status, tag(10)); cli_stream->Finish(&recv_status, tag(10));
Verifier().Expect(10, true).Verify(&cli_cq); Verifier().Expect(10, true).Verify(&cli_cq);
EXPECT_FALSE(recv_status.ok()); EXPECT_FALSE(recv_status.ok());
EXPECT_EQ(grpc::StatusCode::CANCELLED, recv_status.error_code()); EXPECT_EQ(::grpc::StatusCode::CANCELLED, recv_status.error_code());
cli_cq.Shutdown(); cli_cq.Shutdown();
void* phony_tag; void* phony_tag;
@ -1640,7 +1640,7 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
cli_stream->Finish(&recv_status, tag(10)); cli_stream->Finish(&recv_status, tag(10));
Verifier().Expect(10, true).Verify(&cli_cq); Verifier().Expect(10, true).Verify(&cli_cq);
EXPECT_FALSE(recv_status.ok()); EXPECT_FALSE(recv_status.ok());
EXPECT_EQ(grpc::StatusCode::CANCELLED, recv_status.error_code()); EXPECT_EQ(::grpc::StatusCode::CANCELLED, recv_status.error_code());
cli_cq.Shutdown(); cli_cq.Shutdown();
void* phony_tag; void* phony_tag;

View File

@ -77,7 +77,7 @@ bool ValidateAddress(const Address& address) {
// Proxy service supports N backends. Sends RPC to backend dictated by // Proxy service supports N backends. Sends RPC to backend dictated by
// request->backend_channel_idx(). // request->backend_channel_idx().
class Proxy : public grpc::testing::EchoTestService::Service { class Proxy : public ::grpc::testing::EchoTestService::Service {
public: public:
Proxy() {} Proxy() {}
@ -197,7 +197,7 @@ class ChannelzServerTest : public ::testing::TestWithParam<CredentialsType> {
} }
void SetUp() override { void SetUp() override {
// ensure channel server is brought up on all severs we build. // ensure channel server is brought up on all severs we build.
grpc::channelz::experimental::InitChannelzService(); ::grpc::channelz::experimental::InitChannelzService();
// We set up a proxy server with channelz enabled. // We set up a proxy server with channelz enabled.
proxy_port_ = grpc_pick_unused_port_or_die(); proxy_port_ = grpc_pick_unused_port_or_die();
@ -235,7 +235,7 @@ class ChannelzServerTest : public ::testing::TestWithParam<CredentialsType> {
ChannelArguments args; ChannelArguments args;
args.SetInt(GRPC_ARG_ENABLE_CHANNELZ, 1); args.SetInt(GRPC_ARG_ENABLE_CHANNELZ, 1);
args.SetInt(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE, 1024); args.SetInt(GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE, 1024);
std::shared_ptr<Channel> channel_to_backend = grpc::CreateCustomChannel( std::shared_ptr<Channel> channel_to_backend = ::grpc::CreateCustomChannel(
backend_server_address, GetChannelCredentials(GetParam(), &args), backend_server_address, GetChannelCredentials(GetParam(), &args),
args); args);
proxy_service_.AddChannelToBackend(channel_to_backend); proxy_service_.AddChannelToBackend(channel_to_backend);
@ -247,7 +247,7 @@ class ChannelzServerTest : public ::testing::TestWithParam<CredentialsType> {
ChannelArguments args; ChannelArguments args;
// disable channelz. We only want to focus on proxy to backend outbound. // disable channelz. We only want to focus on proxy to backend outbound.
args.SetInt(GRPC_ARG_ENABLE_CHANNELZ, 0); args.SetInt(GRPC_ARG_ENABLE_CHANNELZ, 0);
std::shared_ptr<Channel> channel = grpc::CreateCustomChannel( std::shared_ptr<Channel> channel = ::grpc::CreateCustomChannel(
target, GetChannelCredentials(GetParam(), &args), args); target, GetChannelCredentials(GetParam(), &args), args);
channelz_stub_ = grpc::channelz::v1::Channelz::NewStub(channel); channelz_stub_ = grpc::channelz::v1::Channelz::NewStub(channel);
echo_stub_ = grpc::testing::EchoTestService::NewStub(channel); echo_stub_ = grpc::testing::EchoTestService::NewStub(channel);
@ -260,7 +260,7 @@ class ChannelzServerTest : public ::testing::TestWithParam<CredentialsType> {
args.SetInt(GRPC_ARG_ENABLE_CHANNELZ, 0); args.SetInt(GRPC_ARG_ENABLE_CHANNELZ, 0);
// This ensures that gRPC will not do connection sharing. // This ensures that gRPC will not do connection sharing.
args.SetInt(GRPC_ARG_USE_LOCAL_SUBCHANNEL_POOL, true); args.SetInt(GRPC_ARG_USE_LOCAL_SUBCHANNEL_POOL, true);
std::shared_ptr<Channel> channel = grpc::CreateCustomChannel( std::shared_ptr<Channel> channel = ::grpc::CreateCustomChannel(
target, GetChannelCredentials(GetParam(), &args), args); target, GetChannelCredentials(GetParam(), &args), args);
return grpc::testing::EchoTestService::NewStub(channel); return grpc::testing::EchoTestService::NewStub(channel);
} }

View File

@ -133,8 +133,8 @@ class ClientCallbackEnd2endTest
switch (GetParam().protocol) { switch (GetParam().protocol) {
case Protocol::TCP: case Protocol::TCP:
if (!GetParam().use_interceptors) { if (!GetParam().use_interceptors) {
channel_ = grpc::CreateCustomChannel(server_address_.str(), channel_ = ::grpc::CreateCustomChannel(server_address_.str(),
channel_creds, args); channel_creds, args);
} else { } else {
channel_ = CreateCustomChannelWithInterceptors( channel_ = CreateCustomChannelWithInterceptors(
server_address_.str(), channel_creds, args, server_address_.str(), channel_creds, args,
@ -1372,8 +1372,8 @@ TEST_P(ClientCallbackEnd2endTest, UnimplementedRpc) {
GetParam().credentials_type, &args); GetParam().credentials_type, &args);
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =
(GetParam().protocol == Protocol::TCP) (GetParam().protocol == Protocol::TCP)
? grpc::CreateCustomChannel(server_address_.str(), channel_creds, ? ::grpc::CreateCustomChannel(server_address_.str(), channel_creds,
args) args)
: server_->InProcessChannel(args); : server_->InProcessChannel(args);
std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub; std::unique_ptr<grpc::testing::UnimplementedEchoService::Stub> stub;
stub = grpc::testing::UnimplementedEchoService::NewStub(channel); stub = grpc::testing::UnimplementedEchoService::NewStub(channel);

View File

@ -38,7 +38,7 @@ using grpc::testing::EchoResponse;
namespace grpc { namespace grpc {
namespace testing { namespace testing {
class ServiceImpl final : public grpc::testing::EchoTestService::Service { class ServiceImpl final : public ::grpc::testing::EchoTestService::Service {
Status BidiStream( Status BidiStream(
ServerContext* /*context*/, ServerContext* /*context*/,
ServerReaderWriter<EchoResponse, EchoRequest>* stream) override { ServerReaderWriter<EchoResponse, EchoRequest>* stream) override {

View File

@ -307,7 +307,7 @@ class ClientLbEnd2endTest : public ::testing::Test {
} // else, default to pick first } // else, default to pick first
args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR, args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
response_generator.Get()); response_generator.Get());
return grpc::CreateCustomChannel("fake:///", creds_, args); return ::grpc::CreateCustomChannel("fake:///", creds_, args);
} }
bool SendRpc( bool SendRpc(

View File

@ -111,8 +111,8 @@ class ContextAllocatorEnd2endTestBase
GetParam().credentials_type, &args); GetParam().credentials_type, &args);
switch (GetParam().protocol) { switch (GetParam().protocol) {
case Protocol::TCP: case Protocol::TCP:
channel_ = grpc::CreateCustomChannel(server_address_.str(), channel_ = ::grpc::CreateCustomChannel(server_address_.str(),
channel_creds, args); channel_creds, args);
break; break;
case Protocol::INPROC: case Protocol::INPROC:
channel_ = server_->InProcessChannel(args); channel_ = server_->InProcessChannel(args);

View File

@ -247,7 +247,7 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor {
const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll"; const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll";
const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity"; const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity";
class Proxy : public grpc::testing::EchoTestService::Service { class Proxy : public ::grpc::testing::EchoTestService::Service {
public: public:
explicit Proxy(const std::shared_ptr<Channel>& channel) explicit Proxy(const std::shared_ptr<Channel>& channel)
: stub_(grpc::testing::EchoTestService::NewStub(channel)) {} : stub_(grpc::testing::EchoTestService::NewStub(channel)) {}
@ -264,7 +264,7 @@ class Proxy : public grpc::testing::EchoTestService::Service {
}; };
class TestServiceImplDupPkg class TestServiceImplDupPkg
: public grpc::testing::duplicate::EchoTestService::Service { : public ::grpc::testing::duplicate::EchoTestService::Service {
public: public:
Status Echo(ServerContext* /*context*/, const EchoRequest* /*request*/, Status Echo(ServerContext* /*context*/, const EchoRequest* /*request*/,
EchoResponse* response) override { EchoResponse* response) override {
@ -403,8 +403,8 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
if (!GetParam().inproc) { if (!GetParam().inproc) {
if (!GetParam().use_interceptors) { if (!GetParam().use_interceptors) {
channel_ = grpc::CreateCustomChannel(server_address_.str(), channel_ = ::grpc::CreateCustomChannel(server_address_.str(),
channel_creds, args); channel_creds, args);
} else { } else {
channel_ = CreateCustomChannelWithInterceptors( channel_ = CreateCustomChannelWithInterceptors(
server_address_.str(), channel_creds, args, server_address_.str(), channel_creds, args,

View File

@ -38,7 +38,7 @@ namespace testing {
const char* kErrorMessage = "This service caused an exception"; const char* kErrorMessage = "This service caused an exception";
#if GRPC_ALLOW_EXCEPTIONS #if GRPC_ALLOW_EXCEPTIONS
class ExceptingServiceImpl : public grpc::testing::EchoTestService::Service { class ExceptingServiceImpl : public ::grpc::testing::EchoTestService::Service {
public: public:
Status Echo(ServerContext* /*server_context*/, const EchoRequest* /*request*/, Status Echo(ServerContext* /*server_context*/, const EchoRequest* /*request*/,
EchoResponse* /*response*/) override { EchoResponse* /*response*/) override {

View File

@ -229,7 +229,7 @@ class GenericEnd2endTest : public ::testing::Test {
switch (event) { switch (event) {
case Event::kCallReceived: case Event::kCallReceived:
reader_writer.Finish( reader_writer.Finish(
grpc::Status(grpc::StatusCode::UNIMPLEMENTED, "go away"), ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "go away"),
reinterpret_cast<void*>(Event::kResponseSent)); reinterpret_cast<void*>(Event::kResponseSent));
break; break;

View File

@ -126,7 +126,7 @@ class GrpcAuthzEnd2EndTest : public ::testing::Test {
ChannelArguments args; ChannelArguments args;
// Override target name for host name check // Override target name for host name check
args.SetSslTargetNameOverride("foo.test.google.fr"); args.SetSslTargetNameOverride("foo.test.google.fr");
return grpc::CreateCustomChannel(server_address_, channel_creds_, args); return ::grpc::CreateCustomChannel(server_address_, channel_creds_, args);
} }
grpc::Status SendRpc(const std::shared_ptr<Channel>& channel, grpc::Status SendRpc(const std::shared_ptr<Channel>& channel,

View File

@ -430,7 +430,7 @@ class GrpclbEnd2endTest : public ::testing::Test {
channel_creds, call_creds, nullptr))); channel_creds, call_creds, nullptr)));
call_creds->Unref(); call_creds->Unref();
channel_creds->Unref(); channel_creds->Unref();
channel_ = grpc::CreateCustomChannel(uri.str(), creds, args); channel_ = ::grpc::CreateCustomChannel(uri.str(), creds, args);
stub_ = grpc::testing::EchoTestService::NewStub(channel_); stub_ = grpc::testing::EchoTestService::NewStub(channel_);
} }

View File

@ -217,7 +217,7 @@ void HandleGenericCall(AsyncGenericService* service,
} }
class TestServiceImplDupPkg class TestServiceImplDupPkg
: public grpc::testing::duplicate::EchoTestService::Service { : public ::grpc::testing::duplicate::EchoTestService::Service {
public: public:
Status Echo(ServerContext* /*context*/, const EchoRequest* request, Status Echo(ServerContext* /*context*/, const EchoRequest* request,
EchoResponse* response) override { EchoResponse* response) override {
@ -245,7 +245,7 @@ class HybridEnd2endTest : public ::testing::TestWithParam<bool> {
: false; : false;
} }
bool SetUpServer(grpc::Service* service1, grpc::Service* service2, bool SetUpServer(::grpc::Service* service1, ::grpc::Service* service2,
AsyncGenericService* generic_service, AsyncGenericService* generic_service,
CallbackGenericService* callback_generic_service, CallbackGenericService* callback_generic_service,
int max_message_size = 0) { int max_message_size = 0) {

View File

@ -136,8 +136,8 @@ class MessageAllocatorEnd2endTestBase
GetParam().credentials_type, &args); GetParam().credentials_type, &args);
switch (GetParam().protocol) { switch (GetParam().protocol) {
case Protocol::TCP: case Protocol::TCP:
channel_ = grpc::CreateCustomChannel(server_address_.str(), channel_ = ::grpc::CreateCustomChannel(server_address_.str(),
channel_creds, args); channel_creds, args);
break; break;
case Protocol::INPROC: case Protocol::INPROC:
channel_ = server_->InProcessChannel(args); channel_ = server_->InProcessChannel(args);

View File

@ -196,7 +196,7 @@ TEST_F(MockCallbackTest, MockedCallSucceedsWithWait) {
grpc::internal::CondVar cv; grpc::internal::CondVar cv;
absl::optional<grpc::Status> ABSL_GUARDED_BY(mu) status; absl::optional<grpc::Status> ABSL_GUARDED_BY(mu) status;
} status; } status;
DefaultReactorTestPeer peer(&ctx, [&](grpc::Status s) { DefaultReactorTestPeer peer(&ctx, [&](::grpc::Status s) {
grpc::internal::MutexLock l(&status.mu); grpc::internal::MutexLock l(&status.mu);
status.status = std::move(s); status.status = std::move(s);
status.cv.Signal(); status.cv.Signal();

View File

@ -143,21 +143,21 @@ class RawEnd2EndTest : public ::testing::Test {
// For the client application to populate and send to server. // For the client application to populate and send to server.
EchoRequest send_request_; EchoRequest send_request_;
grpc::ByteBuffer send_request_buffer_; ::grpc::ByteBuffer send_request_buffer_;
// For the server to give to gRPC to be populated by incoming request // For the server to give to gRPC to be populated by incoming request
// from client. // from client.
EchoRequest recv_request_; EchoRequest recv_request_;
grpc::ByteBuffer recv_request_buffer_; ::grpc::ByteBuffer recv_request_buffer_;
// For the server application to populate and send back to client. // For the server application to populate and send back to client.
EchoResponse send_response_; EchoResponse send_response_;
grpc::ByteBuffer send_response_buffer_; ::grpc::ByteBuffer send_response_buffer_;
// For the client to give to gRPC to be populated by incoming response // For the client to give to gRPC to be populated by incoming response
// from server. // from server.
EchoResponse recv_response_; EchoResponse recv_response_;
grpc::ByteBuffer recv_response_buffer_; ::grpc::ByteBuffer recv_response_buffer_;
Status recv_status_; Status recv_status_;
// Both sides need contexts // Both sides need contexts

View File

@ -90,9 +90,9 @@ using RlsService =
class RlsServiceImpl : public RlsService { class RlsServiceImpl : public RlsService {
public: public:
grpc::Status RouteLookup(grpc::ServerContext* context, ::grpc::Status RouteLookup(::grpc::ServerContext* context,
const RouteLookupRequest* request, const RouteLookupRequest* request,
RouteLookupResponse* response) override { RouteLookupResponse* response) override {
gpr_log(GPR_INFO, "RLS: Received request: %s", gpr_log(GPR_INFO, "RLS: Received request: %s",
request->DebugString().c_str()); request->DebugString().c_str());
// RLS server should see call creds. // RLS server should see call creds.
@ -289,7 +289,7 @@ class RlsEnd2endTest : public ::testing::Test {
nullptr)); nullptr));
call_creds->Unref(); call_creds->Unref();
channel_creds->Unref(); channel_creds->Unref();
channel_ = grpc::CreateCustomChannel( channel_ = ::grpc::CreateCustomChannel(
absl::StrCat("fake:///", kServerName).c_str(), std::move(creds), args); absl::StrCat("fake:///", kServerName).c_str(), std::move(creds), args);
stub_ = grpc::testing::EchoTestService::NewStub(channel_); stub_ = grpc::testing::EchoTestService::NewStub(channel_);
} }

View File

@ -126,7 +126,7 @@ std::unique_ptr<ServerBuilderPlugin> CreateTestServerBuilderPlugin() {
// Force AddServerBuilderPlugin() to be called at static initialization time. // Force AddServerBuilderPlugin() to be called at static initialization time.
struct StaticTestPluginInitializer { struct StaticTestPluginInitializer {
StaticTestPluginInitializer() { StaticTestPluginInitializer() {
grpc::ServerBuilder::InternalAddPluginFactory( ::grpc::ServerBuilder::InternalAddPluginFactory(
&CreateTestServerBuilderPlugin); &CreateTestServerBuilderPlugin);
} }
} static_plugin_initializer_test_; } static_plugin_initializer_test_;

View File

@ -46,7 +46,7 @@ namespace testing {
namespace { namespace {
class ServiceImpl final : public grpc::testing::EchoTestService::Service { class ServiceImpl final : public ::grpc::testing::EchoTestService::Service {
public: public:
ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {} ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {}

View File

@ -44,7 +44,7 @@ const char kServerReturnStatusCode[] = "server_return_status_code";
const char kServerDelayBeforeReturnUs[] = "server_delay_before_return_us"; const char kServerDelayBeforeReturnUs[] = "server_delay_before_return_us";
const char kServerReturnAfterNReads[] = "server_return_after_n_reads"; const char kServerReturnAfterNReads[] = "server_return_after_n_reads";
class TestServiceImpl : public grpc::testing::EchoTestService::Service { class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public: public:
// Unused methods are not implemented. // Unused methods are not implemented.

View File

@ -61,7 +61,7 @@ class EchoTestServiceImpl : public EchoTestService::Service {
return Status(StatusCode::FAILED_PRECONDITION, "Client error requested"); return Status(StatusCode::FAILED_PRECONDITION, "Client error requested");
} }
response->set_message(request->message()); response->set_message(request->message());
grpc::load_reporter::experimental::AddLoadReportingCost( ::grpc::load_reporter::experimental::AddLoadReportingCost(
context, kMetricName, kMetricValue); context, kMetricName, kMetricValue);
return Status::OK; return Status::OK;
} }
@ -77,7 +77,7 @@ class ServerLoadReportingEnd2endTest : public ::testing::Test {
.AddListeningPort(server_address_, InsecureServerCredentials()) .AddListeningPort(server_address_, InsecureServerCredentials())
.RegisterService(&echo_service_) .RegisterService(&echo_service_)
.SetOption(std::unique_ptr<::grpc::ServerBuilderOption>( .SetOption(std::unique_ptr<::grpc::ServerBuilderOption>(
new grpc::load_reporter::experimental:: new ::grpc::load_reporter::experimental::
LoadReportingServiceServerBuilderOption())) LoadReportingServiceServerBuilderOption()))
.BuildAndStart(); .BuildAndStart();
server_thread_ = server_thread_ =
@ -125,10 +125,10 @@ TEST_F(ServerLoadReportingEnd2endTest, NoCall) {}
TEST_F(ServerLoadReportingEnd2endTest, BasicReport) { TEST_F(ServerLoadReportingEnd2endTest, BasicReport) {
auto channel = auto channel =
grpc::CreateChannel(server_address_, InsecureChannelCredentials()); grpc::CreateChannel(server_address_, InsecureChannelCredentials());
auto stub = grpc::lb::v1::LoadReporter::NewStub(channel); auto stub = ::grpc::lb::v1::LoadReporter::NewStub(channel);
ClientContext ctx; ClientContext ctx;
auto stream = stub->ReportLoad(&ctx); auto stream = stub->ReportLoad(&ctx);
grpc::lb::v1::LoadReportRequest request; ::grpc::lb::v1::LoadReportRequest request;
request.mutable_initial_request()->set_load_balanced_hostname( request.mutable_initial_request()->set_load_balanced_hostname(
server_address_); server_address_);
request.mutable_initial_request()->set_load_key("LOAD_KEY"); request.mutable_initial_request()->set_load_key("LOAD_KEY");
@ -137,7 +137,7 @@ TEST_F(ServerLoadReportingEnd2endTest, BasicReport) {
->set_seconds(5); ->set_seconds(5);
stream->Write(request); stream->Write(request);
gpr_log(GPR_INFO, "Initial request sent."); gpr_log(GPR_INFO, "Initial request sent.");
grpc::lb::v1::LoadReportResponse response; ::grpc::lb::v1::LoadReportResponse response;
stream->Read(&response); stream->Read(&response);
const std::string& lb_id = response.initial_response().load_balancer_id(); const std::string& lb_id = response.initial_response().load_balancer_id();
gpr_log(GPR_INFO, "Initial response received (lb_id: %s).", lb_id.c_str()); gpr_log(GPR_INFO, "Initial response received (lb_id: %s).", lb_id.c_str());

View File

@ -243,7 +243,7 @@ class ServiceConfigEnd2endTest : public ::testing::Test {
ChannelArguments args; ChannelArguments args;
args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR, args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
response_generator_.get()); response_generator_.get());
return grpc::CreateCustomChannel("fake:///", creds_, args); return ::grpc::CreateCustomChannel("fake:///", creds_, args);
} }
std::shared_ptr<Channel> BuildChannelWithDefaultServiceConfig() { std::shared_ptr<Channel> BuildChannelWithDefaultServiceConfig() {
@ -254,7 +254,7 @@ class ServiceConfigEnd2endTest : public ::testing::Test {
args.SetServiceConfigJSON(ValidDefaultServiceConfig()); args.SetServiceConfigJSON(ValidDefaultServiceConfig());
args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR, args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
response_generator_.get()); response_generator_.get());
return grpc::CreateCustomChannel("fake:///", creds_, args); return ::grpc::CreateCustomChannel("fake:///", creds_, args);
} }
std::shared_ptr<Channel> BuildChannelWithInvalidDefaultServiceConfig() { std::shared_ptr<Channel> BuildChannelWithInvalidDefaultServiceConfig() {
@ -265,7 +265,7 @@ class ServiceConfigEnd2endTest : public ::testing::Test {
args.SetServiceConfigJSON(InvalidDefaultServiceConfig()); args.SetServiceConfigJSON(InvalidDefaultServiceConfig());
args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR, args.SetPointer(GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
response_generator_.get()); response_generator_.get());
return grpc::CreateCustomChannel("fake:///", creds_, args); return ::grpc::CreateCustomChannel("fake:///", creds_, args);
} }
bool SendRpc( bool SendRpc(

View File

@ -42,7 +42,7 @@ using grpc::testing::EchoResponse;
namespace grpc { namespace grpc {
namespace testing { namespace testing {
class TestServiceImpl : public grpc::testing::EchoTestService::Service { class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public: public:
explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {} explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {}
@ -86,7 +86,7 @@ class ShutdownTest : public ::testing::TestWithParam<string> {
ChannelArguments args; ChannelArguments args;
auto channel_creds = auto channel_creds =
GetCredentialsProvider()->GetChannelCredentials(GetParam(), &args); GetCredentialsProvider()->GetChannelCredentials(GetParam(), &args);
channel_ = grpc::CreateCustomChannel(target, channel_creds, args); channel_ = ::grpc::CreateCustomChannel(target, channel_creds, args);
stub_ = grpc::testing::EchoTestService::NewStub(channel_); stub_ = grpc::testing::EchoTestService::NewStub(channel_);
} }

View File

@ -85,7 +85,7 @@ const char* kLargeString =
namespace grpc { namespace grpc {
namespace testing { namespace testing {
class TestServiceImpl : public grpc::testing::EchoTestService::Service { class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public: public:
static void BidiStream_Sender( static void BidiStream_Sender(
ServerReaderWriter<EchoResponse, EchoRequest>* stream, ServerReaderWriter<EchoResponse, EchoRequest>* stream,

View File

@ -40,7 +40,7 @@ Status HealthCheckServiceImpl::Check(ServerContext* /*context*/,
Status HealthCheckServiceImpl::Watch( Status HealthCheckServiceImpl::Watch(
ServerContext* context, const HealthCheckRequest* request, ServerContext* context, const HealthCheckRequest* request,
grpc::ServerWriter<HealthCheckResponse>* writer) { ::grpc::ServerWriter<HealthCheckResponse>* writer) {
auto last_state = HealthCheckResponse::UNKNOWN; auto last_state = HealthCheckResponse::UNKNOWN;
while (!context->IsCancelled()) { while (!context->IsCancelled()) {
{ {
@ -53,7 +53,7 @@ Status HealthCheckServiceImpl::Watch(
response.set_status(iter->second); response.set_status(iter->second);
} }
if (response.status() != last_state) { if (response.status() != last_state) {
writer->Write(response, grpc::WriteOptions()); writer->Write(response, ::grpc::WriteOptions());
last_state = response.status(); last_state = response.status();
} }
} }

View File

@ -128,7 +128,7 @@ void ServerTryCancelNonblocking(CallbackServerContext* context) {
ServerUnaryReactor* CallbackTestServiceImpl::Echo( ServerUnaryReactor* CallbackTestServiceImpl::Echo(
CallbackServerContext* context, const EchoRequest* request, CallbackServerContext* context, const EchoRequest* request,
EchoResponse* response) { EchoResponse* response) {
class Reactor : public grpc::ServerUnaryReactor { class Reactor : public ::grpc::ServerUnaryReactor {
public: public:
Reactor(CallbackTestServiceImpl* service, CallbackServerContext* ctx, Reactor(CallbackTestServiceImpl* service, CallbackServerContext* ctx,
const EchoRequest* request, EchoResponse* response) const EchoRequest* request, EchoResponse* response)
@ -323,7 +323,7 @@ ServerUnaryReactor* CallbackTestServiceImpl::Echo(
ServerUnaryReactor* CallbackTestServiceImpl::CheckClientInitialMetadata( ServerUnaryReactor* CallbackTestServiceImpl::CheckClientInitialMetadata(
CallbackServerContext* context, const SimpleRequest*, SimpleResponse*) { CallbackServerContext* context, const SimpleRequest*, SimpleResponse*) {
class Reactor : public grpc::ServerUnaryReactor { class Reactor : public ::grpc::ServerUnaryReactor {
public: public:
explicit Reactor(CallbackServerContext* ctx) { explicit Reactor(CallbackServerContext* ctx) {
EXPECT_EQ(internal::MetadataMatchCount(ctx->client_metadata(), EXPECT_EQ(internal::MetadataMatchCount(ctx->client_metadata(),
@ -358,7 +358,7 @@ ServerReadReactor<EchoRequest>* CallbackTestServiceImpl::RequestStream(
return nullptr; return nullptr;
} }
class Reactor : public grpc::ServerReadReactor<EchoRequest> { class Reactor : public ::grpc::ServerReadReactor<EchoRequest> {
public: public:
Reactor(CallbackServerContext* ctx, EchoResponse* response, Reactor(CallbackServerContext* ctx, EchoResponse* response,
int server_try_cancel) int server_try_cancel)
@ -441,7 +441,7 @@ ServerWriteReactor<EchoResponse>* CallbackTestServiceImpl::ResponseStream(
internal::ServerTryCancelNonblocking(context); internal::ServerTryCancelNonblocking(context);
} }
class Reactor : public grpc::ServerWriteReactor<EchoResponse> { class Reactor : public ::grpc::ServerWriteReactor<EchoResponse> {
public: public:
Reactor(CallbackServerContext* ctx, const EchoRequest* request, Reactor(CallbackServerContext* ctx, const EchoRequest* request,
int server_try_cancel) int server_try_cancel)
@ -528,7 +528,7 @@ ServerWriteReactor<EchoResponse>* CallbackTestServiceImpl::ResponseStream(
ServerBidiReactor<EchoRequest, EchoResponse>* ServerBidiReactor<EchoRequest, EchoResponse>*
CallbackTestServiceImpl::BidiStream(CallbackServerContext* context) { CallbackTestServiceImpl::BidiStream(CallbackServerContext* context) {
class Reactor : public grpc::ServerBidiReactor<EchoRequest, EchoResponse> { class Reactor : public ::grpc::ServerBidiReactor<EchoRequest, EchoResponse> {
public: public:
explicit Reactor(CallbackServerContext* ctx) : ctx_(ctx) { explicit Reactor(CallbackServerContext* ctx) : ctx_(ctx) {
// If 'server_try_cancel' is set in the metadata, the RPC is cancelled by // If 'server_try_cancel' is set in the metadata, the RPC is cancelled by

View File

@ -451,7 +451,7 @@ class TestMultipleServiceImpl : public RpcService {
}; };
class CallbackTestServiceImpl class CallbackTestServiceImpl
: public grpc::testing::EchoTestService::CallbackService { : public ::grpc::testing::EchoTestService::CallbackService {
public: public:
CallbackTestServiceImpl() : signal_client_(false), host_() {} CallbackTestServiceImpl() : signal_client_(false), host_() {}
explicit CallbackTestServiceImpl(const std::string& host) explicit CallbackTestServiceImpl(const std::string& host)

View File

@ -52,7 +52,7 @@ const int kNumRpcs = 1000; // Number of RPCs per thread
namespace grpc { namespace grpc {
namespace testing { namespace testing {
class TestServiceImpl : public grpc::testing::EchoTestService::Service { class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public: public:
TestServiceImpl() {} TestServiceImpl() {}
@ -256,7 +256,7 @@ class CommonStressTestAsyncServer : public BaseClass {
enum { READY, DONE } state; enum { READY, DONE } state;
}; };
std::vector<Context> contexts_; std::vector<Context> contexts_;
grpc::testing::EchoTestService::AsyncService service_; ::grpc::testing::EchoTestService::AsyncService service_;
std::unique_ptr<ServerCompletionQueue> cq_; std::unique_ptr<ServerCompletionQueue> cq_;
bool shutting_down_; bool shutting_down_;
grpc::internal::Mutex mu_; grpc::internal::Mutex mu_;

View File

@ -60,16 +60,16 @@ namespace testing {
namespace { namespace {
class EchoServer final : public EchoTestService::Service { class EchoServer final : public EchoTestService::Service {
grpc::Status Echo(grpc::ServerContext* /*context*/, ::grpc::Status Echo(::grpc::ServerContext* /*context*/,
const EchoRequest* request, const EchoRequest* request,
EchoResponse* response) override { EchoResponse* response) override {
if (request->param().expected_error().code() == 0) { if (request->param().expected_error().code() == 0) {
response->set_message(request->message()); response->set_message(request->message());
return grpc::Status::OK; return ::grpc::Status::OK;
} else { } else {
return grpc::Status(static_cast<::grpc::StatusCode>( return ::grpc::Status(static_cast<::grpc::StatusCode>(
request->param().expected_error().code()), request->param().expected_error().code()),
""); "");
} }
} }
}; };
@ -131,8 +131,8 @@ class TlsKeyLoggingEnd2EndTest : public ::testing::TestWithParam<TestScenario> {
} }
void SetUp() override { void SetUp() override {
grpc::ServerBuilder builder; ::grpc::ServerBuilder builder;
grpc::ChannelArguments args; ::grpc::ChannelArguments args;
args.SetSslTargetNameOverride("foo.test.google.com.au"); args.SetSslTargetNameOverride("foo.test.google.com.au");
if (GetParam().num_listening_ports() > 0) { if (GetParam().num_listening_ports() > 0) {
@ -179,7 +179,7 @@ class TlsKeyLoggingEnd2EndTest : public ::testing::TestWithParam<TestScenario> {
builder.AddListeningPort( builder.AddListeningPort(
"0.0.0.0:0", "0.0.0.0:0",
grpc::experimental::TlsServerCredentials(server_creds_options), ::grpc::experimental::TlsServerCredentials(server_creds_options),
&ports_[i]); &ports_[i]);
} }
@ -213,9 +213,9 @@ class TlsKeyLoggingEnd2EndTest : public ::testing::TestWithParam<TestScenario> {
tmp_stub_tls_key_log_file_[i]); tmp_stub_tls_key_log_file_[i]);
} }
stubs_.push_back(EchoTestService::NewStub(grpc::CreateCustomChannel( stubs_.push_back(EchoTestService::NewStub(::grpc::CreateCustomChannel(
server_addresses_[i], server_addresses_[i],
grpc::experimental::TlsCredentials(channel_creds_options), args))); ::grpc::experimental::TlsCredentials(channel_creds_options), args)));
} }
} }
@ -256,16 +256,16 @@ TEST_P(TlsKeyLoggingEnd2EndTest, KeyLogging) {
request.set_message("foo"); request.set_message("foo");
request.mutable_param()->mutable_expected_error()->set_code(0); request.mutable_param()->mutable_expected_error()->set_code(0);
EchoResponse response; EchoResponse response;
grpc::ClientContext context; ::grpc::ClientContext context;
grpc::Status status = stubs_[j]->Echo(&context, request, &response); ::grpc::Status status = stubs_[j]->Echo(&context, request, &response);
EXPECT_TRUE(status.ok()); EXPECT_TRUE(status.ok());
} }
} }
for (int i = 0; i < GetParam().num_listening_ports(); i++) { for (int i = 0; i < GetParam().num_listening_ports(); i++) {
std::string server_key_log = grpc_core::testing::GetFileContents( std::string server_key_log = ::grpc_core::testing::GetFileContents(
tmp_server_tls_key_log_file_by_port_[i].c_str()); tmp_server_tls_key_log_file_by_port_[i].c_str());
std::string channel_key_log = grpc_core::testing::GetFileContents( std::string channel_key_log = ::grpc_core::testing::GetFileContents(
tmp_stub_tls_key_log_file_[i].c_str()); tmp_stub_tls_key_log_file_[i].c_str());
if (!GetParam().enable_tls_key_logging()) { if (!GetParam().enable_tls_key_logging()) {

View File

@ -939,7 +939,7 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
? XdsCredentials(CreateTlsFallbackCredentials()) ? XdsCredentials(CreateTlsFallbackCredentials())
: std::make_shared<SecureChannelCredentials>( : std::make_shared<SecureChannelCredentials>(
grpc_fake_transport_security_credentials_create()); grpc_fake_transport_security_credentials_create());
return grpc::CreateCustomChannel(uri, channel_creds, args); return ::grpc::CreateCustomChannel(uri, channel_creds, args);
} }
enum RpcService { enum RpcService {
@ -1686,7 +1686,8 @@ class XdsEnd2endTest : public ::testing::TestWithParam<TestType> {
XdsServingStatusNotifier* notifier() { return &notifier_; } XdsServingStatusNotifier* notifier() { return &notifier_; }
private: private:
class XdsChannelArgsServerBuilderOption : public grpc::ServerBuilderOption { class XdsChannelArgsServerBuilderOption
: public ::grpc::ServerBuilderOption {
public: public:
explicit XdsChannelArgsServerBuilderOption(XdsEnd2endTest* test_obj) explicit XdsChannelArgsServerBuilderOption(XdsEnd2endTest* test_obj)
: test_obj_(test_obj) {} : test_obj_(test_obj) {}

View File

@ -55,8 +55,9 @@ const auto TEST_TAG_VALUE = "my_value";
const char* kExpectedTraceIdKey = "expected_trace_id"; const char* kExpectedTraceIdKey = "expected_trace_id";
class EchoServer final : public EchoTestService::Service { class EchoServer final : public EchoTestService::Service {
grpc::Status Echo(grpc::ServerContext* context, const EchoRequest* request, ::grpc::Status Echo(::grpc::ServerContext* context,
EchoResponse* response) override { const EchoRequest* request,
EchoResponse* response) override {
for (const auto& metadata : context->client_metadata()) { for (const auto& metadata : context->client_metadata()) {
if (metadata.first == kExpectedTraceIdKey) { if (metadata.first == kExpectedTraceIdKey) {
EXPECT_EQ(metadata.second, reinterpret_cast<const grpc::CensusContext*>( EXPECT_EQ(metadata.second, reinterpret_cast<const grpc::CensusContext*>(
@ -70,11 +71,11 @@ class EchoServer final : public EchoTestService::Service {
} }
if (request->param().expected_error().code() == 0) { if (request->param().expected_error().code() == 0) {
response->set_message(request->message()); response->set_message(request->message());
return grpc::Status::OK; return ::grpc::Status::OK;
} else { } else {
return grpc::Status(static_cast<::grpc::StatusCode>( return ::grpc::Status(static_cast<::grpc::StatusCode>(
request->param().expected_error().code()), request->param().expected_error().code()),
""); "");
} }
} }
}; };
@ -86,10 +87,10 @@ class StatsPluginEnd2EndTest : public ::testing::Test {
void SetUp() override { void SetUp() override {
// Set up a synchronous server on a different thread to avoid the asynch // Set up a synchronous server on a different thread to avoid the asynch
// interface. // interface.
grpc::ServerBuilder builder; ::grpc::ServerBuilder builder;
int port; int port;
// Use IPv4 here because it's less flaky than IPv6 ("[::]:0") on Travis. // Use IPv4 here because it's less flaky than IPv6 ("[::]:0") on Travis.
builder.AddListeningPort("0.0.0.0:0", grpc::InsecureServerCredentials(), builder.AddListeningPort("0.0.0.0:0", ::grpc::InsecureServerCredentials(),
&port); &port);
builder.RegisterService(&service_); builder.RegisterService(&service_);
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();
@ -98,8 +99,8 @@ class StatsPluginEnd2EndTest : public ::testing::Test {
server_address_ = absl::StrCat("localhost:", port); server_address_ = absl::StrCat("localhost:", port);
server_thread_ = std::thread(&StatsPluginEnd2EndTest::RunServerLoop, this); server_thread_ = std::thread(&StatsPluginEnd2EndTest::RunServerLoop, this);
stub_ = EchoTestService::NewStub(grpc::CreateChannel( stub_ = EchoTestService::NewStub(::grpc::CreateChannel(
server_address_, grpc::InsecureChannelCredentials())); server_address_, ::grpc::InsecureChannelCredentials()));
} }
void ResetStub(std::shared_ptr<Channel> channel) { void ResetStub(std::shared_ptr<Channel> channel) {
@ -164,10 +165,10 @@ TEST_F(StatsPluginEnd2EndTest, ErrorCount) {
request.set_message("foo"); request.set_message("foo");
request.mutable_param()->mutable_expected_error()->set_code(i); request.mutable_param()->mutable_expected_error()->set_code(i);
EchoResponse response; EchoResponse response;
grpc::ClientContext context; ::grpc::ClientContext context;
{ {
WithTagMap tags({{TEST_TAG_KEY, TEST_TAG_VALUE}}); WithTagMap tags({{TEST_TAG_KEY, TEST_TAG_VALUE}});
grpc::Status status = stub_->Echo(&context, request, &response); ::grpc::Status status = stub_->Echo(&context, request, &response);
} }
} }
absl::SleepFor(absl::Milliseconds(500)); absl::SleepFor(absl::Milliseconds(500));
@ -252,8 +253,8 @@ TEST_F(StatsPluginEnd2EndTest, RequestReceivedBytesPerRpc) {
EchoRequest request; EchoRequest request;
request.set_message("foo"); request.set_message("foo");
EchoResponse response; EchoResponse response;
grpc::ClientContext context; ::grpc::ClientContext context;
grpc::Status status = stub_->Echo(&context, request, &response); ::grpc::Status status = stub_->Echo(&context, request, &response);
ASSERT_TRUE(status.ok()); ASSERT_TRUE(status.ok());
EXPECT_EQ("foo", response.message()); EXPECT_EQ("foo", response.message());
} }
@ -296,8 +297,8 @@ TEST_F(StatsPluginEnd2EndTest, Latency) {
EchoRequest request; EchoRequest request;
request.set_message("foo"); request.set_message("foo");
EchoResponse response; EchoResponse response;
grpc::ClientContext context; ::grpc::ClientContext context;
grpc::Status status = stub_->Echo(&context, request, &response); ::grpc::Status status = stub_->Echo(&context, request, &response);
ASSERT_TRUE(status.ok()); ASSERT_TRUE(status.ok());
EXPECT_EQ("foo", response.message()); EXPECT_EQ("foo", response.message());
} }
@ -359,8 +360,8 @@ TEST_F(StatsPluginEnd2EndTest, CompletedRpcs) {
const int count = 5; const int count = 5;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
{ {
grpc::ClientContext context; ::grpc::ClientContext context;
grpc::Status status = stub_->Echo(&context, request, &response); ::grpc::Status status = stub_->Echo(&context, request, &response);
ASSERT_TRUE(status.ok()); ASSERT_TRUE(status.ok());
EXPECT_EQ("foo", response.message()); EXPECT_EQ("foo", response.message());
} }
@ -393,8 +394,8 @@ TEST_F(StatsPluginEnd2EndTest, RequestReceivedMessagesPerRpc) {
const int count = 5; const int count = 5;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
{ {
grpc::ClientContext context; ::grpc::ClientContext context;
grpc::Status status = stub_->Echo(&context, request, &response); ::grpc::Status status = stub_->Echo(&context, request, &response);
ASSERT_TRUE(status.ok()); ASSERT_TRUE(status.ok());
EXPECT_EQ("foo", response.message()); EXPECT_EQ("foo", response.message());
} }
@ -443,8 +444,8 @@ TEST_F(StatsPluginEnd2EndTest, TestRetryStatsWithoutAdditionalRetries) {
const int count = 5; const int count = 5;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
{ {
grpc::ClientContext context; ::grpc::ClientContext context;
grpc::Status status = stub_->Echo(&context, request, &response); ::grpc::Status status = stub_->Echo(&context, request, &response);
ASSERT_TRUE(status.ok()); ASSERT_TRUE(status.ok());
EXPECT_EQ("foo", response.message()); EXPECT_EQ("foo", response.message());
} }
@ -499,8 +500,8 @@ TEST_F(StatsPluginEnd2EndTest, TestRetryStatsWithAdditionalRetries) {
const int count = 5; const int count = 5;
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
{ {
grpc::ClientContext context; ::grpc::ClientContext context;
grpc::Status status = stub_->Echo(&context, request, &response); ::grpc::Status status = stub_->Echo(&context, request, &response);
EXPECT_EQ(status.error_code(), StatusCode::ABORTED); EXPECT_EQ(status.error_code(), StatusCode::ABORTED);
} }
absl::SleepFor(absl::Milliseconds(500)); absl::SleepFor(absl::Milliseconds(500));
@ -536,13 +537,14 @@ TEST_F(StatsPluginEnd2EndTest, TestApplicationCensusContextFlows) {
EchoRequest request; EchoRequest request;
request.set_message("foo"); request.set_message("foo");
EchoResponse response; EchoResponse response;
grpc::ClientContext context; ::grpc::ClientContext context;
grpc::CensusContext app_census_context("root", ::opencensus::tags::TagMap{}); ::grpc::CensusContext app_census_context("root",
::opencensus::tags::TagMap{});
context.set_census_context( context.set_census_context(
reinterpret_cast<census_context*>(&app_census_context)); reinterpret_cast<census_context*>(&app_census_context));
context.AddMetadata(kExpectedTraceIdKey, context.AddMetadata(kExpectedTraceIdKey,
app_census_context.Span().context().trace_id().ToHex()); app_census_context.Span().context().trace_id().ToHex());
grpc::Status status = stub_->Echo(&context, request, &response); ::grpc::Status status = stub_->Echo(&context, request, &response);
EXPECT_TRUE(status.ok()); EXPECT_TRUE(status.ok());
} }

View File

@ -47,7 +47,7 @@ std::shared_ptr<Channel> CreateChannelForTestCase(
class InteropClientContextInspector { class InteropClientContextInspector {
public: public:
explicit InteropClientContextInspector(const grpc::ClientContext& context) explicit InteropClientContextInspector(const ::grpc::ClientContext& context)
: context_(context) {} : context_(context) {}
// Inspector methods, able to peek inside ClientContext, follow. // Inspector methods, able to peek inside ClientContext, follow.
@ -63,7 +63,7 @@ class InteropClientContextInspector {
} }
private: private:
const grpc::ClientContext& context_; const ::grpc::ClientContext& context_;
}; };
class AdditionalMetadataInterceptor : public experimental::Interceptor { class AdditionalMetadataInterceptor : public experimental::Interceptor {

View File

@ -51,7 +51,7 @@ std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() {
} }
InteropServerContextInspector::InteropServerContextInspector( InteropServerContextInspector::InteropServerContextInspector(
const grpc::ServerContext& context) const ::grpc::ServerContext& context)
: context_(context) {} : context_(context) {}
grpc_compression_algorithm grpc_compression_algorithm

View File

@ -36,7 +36,7 @@ std::shared_ptr<ServerCredentials> CreateInteropServerCredentials();
class InteropServerContextInspector { class InteropServerContextInspector {
public: public:
explicit InteropServerContextInspector(const grpc::ServerContext& context); explicit InteropServerContextInspector(const ::grpc::ServerContext& context);
// Inspector methods, able to peek inside ServerContext, follow. // Inspector methods, able to peek inside ServerContext, follow.
std::shared_ptr<const AuthContext> GetAuthContext() const; std::shared_ptr<const AuthContext> GetAuthContext() const;
@ -46,7 +46,7 @@ class InteropServerContextInspector {
bool WasCompressed() const; bool WasCompressed() const;
private: private:
const grpc::ServerContext& context_; const ::grpc::ServerContext& context_;
}; };
namespace interop { namespace interop {

View File

@ -60,7 +60,7 @@ int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv); grpc::testing::TestEnvironment env(argc, argv);
LibraryInitializer libInit; LibraryInitializer libInit;
::benchmark::Initialize(&argc, argv); ::benchmark::Initialize(&argc, argv);
grpc::testing::InitTest(&argc, &argv, false); ::grpc::testing::InitTest(&argc, &argv, false);
benchmark::RunTheBenchmarksNamespaced(); benchmark::RunTheBenchmarksNamespaced();
return 0; return 0;
} }

View File

@ -75,7 +75,7 @@ void RunTheBenchmarksNamespaced() { RunSpecifiedBenchmarks(); }
int main(int argc, char** argv) { int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(argc, argv); grpc::testing::TestEnvironment env(argc, argv);
::benchmark::Initialize(&argc, argv); ::benchmark::Initialize(&argc, argv);
grpc::testing::InitTest(&argc, &argv, false); ::grpc::testing::InitTest(&argc, &argv, false);
benchmark::RunTheBenchmarksNamespaced(); benchmark::RunTheBenchmarksNamespaced();
return 0; return 0;
} }

Some files were not shown because too many files have changed in this diff Show More