Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 Indirect Service Demo | |
| 2 ===================== | |
| 3 | |
| 4 This demo is intended to highlight the difference between requesting a service a nd providing one. The demo is based on two services: IntegerService and Indirect IntegerService. | |
|
Aaron Boodman
2014/11/20 07:21:58
You should wrap at 80 cols.
hansmuller
2014/11/20 17:53:03
Done.
| |
| 5 | |
| 6 interface IntegerService { | |
| 7 Increment() => (int32 value); | |
| 8 }; | |
| 9 | |
| 10 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.
| |
| 11 | |
| 12 interface IndirectIntegerService { | |
| 13 Set(IntegerService? service); | |
| 14 Get(IntegerService&? service); | |
| 15 }; | |
| 16 | |
| 17 This service delegates to the one IntegerService provided by the Set() method. C lients use Get() to request a connection to an IntegerService targets the delega te. 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.
| |
| 18 | |
| 19 The demo creates a set of threads all of which get their own connection to the s hared IntegerService via the IndirectIntegerService. The threads all access the IntegerService at the same time and then display a little table of the results. | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| OLD | NEW |