Chromium Code Reviews| Index: blimp/net/helium/helium_transport.h |
| diff --git a/blimp/net/helium/helium_transport.h b/blimp/net/helium/helium_transport.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..42d9029dc6fe11614a75f0166200e9b46e8cdabc |
| --- /dev/null |
| +++ b/blimp/net/helium/helium_transport.h |
| @@ -0,0 +1,33 @@ |
| +// 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_HELIUM_HELIUM_TRANSPORT_H_ |
| +#define BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/callback.h" |
| + |
| +namespace blimp { |
| + |
| +// Abstract interface for a HeliumStream factory. Subclasses can use this |
| +// interface to encapsulate transport-specific connection semantics. |
| +class HeliumTransport { |
|
perumaal
2016/09/29 19:13:50
Just to make sure. Would this initially wrap a Bli
Kevin M
2016/09/29 21:18:40
That's a possibility, then we'd have a HeliumStrea
|
| + public: |
| + // The HeliumStream is assumed to be authenticated and ready to use. |
| + // |stream| is nullptr if the connection attempt failed. |
| + using ConnectCallback = |
| + base::Callback<void(std::unique_ptr<HeliumStream> stream)>; |
| + |
| + // Asynchronously attempts to connect a new HeliumStream. |
| + virtual void Connect(const ConnectCallback& connect_cb) = 0; |
|
scf
2016/09/29 19:12:22
does it allow many calls to the Connect on the sam
Kevin M
2016/09/29 21:18:40
Yes; there is no FIFO ordering constraint like the
|
| + |
| + // Returns true if the underlying transport has the necessary resources (e.g. |
| + // network connectivity) to Connect() new streams. |
| + virtual bool IsAvailable() = 0; |
| +}; |
| + |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ |