| OLD | NEW |
| 1 #!mojo:js_content_handler | 1 #!mojo:js_content_handler |
| 2 | 2 |
| 3 define("main", [ | 3 define("main", [ |
| 4 "mojo/public/js/bindings", |
| 4 "mojo/services/public/js/application", | 5 "mojo/services/public/js/application", |
| 5 "services/js/test/pingpong_service.mojom" | 6 "services/js/test/pingpong_service.mojom" |
| 6 ], function(application, pingPongServiceMojom) { | 7 ], function(bindings, application, pingPongServiceMojom) { |
| 7 | 8 |
| 9 const ProxyBindings = bindings.ProxyBindings; |
| 10 const StubBindings = bindings.StubBindings; |
| 8 const Application = application.Application; | 11 const Application = application.Application; |
| 9 const PingPongService = pingPongServiceMojom.PingPongService; | 12 const PingPongService = pingPongServiceMojom.PingPongService; |
| 10 | 13 |
| 11 class PingPongServiceImpl { | 14 class PingPongServiceImpl { |
| 12 constructor(app, client) { | 15 constructor(app, client) { |
| 13 this.app = app; | 16 this.app = app; |
| 14 this.client = client; | 17 this.client = client; |
| 15 } | 18 } |
| 16 ping(value) { | 19 ping(value) { |
| 17 this.client.pong(value + 1); | 20 this.client.pong(value + 1); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 43 pingTargetService(pingTargetService, count) { | 46 pingTargetService(pingTargetService, count) { |
| 44 return new Promise(function(resolve) { | 47 return new Promise(function(resolve) { |
| 45 var pingTargetClient = { | 48 var pingTargetClient = { |
| 46 pong: function(value) { | 49 pong: function(value) { |
| 47 if (value == count) { | 50 if (value == count) { |
| 48 pingTargetService.quit(); | 51 pingTargetService.quit(); |
| 49 resolve({ok: true}); | 52 resolve({ok: true}); |
| 50 } | 53 } |
| 51 } | 54 } |
| 52 }; | 55 }; |
| 53 pingTargetService.local$ = pingTargetClient; | 56 ProxyBindings(pingTargetService).setLocalDelegate(pingTargetClient); |
| 54 for(var i = 0; i <= count; i++) | 57 for(var i = 0; i <= count; i++) |
| 55 pingTargetService.ping(i); | 58 pingTargetService.ping(i); |
| 56 }); | 59 }); |
| 57 } | 60 } |
| 58 | 61 |
| 59 // This method is only used by the GetTargetService test. | 62 // This method is only used by the GetTargetService test. |
| 60 getPingPongService(clientProxy) { | 63 getPingPongService(clientProxy) { |
| 61 clientProxy.local$ = new PingPongServiceImpl(this, clientProxy); | 64 ProxyBindings(clientProxy).setLocalDelegate( |
| 65 new PingPongServiceImpl(this, clientProxy)); |
| 62 } | 66 } |
| 63 } | 67 } |
| 64 | 68 |
| 65 class PingPong extends Application { | 69 class PingPong extends Application { |
| 66 acceptConnection(url, serviceProvider) { | 70 acceptConnection(url, serviceProvider) { |
| 67 serviceProvider.provideService( | 71 serviceProvider.provideService( |
| 68 PingPongService, PingPongServiceImpl.bind(null, this)); | 72 PingPongService, PingPongServiceImpl.bind(null, this)); |
| 69 } | 73 } |
| 70 } | 74 } |
| 71 | 75 |
| 72 return PingPong; | 76 return PingPong; |
| 73 }); | 77 }); |
| OLD | NEW |