OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ | 5 #ifndef MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ |
6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ | 6 #define MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 25 matching lines...) Expand all Loading... |
36 // connection->AddService<Bar>(&my_foo_and_bar_factory_); | 36 // connection->AddService<Bar>(&my_foo_and_bar_factory_); |
37 // | 37 // |
38 // The InterfaceFactory must outlive the Connection. | 38 // The InterfaceFactory must outlive the Connection. |
39 // | 39 // |
40 // Additionally you specify a ServiceConnector. If a ServiceConnector has | 40 // Additionally you specify a ServiceConnector. If a ServiceConnector has |
41 // been set and an InterfaceFactory has not been registered for the interface | 41 // been set and an InterfaceFactory has not been registered for the interface |
42 // request, than the interface request is sent to the ServiceConnector. | 42 // request, than the interface request is sent to the ServiceConnector. |
43 // | 43 // |
44 // Just as with InterfaceFactory, ServiceConnector must outlive Connection. | 44 // Just as with InterfaceFactory, ServiceConnector must outlive Connection. |
45 // | 45 // |
46 // An Connection's lifetime is managed by an ApplicationImpl. To close a | 46 // An Connection's lifetime is managed by an ShellConnection. To close a |
47 // connection, call CloseConnection which will destroy this object. | 47 // connection, call CloseConnection which will destroy this object. |
48 class Connection { | 48 class Connection { |
49 public: | 49 public: |
50 virtual ~Connection() {} | 50 virtual ~Connection() {} |
51 | 51 |
52 class TestApi { | 52 class TestApi { |
53 public: | 53 public: |
54 explicit TestApi(Connection* connection) : connection_(connection) {} | 54 explicit TestApi(Connection* connection) : connection_(connection) {} |
55 base::WeakPtr<Connection> GetWeakPtr() { | 55 base::WeakPtr<Connection> GetWeakPtr() { |
56 return connection_->GetWeakPtr(); | 56 return connection_->GetWeakPtr(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // some filtering policy preventing this interface from being exposed). | 139 // some filtering policy preventing this interface from being exposed). |
140 virtual bool SetServiceConnectorForName(ServiceConnector* service_connector, | 140 virtual bool SetServiceConnectorForName(ServiceConnector* service_connector, |
141 const std::string& name) = 0; | 141 const std::string& name) = 0; |
142 | 142 |
143 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; | 143 virtual base::WeakPtr<Connection> GetWeakPtr() = 0; |
144 }; | 144 }; |
145 | 145 |
146 } // namespace mojo | 146 } // namespace mojo |
147 | 147 |
148 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ | 148 #endif // MOJO_SHELL_PUBLIC_CPP_CONNECTION_H_ |
OLD | NEW |