clang-format

pull/6915/head
Mark D. Roth 9 years ago
parent 7f3f7076f3
commit bd3e3189d6
  1. 41
      include/grpc++/channel_filter.h
  2. 4
      src/cpp/common/channel_filter.cc

@ -34,9 +34,9 @@
#ifndef GRPCXX_CHANNEL_FILTER_H #ifndef GRPCXX_CHANNEL_FILTER_H
#define GRPCXX_CHANNEL_FILTER_H #define GRPCXX_CHANNEL_FILTER_H
#include <grpc/grpc.h>
#include <grpc/census.h>
#include <grpc++/impl/codegen/config.h> #include <grpc++/impl/codegen/config.h>
#include <grpc/census.h>
#include <grpc/grpc.h>
#include <functional> #include <functional>
#include <vector> #include <vector>
@ -147,25 +147,23 @@ class TransportStreamOp {
grpc_transport_stream_op *op() const { return op_; } grpc_transport_stream_op *op() const { return op_; }
grpc_closure *on_complete() const { return op_->on_complete; } grpc_closure *on_complete() const { return op_->on_complete; }
void set_on_complete(grpc_closure* closure) { void set_on_complete(grpc_closure *closure) { op_->on_complete = closure; }
op_->on_complete = closure;
}
MetadataBatch *send_initial_metadata() { MetadataBatch *send_initial_metadata() {
return op_->send_initial_metadata == nullptr return op_->send_initial_metadata == nullptr ? nullptr
? nullptr : &send_initial_metadata_; : &send_initial_metadata_;
} }
MetadataBatch *send_trailing_metadata() { MetadataBatch *send_trailing_metadata() {
return op_->send_trailing_metadata == nullptr return op_->send_trailing_metadata == nullptr ? nullptr
? nullptr : &send_trailing_metadata_; : &send_trailing_metadata_;
} }
MetadataBatch *recv_initial_metadata() { MetadataBatch *recv_initial_metadata() {
return op_->recv_initial_metadata == nullptr return op_->recv_initial_metadata == nullptr ? nullptr
? nullptr : &recv_initial_metadata_; : &recv_initial_metadata_;
} }
MetadataBatch *recv_trailing_metadata() { MetadataBatch *recv_trailing_metadata() {
return op_->recv_trailing_metadata == nullptr return op_->recv_trailing_metadata == nullptr ? nullptr
? nullptr : &recv_trailing_metadata_; : &recv_trailing_metadata_;
} }
uint32_t *send_initial_metadata_flags() const { uint32_t *send_initial_metadata_flags() const {
@ -186,12 +184,12 @@ class TransportStreamOp {
// To be called only on clients and servers, respectively. // To be called only on clients and servers, respectively.
grpc_client_security_context *client_security_context() const { grpc_client_security_context *client_security_context() const {
return (grpc_client_security_context*)op_->context[ return (grpc_client_security_context *)op_->context[GRPC_CONTEXT_SECURITY]
GRPC_CONTEXT_SECURITY].value; .value;
} }
grpc_server_security_context *server_security_context() const { grpc_server_security_context *server_security_context() const {
return (grpc_server_security_context*)op_->context[ return (grpc_server_security_context *)op_->context[GRPC_CONTEXT_SECURITY]
GRPC_CONTEXT_SECURITY].value; .value;
} }
census_context *get_census_context() const { census_context *get_census_context() const {
@ -216,8 +214,7 @@ class ChannelData {
// FIXME: find a way to avoid passing elem into these methods // FIXME: find a way to avoid passing elem into these methods
// (same for CallData below) // (same for CallData below)
virtual void StartTransportOp(grpc_exec_ctx *exec_ctx, virtual void StartTransportOp(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem, grpc_channel_element *elem, TransportOp *op);
TransportOp *op);
protected: protected:
ChannelData(const grpc_channel_args &args, const char *peer) : peer_(peer) {} ChannelData(const grpc_channel_args &args, const char *peer) : peer_(peer) {}
@ -258,9 +255,9 @@ class ChannelFilter GRPC_FINAL {
static void InitChannelElement(grpc_exec_ctx *exec_ctx, static void InitChannelElement(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem, grpc_channel_element *elem,
grpc_channel_element_args *args) { grpc_channel_element_args *args) {
const char* peer = args->optional_transport const char *peer =
? grpc_transport_get_peer(exec_ctx, args->optional_transport
args->optional_transport) ? grpc_transport_get_peer(exec_ctx, args->optional_transport)
: nullptr; : nullptr;
// Construct the object in the already-allocated memory. // Construct the object in the already-allocated memory.
new (elem->channel_data) ChannelDataType(*args->channel_args, peer); new (elem->channel_data) ChannelDataType(*args->channel_args, peer);

@ -43,8 +43,8 @@ namespace grpc {
// MetadataBatch // MetadataBatch
// //
grpc_linked_mdelem* MetadataBatch::AddMetadata( grpc_linked_mdelem *MetadataBatch::AddMetadata(const string &key,
const string& key, const string& value) { const string &value) {
grpc_linked_mdelem *storage = new grpc_linked_mdelem; grpc_linked_mdelem *storage = new grpc_linked_mdelem;
memset(storage, 0, sizeof(grpc_linked_mdelem)); memset(storage, 0, sizeof(grpc_linked_mdelem));
storage->md = grpc_mdelem_from_strings(key.c_str(), value.c_str()); storage->md = grpc_mdelem_from_strings(key.c_str(), value.c_str());

Loading…
Cancel
Save