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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 if (!core.isHandle(handle)) | 141 if (!core.isHandle(handle)) |
142 throw new Error("Not a handle " + handle); | 142 throw new Error("Not a handle " + handle); |
143 | 143 |
144 var stub = new localInterface.stubClass; | 144 var stub = new localInterface.stubClass; |
145 var router = new Router(handle); | 145 var router = new Router(handle); |
146 var connection = new BaseConnection(stub, undefined, router); | 146 var connection = new BaseConnection(stub, undefined, router); |
147 StubBindings(stub).connection = connection; | 147 StubBindings(stub).connection = connection; |
148 return stub; | 148 return stub; |
149 } | 149 } |
150 | 150 |
151 function bindHandleToObj(handle, obj) { | |
yzshen1
2016/05/27 16:24:45
Please add comments.
| |
152 if (!core.isHandle(handle)) | |
153 throw new Error("Not a handle " + handle); | |
154 | |
155 var router = new Router(handle); | |
156 var connection = new BaseConnection(obj, undefined, router); | |
157 obj.connection = connection; | |
158 } | |
159 | |
151 var exports = {}; | 160 var exports = {}; |
152 exports.Connection = Connection; | 161 exports.Connection = Connection; |
153 exports.TestConnection = TestConnection; | 162 exports.TestConnection = TestConnection; |
154 | 163 |
155 exports.bindProxy = bindProxy; | 164 exports.bindProxy = bindProxy; |
156 exports.bindImpl = bindImpl; | 165 exports.bindImpl = bindImpl; |
157 exports.bindHandleToProxy = bindHandleToProxy; | 166 exports.bindHandleToProxy = bindHandleToProxy; |
158 exports.bindHandleToStub = bindHandleToStub; | 167 exports.bindHandleToStub = bindHandleToStub; |
168 exports.bindHandleToObj = bindHandleToObj; | |
159 return exports; | 169 return exports; |
160 }); | 170 }); |
OLD | NEW |