| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 define("mojo/public/js/connection", [ | 5 define("mojo/public/js/connection", [ |
| 6 "mojo/public/js/bindings", | 6 "mojo/public/js/bindings", |
| 7 "mojo/public/js/connector", | 7 "mojo/public/js/connector", |
| 8 "mojo/public/js/core", | 8 "mojo/public/js/core", |
| 9 "mojo/public/js/router", | 9 "mojo/public/js/router", |
| 10 ], function(bindings, connector, core, router) { | 10 ], function(bindings, connector, core, router) { |
| 11 | 11 |
| 12 var Router = router.Router; | 12 var Router = router.Router; |
| 13 var EmptyProxy = bindings.EmptyProxy; | 13 var EmptyProxy = bindings.EmptyProxy; |
| 14 var EmptyStub = bindings.EmptyStub; | 14 var EmptyStub = bindings.EmptyStub; |
| 15 var ProxyBindings = bindings.ProxyBindings; | 15 var ProxyBindings = bindings.ProxyBindings; |
| 16 var StubBindings = bindings.StubBindings; | 16 var StubBindings = bindings.StubBindings; |
| 17 var TestConnector = connector.TestConnector; | 17 var TestConnector = connector.TestConnector; |
| 18 var TestRouter = router.TestRouter; | 18 var TestRouter = router.TestRouter; |
| 19 | 19 |
| 20 // TODO(hansmuller): the proxy receiver_ property should be receiver$ | 20 // TODO(hansmuller): the proxy receiver_ property should be receiver$ |
| 21 | 21 |
| 22 function BaseConnection(localStub, remoteProxy, router) { | 22 function BaseConnection(localStub, remoteProxy, router) { |
| 23 this.router_ = router; | 23 this.router_ = router; |
| 24 this.local = localStub; | 24 this.local = localStub; |
| 25 this.remote = remoteProxy; | 25 this.remote = remoteProxy; |
| 26 | 26 |
| 27 this.router_.setIncomingReceiver(localStub); | 27 this.router_.setIncomingReceiver(localStub); |
| 28 this.router_.setErrorHandler(() => { | 28 this.router_.setErrorHandler(function() { |
| 29 if (StubBindings(this.local) && | 29 if (StubBindings(this.local) && |
| 30 StubBindings(this.local).connectionErrorHandler) | 30 StubBindings(this.local).connectionErrorHandler) |
| 31 StubBindings(this.local).connectionErrorHandler(); | 31 StubBindings(this.local).connectionErrorHandler(); |
| 32 }); | 32 }); |
| 33 if (this.remote) | 33 if (this.remote) |
| 34 this.remote.receiver_ = router; | 34 this.remote.receiver_ = router; |
| 35 | 35 |
| 36 // Validate incoming messages: remote responses and local requests. | 36 // Validate incoming messages: remote responses and local requests. |
| 37 var validateRequest = localStub && localStub.validator; | 37 var validateRequest = localStub && localStub.validator; |
| 38 var validateResponse = remoteProxy && remoteProxy.validator; | 38 var validateResponse = remoteProxy && remoteProxy.validator; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 var exports = {}; | 151 var exports = {}; |
| 152 exports.Connection = Connection; | 152 exports.Connection = Connection; |
| 153 exports.TestConnection = TestConnection; | 153 exports.TestConnection = TestConnection; |
| 154 | 154 |
| 155 exports.bindProxy = bindProxy; | 155 exports.bindProxy = bindProxy; |
| 156 exports.bindImpl = bindImpl; | 156 exports.bindImpl = bindImpl; |
| 157 exports.bindHandleToProxy = bindHandleToProxy; | 157 exports.bindHandleToProxy = bindHandleToProxy; |
| 158 exports.bindHandleToStub = bindHandleToStub; | 158 exports.bindHandleToStub = bindHandleToStub; |
| 159 return exports; | 159 return exports; |
| 160 }); | 160 }); |
| OLD | NEW |