Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: examples/echo/README.md

Issue 1979723002: ApplicationConnection devolution, part 3. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « examples/content_handler_demo/content_handler_demo.cc ('k') | examples/echo/echo_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Example Echo Client & Server 1 Example Echo Client & Server
2 ==== 2 ====
3 3
4 This echo client/server demonstrate how to create and use a mojom interface, 4 This echo client/server demonstrate how to create and use a mojom interface,
5 as well as demonstrating one way to communicate between mojo applications. 5 as well as demonstrating one way to communicate between mojo applications.
6 6
7 For a deeper dive into this code, refer to the [Mojo 7 For a deeper dive into this code, refer to the [Mojo
8 Tutorial](https://docs.google.com/document/d/1mufrtxTk8w9qa3jcnlgqsYkWlyhwEpc7aW NaSOks7ug). 8 Tutorial](https://docs.google.com/document/d/1mufrtxTk8w9qa3jcnlgqsYkWlyhwEpc7aW NaSOks7ug).
9 9
10 ## Running the Echo Client & Server 10 ## Running the Echo Client & Server
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 echo_server.cc contains three different types of servers, though only one can be 128 echo_server.cc contains three different types of servers, though only one can be
129 used at a time. To try changing the server, uncomment one of the lines in 129 used at a time. To try changing the server, uncomment one of the lines in
130 MojoMain. These different `ApplicationDelegate` derivations demonstrate 130 MojoMain. These different `ApplicationDelegate` derivations demonstrate
131 different ways in which incoming requests can be handled. 131 different ways in which incoming requests can be handled.
132 132
133 All three servers, being `ApplicationDelegate` derivations, implement 133 All three servers, being `ApplicationDelegate` derivations, implement
134 `ConfigureIncomingConnection` in the same way: 134 `ConfigureIncomingConnection` in the same way:
135 135
136 ``` 136 ```
137 connection->GetServiceProviderImpl().AddService<Echo>( 137 service_provider_impl->AddService<Echo>(
138 [this](const mojo::ConnectionContext& connection_context, 138 [this](const mojo::ConnectionContext& connection_context,
139 mojo::InterfaceRequest<Echo> echo_request) { 139 mojo::InterfaceRequest<Echo> echo_request) {
140 ... 140 ...
141 }); 141 });
142 ``` 142 ```
143 143
144 This should be read as "For any incoming connections to this server, use the 144 This should be read as "For any incoming connections to this server, use the
145 given lambda function use `this` to create the Echo interface". 145 given lambda function use `this` to create the Echo interface".
146 146
147 ### EchoImpl: The Interface Implementation 147 ### EchoImpl: The Interface Implementation
(...skipping 28 matching lines...) Expand all
176 This server creates an `EchoImpl` object, like the `SingletonServer`, but uses a 176 This server creates an `EchoImpl` object, like the `SingletonServer`, but uses a
177 single `Binding`, rather than a `BindingSet`. This means that when a new client 177 single `Binding`, rather than a `BindingSet`. This means that when a new client
178 connects to the OneAtATimeServer, the previous binding is closed, and a new 178 connects to the OneAtATimeServer, the previous binding is closed, and a new
179 binding is made between the new client and the interface implementation. 179 binding is made between the new client and the interface implementation.
180 180
181 The OneAtATimeServer demonstrates a pattern that should be avoided because it 181 The OneAtATimeServer demonstrates a pattern that should be avoided because it
182 contains a race condition for multiple clients. If a new client binds to the 182 contains a race condition for multiple clients. If a new client binds to the
183 server before the first client managed to call EchoString, the first client's 183 server before the first client managed to call EchoString, the first client's
184 call would cause an error. Unless you have a specific use case for this 184 call would cause an error. Unless you have a specific use case for this
185 behavior, it is advised to avoid creating a server like this. 185 behavior, it is advised to avoid creating a server like this.
OLDNEW
« no previous file with comments | « examples/content_handler_demo/content_handler_demo.cc ('k') | examples/echo/echo_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698