Chromium Code Reviews| Index: examples/indirect_service/README.md |
| diff --git a/examples/indirect_service/README.md b/examples/indirect_service/README.md |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5cfbc96d17cc5896b180be9dc4862a8beda62832 |
| --- /dev/null |
| +++ b/examples/indirect_service/README.md |
| @@ -0,0 +1,26 @@ |
| +Indirect Service Demo |
| +===================== |
| + |
| +This demo is intended to highlight the difference between requesting a service and providing one. The demo is based on two services: IntegerService and IndirectIntegerService. |
|
Aaron Boodman
2014/11/20 07:21:58
You should wrap at 80 cols.
hansmuller
2014/11/20 17:53:03
Done.
|
| + |
| +interface IntegerService { |
| + Increment() => (int32 value); |
| +}; |
| + |
| +This trival interface just manages a single internal integer that's initialized to 0. The Increment() method returns the old value. |
|
Aaron Boodman
2014/11/20 07:21:58
It doesn't seem the term 'old' is meaningful with
hansmuller
2014/11/20 17:53:04
Done.
|
| + |
| +interface IndirectIntegerService { |
| + Set(IntegerService? service); |
| + Get(IntegerService&? service); |
| +}; |
| + |
| +This service delegates to the one IntegerService provided by the Set() method. Clients use Get() to request a connection to an IntegerService targets the delegate. This is roughly an IntegerService "pointer". |
|
Aaron Boodman
2014/11/20 07:21:58
s/targets/targetting/
hansmuller
2014/11/20 17:53:04
Done.
|
| + |
| +The demo creates a set of threads all of which get their own connection to the shared IntegerService via the IndirectIntegerService. The threads all access the IntegerService at the same time and then display a little table of the results. |
| + |
| + |
| + |
| + |
| + |
| + |
| + |