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

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

Issue 733563002: Mojo Example that demos the difference between providing and requesting an interface (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Manage IntegerServicePtr and DemoTask lifetimes. Fixed RunLoop::RemoveFirstInvalidHandle() Created 6 years, 1 month 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
OLDNEW
(Empty)
1 Indirect Service Demo
2 =====================
3
4 This demo is intended to highlight the difference between requesting a service
5 and providing one. The demo is based on two services: IntegerService and
6 IndirectIntegerService.
7
8 interface IntegerService {
9 Increment() => (int32 value);
10 };
11
12 This trival interface just manages a single internal integer that's initialized
13 to 0. The Increment() method returns a new value.
14
15 interface IndirectIntegerService {
16 Set(IntegerService? service);
17 Get(IntegerService&? service);
18 };
19
20 This service delegates to the one IntegerService provided by the Set() method.
21 Clients use Get() to request a connection to an IntegerService that targets the
22 delegate. This is roughly an IntegerService "pointer".
23
24 The demo creates a set of threads all of which get their own connection to the
25 shared IntegerService via the IndirectIntegerService. The threads all access
26 the IntegerService at the same time and then display a little table of the
27 results.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698