OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BLIMP_NET_BLIMP_TRANSPORT_H_ | 5 #ifndef BLIMP_NET_BLIMP_TRANSPORT_H_ |
6 #define BLIMP_NET_BLIMP_TRANSPORT_H_ | 6 #define BLIMP_NET_BLIMP_TRANSPORT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
12 | 12 |
13 namespace blimp { | 13 namespace blimp { |
14 | 14 |
15 class BlimpConnection; | 15 class BlimpConnection; |
16 class MessagePort; | |
16 | 17 |
17 // An interface which encapsulates the transport-specific code for | 18 // An interface which encapsulates the transport-specific code for |
18 // establishing network connections between the client and engine. | 19 // establishing network connections between the client and engine. |
19 // Subclasses of BlimpTransport are responsible for defining their own | 20 // Subclasses of BlimpTransport are responsible for defining their own |
20 // methods for receiving connection arguments. | 21 // methods for receiving connection arguments. |
21 class BlimpTransport { | 22 class BlimpTransport { |
22 public: | 23 public: |
23 virtual ~BlimpTransport() {} | 24 virtual ~BlimpTransport() {} |
24 | 25 |
25 // Initiate or listen for a connection. | 26 // Initiate or listen for a connection. |
26 // | 27 // |
27 // |callback| will be invoked with the connection outcome: | 28 // |callback| will be invoked with the connection outcome: |
28 // * net::OK if a connection is established successful, the BlimpConnection | 29 // * net::OK if a connection is established successful, the BlimpConnection |
29 // can be taken by calling TakeConnection(). | 30 // can be taken by calling TakeMessagePort(). |
CJ
2016/08/12 23:59:15
Perhaps phrase this differently, as we are no long
Kevin M
2016/08/15 17:35:09
Fixed - rewrote the whole comment block due to awk
| |
30 // * net::ERR_IO_PENDING will never be the outcome | 31 // * net::ERR_IO_PENDING will never be the outcome |
31 // * Other error code indicates no connection was established. | 32 // * Other error code indicates no connection was established. |
32 virtual void Connect(const net::CompletionCallback& callback) = 0; | 33 virtual void Connect(const net::CompletionCallback& callback) = 0; |
33 | 34 |
34 // Returns the connection object after a successful Connect(). | 35 // Returns the MessagePort of a successfully established connection. |
35 virtual std::unique_ptr<BlimpConnection> TakeConnection() = 0; | 36 virtual std::unique_ptr<MessagePort> TakeMessagePort() = 0; |
36 | 37 |
37 // Gets transport name, e.g. "TCP", "SSL", "mock", etc. | 38 // Gets transport name, e.g. "TCP", "SSL", "mock", etc. |
38 virtual const char* GetName() const = 0; | 39 virtual const char* GetName() const = 0; |
39 }; | 40 }; |
40 | 41 |
41 } // namespace blimp | 42 } // namespace blimp |
42 | 43 |
43 #endif // BLIMP_NET_BLIMP_TRANSPORT_H_ | 44 #endif // BLIMP_NET_BLIMP_TRANSPORT_H_ |
OLD | NEW |