| 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) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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(function() { | 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 }.bind(this)); |
| 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; |
| 39 var payloadValidators = []; | 39 var payloadValidators = []; |
| 40 if (validateRequest) | 40 if (validateRequest) |
| 41 payloadValidators.push(validateRequest); | 41 payloadValidators.push(validateRequest); |
| 42 if (validateResponse) | 42 if (validateResponse) |
| (...skipping 108 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 |