Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
vjpai committed Feb 27, 2015
2 parents 64ac47f + 3a718b2 commit 1b47b12
Show file tree
Hide file tree
Showing 53 changed files with 1,047 additions and 242 deletions.
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
language: cpp
script: ./tools/run_tests/run_tests.py -lc -t -j2
before_install:
- sudo add-apt-repository ppa:yjwong/gflags -y
- sudo apt-get update -qq
- sudo apt-get install -qq libgtest-dev libgflags-dev python-virtualenv
script:
- ./tools/run_tests/run_tests.py -l c -t -j 16 -c dbg
- ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c dbg
- make clean
- ./tools/run_tests/run_tests.py -l c -t -j 16 -c opt
- ./tools/run_tests/run_tests.py -l c++ -t -j 16 -c opt
- ./tools/run_tests/run_tests.py -l node -t -j 16 -c opt
notifications:
email: false
209 changes: 192 additions & 17 deletions Makefile

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,8 @@
"grpc",
"gpr_test_util",
"gpr"
]
],
"flaky": true
},
{
"name": "fling_test",
Expand All @@ -880,7 +881,8 @@
"grpc",
"gpr_test_util",
"gpr"
]
],
"flaky": true
},
{
"name": "gen_hpack_tables",
Expand Down
18 changes: 9 additions & 9 deletions examples/pubsub/publisher_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,28 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {
public:
Status CreateTopic(::grpc::ServerContext* context,
const ::tech::pubsub::Topic* request,
::tech::pubsub::Topic* response) override {
::tech::pubsub::Topic* response) GRPC_OVERRIDE {
EXPECT_EQ(request->name(), kTopic);
return Status::OK;
}

Status Publish(ServerContext* context,
const ::tech::pubsub::PublishRequest* request,
::proto2::Empty* response) override {
::proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->message().data(), kMessageData);
return Status::OK;
}

Status GetTopic(ServerContext* context,
const ::tech::pubsub::GetTopicRequest* request,
::tech::pubsub::Topic* response) override {
::tech::pubsub::Topic* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
return Status::OK;
}

Status ListTopics(ServerContext* context,
const ::tech::pubsub::ListTopicsRequest* request,
::tech::pubsub::ListTopicsResponse* response) override {
Status ListTopics(
ServerContext* context, const ::tech::pubsub::ListTopicsRequest* request,
::tech::pubsub::ListTopicsResponse* response) GRPC_OVERRIDE {
std::ostringstream ss;
ss << "cloud.googleapis.com/project in (/projects/" << kProjectId << ")";
EXPECT_EQ(request->query(), ss.str());
Expand All @@ -92,7 +92,7 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {

Status DeleteTopic(ServerContext* context,
const ::tech::pubsub::DeleteTopicRequest* request,
::proto2::Empty* response) override {
::proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
return Status::OK;
}
Expand All @@ -102,7 +102,7 @@ class PublisherServiceImpl : public tech::pubsub::PublisherService::Service {
class PublisherTest : public ::testing::Test {
protected:
// Setup a server and a client for PublisherService.
void SetUp() override {
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
ServerBuilder builder;
Expand All @@ -116,7 +116,7 @@ class PublisherTest : public ::testing::Test {
publisher_.reset(new grpc::examples::pubsub::Publisher(channel_));
}

void TearDown() override {
void TearDown() GRPC_OVERRIDE {
server_->Shutdown();
publisher_->Shutdown();
}
Expand Down
21 changes: 10 additions & 11 deletions examples/pubsub/subscriber_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ const char kData[] = "Message data";

class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
public:
Status CreateSubscription(ServerContext* context,
const tech::pubsub::Subscription* request,
tech::pubsub::Subscription* response) override {
Status CreateSubscription(
ServerContext* context, const tech::pubsub::Subscription* request,
tech::pubsub::Subscription* response) GRPC_OVERRIDE {
EXPECT_EQ(request->topic(), kTopic);
EXPECT_EQ(request->name(), kSubscriptionName);
return Status::OK;
}

Status GetSubscription(ServerContext* context,
const tech::pubsub::GetSubscriptionRequest* request,
tech::pubsub::Subscription* response) override {
tech::pubsub::Subscription* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
response->set_topic(kTopic);
return Status::OK;
Expand All @@ -76,14 +76,13 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
Status DeleteSubscription(
ServerContext* context,
const tech::pubsub::DeleteSubscriptionRequest* request,
proto2::Empty* response) override {
proto2::Empty* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
return Status::OK;
}

Status Pull(ServerContext* context,
const tech::pubsub::PullRequest* request,
tech::pubsub::PullResponse* response) override {
Status Pull(ServerContext* context, const tech::pubsub::PullRequest* request,
tech::pubsub::PullResponse* response) GRPC_OVERRIDE {
EXPECT_EQ(request->subscription(), kSubscriptionName);
response->set_ack_id("1");
response->mutable_pubsub_event()->mutable_message()->set_data(kData);
Expand All @@ -92,7 +91,7 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {

Status Acknowledge(ServerContext* context,
const tech::pubsub::AcknowledgeRequest* request,
proto2::Empty* response) override {
proto2::Empty* response) GRPC_OVERRIDE {
return Status::OK;
}

Expand All @@ -101,7 +100,7 @@ class SubscriberServiceImpl : public tech::pubsub::SubscriberService::Service {
class SubscriberTest : public ::testing::Test {
protected:
// Setup a server and a client for SubscriberService.
void SetUp() override {
void SetUp() GRPC_OVERRIDE {
int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port;
ServerBuilder builder;
Expand All @@ -115,7 +114,7 @@ class SubscriberTest : public ::testing::Test {
subscriber_.reset(new grpc::examples::pubsub::Subscriber(channel_));
}

void TearDown() override {
void TearDown() GRPC_OVERRIDE {
server_->Shutdown();
subscriber_->Shutdown();
}
Expand Down
9 changes: 5 additions & 4 deletions include/grpc++/async_unary_call.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

namespace grpc {
template <class R>
class ClientAsyncResponseReader final {
class ClientAsyncResponseReader GRPC_FINAL {
public:
ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
Expand Down Expand Up @@ -79,15 +79,16 @@ class ClientAsyncResponseReader final {


private:
ClientContext* context_ = nullptr;
ClientContext* context_;
Call call_;
CallOpBuffer init_buf_;
CallOpBuffer meta_buf_;
CallOpBuffer finish_buf_;
};

template <class W>
class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface {
class ServerAsyncResponseWriter GRPC_FINAL
: public ServerAsyncStreamingInterface {
public:
explicit ServerAsyncResponseWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
Expand Down Expand Up @@ -127,7 +128,7 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface {
}

private:
void BindCall(Call* call) override { call_ = *call; }
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; }

Call call_;
ServerContext* ctx_;
Expand Down
2 changes: 1 addition & 1 deletion include/grpc++/client_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class ClientContext {
return authority_;
}

bool initial_metadata_received_ = false;
bool initial_metadata_received_;
grpc_call *call_;
grpc_completion_queue *cq_;
gpr_timespec absolute_deadline_;
Expand Down
8 changes: 8 additions & 0 deletions include/grpc++/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@

#include <string>

#ifdef GRPC_OLD_CXX
#define GRPC_FINAL
#define GRPC_OVERRIDE
#else
#define GRPC_FINAL final
#define GRPC_OVERRIDE override
#endif

namespace grpc {

typedef std::string string;
Expand Down
2 changes: 1 addition & 1 deletion include/grpc++/credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace grpc {
// to creating an instance using CredentialsFactory, and passing it down
// during channel construction.

class Credentials final {
class Credentials GRPC_FINAL {
public:
~Credentials();

Expand Down
51 changes: 26 additions & 25 deletions include/grpc++/impl/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define __GRPCPP_CALL_H__

#include <grpc/grpc.h>
#include <grpc++/config.h>
#include <grpc++/status.h>
#include <grpc++/completion_queue.h>

Expand All @@ -56,7 +57,7 @@ class Call;

class CallOpBuffer : public CompletionQueueTag {
public:
CallOpBuffer() : return_tag_(this) {}
CallOpBuffer();
~CallOpBuffer();

void Reset(void *next_return_tag);
Expand All @@ -80,40 +81,40 @@ class CallOpBuffer : public CompletionQueueTag {
void FillOps(grpc_op *ops, size_t *nops);

// Called by completion queue just prior to returning from Next() or Pluck()
bool FinalizeResult(void **tag, bool *status) override;
bool FinalizeResult(void **tag, bool *status) GRPC_OVERRIDE;

bool got_message = false;
bool got_message;

private:
void *return_tag_ = nullptr;
void *return_tag_;
// Send initial metadata
bool send_initial_metadata_ = false;
size_t initial_metadata_count_ = 0;
grpc_metadata *initial_metadata_ = nullptr;
bool send_initial_metadata_;
size_t initial_metadata_count_;
grpc_metadata *initial_metadata_;
// Recv initial metadta
std::multimap<grpc::string, grpc::string> *recv_initial_metadata_ = nullptr;
grpc_metadata_array recv_initial_metadata_arr_ = {0, 0, nullptr};
std::multimap<grpc::string, grpc::string> *recv_initial_metadata_;
grpc_metadata_array recv_initial_metadata_arr_;
// Send message
const google::protobuf::Message *send_message_ = nullptr;
grpc_byte_buffer *send_message_buf_ = nullptr;
const google::protobuf::Message *send_message_;
grpc_byte_buffer *send_message_buf_;
// Recv message
google::protobuf::Message *recv_message_ = nullptr;
grpc_byte_buffer *recv_message_buf_ = nullptr;
google::protobuf::Message *recv_message_;
grpc_byte_buffer *recv_message_buf_;
// Client send close
bool client_send_close_ = false;
bool client_send_close_;
// Client recv status
std::multimap<grpc::string, grpc::string> *recv_trailing_metadata_ = nullptr;
Status *recv_status_ = nullptr;
grpc_metadata_array recv_trailing_metadata_arr_ = {0, 0, nullptr};
grpc_status_code status_code_ = GRPC_STATUS_OK;
char *status_details_ = nullptr;
size_t status_details_capacity_ = 0;
std::multimap<grpc::string, grpc::string> *recv_trailing_metadata_;
Status *recv_status_;
grpc_metadata_array recv_trailing_metadata_arr_;
grpc_status_code status_code_;
char *status_details_;
size_t status_details_capacity_;
// Server send status
const Status *send_status_ = nullptr;
size_t trailing_metadata_count_ = 0;
grpc_metadata *trailing_metadata_ = nullptr;
const Status *send_status_;
size_t trailing_metadata_count_;
grpc_metadata *trailing_metadata_;
int cancelled_buf_;
bool *recv_closed_ = nullptr;
bool *recv_closed_;
};

// Channel and Server implement this to allow them to hook performing ops
Expand All @@ -124,7 +125,7 @@ class CallHook {
};

// Straightforward wrapping of the C call object
class Call final {
class Call GRPC_FINAL {
public:
/* call is owned by the caller */
Call(grpc_call *call, CallHook *call_hook_, CompletionQueue *cq);
Expand Down
8 changes: 4 additions & 4 deletions include/grpc++/impl/rpc_service_method.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class RpcMethodHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}

Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
// Invoke application function, cast proto messages to their actual types.
return func_(service_, param.server_context,
dynamic_cast<const RequestType*>(param.request),
Expand All @@ -102,7 +102,7 @@ class ClientStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}

Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerReader<RequestType> reader(param.call, param.server_context);
return func_(service_, param.server_context, &reader,
dynamic_cast<ResponseType*>(param.response));
Expand All @@ -124,7 +124,7 @@ class ServerStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}

Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerWriter<ResponseType> writer(param.call, param.server_context);
return func_(service_, param.server_context,
dynamic_cast<const RequestType*>(param.request), &writer);
Expand All @@ -147,7 +147,7 @@ class BidiStreamingHandler : public MethodHandler {
ServiceType* service)
: func_(func), service_(service) {}

Status RunHandler(const HandlerParameter& param) final {
Status RunHandler(const HandlerParameter& param) GRPC_FINAL {
ServerReaderWriter<ResponseType, RequestType> stream(param.call,
param.server_context);
return func_(service_, param.server_context, &stream);
Expand Down
10 changes: 7 additions & 3 deletions include/grpc++/impl/service_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ class AsynchronousService {

AsynchronousService(CompletionQueue* cq, const char** method_names,
size_t method_count)
: cq_(cq), method_names_(method_names), method_count_(method_count) {}
: cq_(cq),
dispatch_impl_(nullptr),
method_names_(method_names),
method_count_(method_count),
request_args_(nullptr) {}

~AsynchronousService() { delete[] request_args_; }

Expand Down Expand Up @@ -116,10 +120,10 @@ class AsynchronousService {
private:
friend class Server;
CompletionQueue* const cq_;
DispatchImpl* dispatch_impl_ = nullptr;
DispatchImpl* dispatch_impl_;
const char** const method_names_;
size_t method_count_;
void** request_args_ = nullptr;
void** request_args_;
};

} // namespace grpc
Expand Down
Loading

0 comments on commit 1b47b12

Please sign in to comment.