Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ | |
| 6 #define BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 | |
| 12 namespace blimp { | |
| 13 | |
| 14 // Abstract interface for a HeliumStream factory. Subclasses can use this | |
| 15 // interface to encapsulate transport-specific connection semantics. | |
| 16 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
| |
| 17 public: | |
| 18 // The HeliumStream is assumed to be authenticated and ready to use. | |
| 19 // |stream| is nullptr if the connection attempt failed. | |
| 20 using ConnectCallback = | |
| 21 base::Callback<void(std::unique_ptr<HeliumStream> stream)>; | |
| 22 | |
| 23 // Asynchronously attempts to connect a new HeliumStream. | |
| 24 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
| |
| 25 | |
| 26 // Returns true if the underlying transport has the necessary resources (e.g. | |
| 27 // network connectivity) to Connect() new streams. | |
| 28 virtual bool IsAvailable() = 0; | |
| 29 }; | |
| 30 | |
| 31 } // namespace blimp | |
| 32 | |
| 33 #endif // BLIMP_NET_HELIUM_HELIUM_TRANSPORT_H_ | |
| OLD | NEW |