| Index: blimp/net/grpc_client_stream.h
|
| diff --git a/blimp/net/grpc_client_stream.h b/blimp/net/grpc_client_stream.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c020c74c07d193871415e6a782b1c69bf183a902
|
| --- /dev/null
|
| +++ b/blimp/net/grpc_client_stream.h
|
| @@ -0,0 +1,63 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef BLIMP_NET_GRPC_CLIENT_STREAM_H_
|
| +#define BLIMP_NET_GRPC_CLIENT_STREAM_H_
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/macros.h"
|
| +#include "blimp/net/blimp_net_export.h"
|
| +#include "blimp/net/blimp_transport.h"
|
| +#include "net/base/completion_callback.h"
|
| +
|
| +#include <grpc++/security/server_credentials.h>
|
| +#include <grpc++/server.h>
|
| +#include <grpc++/server_builder.h>
|
| +#include <grpc++/server_context.h>
|
| +#include <grpc/grpc.h>
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/command_line.h"
|
| +#include "base/memory/ptr_util.h"
|
| +#include "base/synchronization/lock.h"
|
| +#include "base/threading/thread.h"
|
| +#include "blimp/common/logging.h"
|
| +#include "blimp/common/proto/blimp_message.pb.h"
|
| +#include "blimp/common/proto/helium_service.grpc.pb.h"
|
| +#include "blimp/net/blimp_message_processor.h"
|
| +#include "blimp/net/blimp_message_pump.h"
|
| +#include "blimp/net/grpc_connection.h"
|
| +#include "blimp/net/grpc_stream.h"
|
| +
|
| +namespace grpc {
|
| +class Channel;
|
| +class ServerCompletionQueue;
|
| +} // namespace grpc
|
| +
|
| +namespace blimp {
|
| +
|
| +class GrpcClientStream : public GrpcStream {
|
| + public:
|
| + GrpcClientStream(const std::string& ip_address,
|
| + const net::CompletionCallback& connection_callback);
|
| +
|
| + void SendMessage(std::unique_ptr<HeliumWrapper> helium_message,
|
| + const HeliumMessageSentCb& sent_cb) override;
|
| +
|
| + void ReceiveMessage(const HeliumMessageReceivedCb& received_cb) override;
|
| +
|
| + ~GrpcClientStream() override;
|
| +
|
| + protected:
|
| + std::string ip_address_;
|
| + std::unique_ptr<HeliumService::Stub> stub_;
|
| + std::unique_ptr<grpc::CompletionQueue> completion_queue_;
|
| + grpc::ClientContext context_;
|
| + std::unique_ptr<grpc::ClientAsyncReaderWriter<HeliumWrapper, HeliumWrapper>>
|
| + stream_;
|
| +};
|
| +
|
| +} // namespace blimp
|
| +
|
| +#endif // BLIMP_NET_GRPC_CLIENT_STREAM_H_
|
|
|