| Index: blimp/net/grpc_engine_transport.cc
|
| diff --git a/blimp/net/grpc_engine_transport.cc b/blimp/net/grpc_engine_transport.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..eabffbe82dddf32758d358c2d5aaccc85da5db93
|
| --- /dev/null
|
| +++ b/blimp/net/grpc_engine_transport.cc
|
| @@ -0,0 +1,60 @@
|
| +// 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.
|
| +
|
| +#include "blimp/net/grpc_engine_transport.h"
|
| +
|
| +#include <queue>
|
| +#include <string>
|
| +#include <utility>
|
| +
|
| +#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/command_line.h"
|
| +#include "base/memory/ptr_util.h"
|
| +#include "base/synchronization/lock.h"
|
| +#include "base/threading/thread_task_runner_handle.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_engine_stream.h"
|
| +#include "net/base/net_errors.h"
|
| +
|
| +#include "content/public/browser/browser_thread.h"
|
| +
|
| +namespace blimp {
|
| +
|
| +GrpcEngineTransport::GrpcEngineTransport(const std::string& ip_address)
|
| + : BlimpEngineTransport(), ip_address_(ip_address) {
|
| + DVLOG(1) << "gRPC Engine Initialized @ " << ip_address;
|
| +}
|
| +
|
| +void GrpcEngineTransport::Connect(const net::CompletionCallback& callback) {
|
| + grpc_connection_ = base::MakeUnique<GrpcConnection>(
|
| + base::MakeUnique<GrpcEngineStream>(ip_address_, callback));
|
| +}
|
| +
|
| +std::unique_ptr<BlimpConnection> GrpcEngineTransport::MakeConnection() {
|
| + DVLOG(1) << "Grpc Engine finished setup";
|
| + return std::move(grpc_connection_);
|
| +}
|
| +
|
| +const char* GrpcEngineTransport::GetName() const {
|
| + return "GRPC";
|
| +}
|
| +
|
| +void GrpcEngineTransport::GetLocalAddress(net::IPEndPoint* address) const {
|
| + // DCHECK(server_socket_);
|
| + // server_socket_->GetLocalAddress(address);
|
| +}
|
| +
|
| +GrpcEngineTransport::~GrpcEngineTransport() {}
|
| +
|
| +} // namespace blimp
|
|
|