Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: mojo/public/js/bindings.js

Issue 2844133003: Add associated binding set. Add associated_binding.html layout test. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bindings", [ 5 define("mojo/public/js/bindings", [
6 "mojo/public/js/core", 6 "mojo/public/js/core",
7 "mojo/public/js/interface_types", 7 "mojo/public/js/interface_types",
8 "mojo/public/js/lib/interface_endpoint_client", 8 "mojo/public/js/lib/interface_endpoint_client",
9 "mojo/public/js/router", 9 "mojo/public/js/router",
10 ], function(core, types, interfaceEndpointClient, router) { 10 ], function(core, types, interfaceEndpointClient, router) {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 }; 258 };
259 259
260 // --------------------------------------------------------------------------- 260 // ---------------------------------------------------------------------------
261 261
262 function BindingSetEntry(bindingSet, interfaceType, impl, requestOrHandle, 262 function BindingSetEntry(bindingSet, interfaceType, impl, requestOrHandle,
263 bindingId) { 263 bindingId) {
264 this.bindingSet_ = bindingSet; 264 this.bindingSet_ = bindingSet;
265 this.bindingId_ = bindingId; 265 this.bindingId_ = bindingId;
266 this.binding_ = new Binding(interfaceType, impl, requestOrHandle); 266 this.binding_ = new Binding(interfaceType, impl, requestOrHandle);
267 267
268 this.binding_.setConnectionErrorHandler(function() { 268 this.binding_.setConnectionErrorHandler(function(reason) {
269 this.bindingSet_.onConnectionError(bindingId); 269 this.bindingSet_.onConnectionError(bindingId, reason);
270 }.bind(this)); 270 }.bind(this));
271 } 271 }
272 272
273 BindingSetEntry.prototype.close = function() { 273 BindingSetEntry.prototype.close = function() {
274 this.binding_.close(); 274 this.binding_.close();
275 }; 275 };
276 276
277 function BindingSet(interfaceType) { 277 function BindingSet(interfaceType) {
278 this.interfaceType_ = interfaceType; 278 this.interfaceType_ = interfaceType;
279 this.nextBindingId_ = 0; 279 this.nextBindingId_ = 0;
(...skipping 16 matching lines...) Expand all
296 BindingSet.prototype.closeAllBindings = function() { 296 BindingSet.prototype.closeAllBindings = function() {
297 for (var entry of this.bindings_.values()) 297 for (var entry of this.bindings_.values())
298 entry.close(); 298 entry.close();
299 this.bindings_.clear(); 299 this.bindings_.clear();
300 }; 300 };
301 301
302 BindingSet.prototype.setConnectionErrorHandler = function(callback) { 302 BindingSet.prototype.setConnectionErrorHandler = function(callback) {
303 this.errorHandler_ = callback; 303 this.errorHandler_ = callback;
304 }; 304 };
305 305
306 BindingSet.prototype.onConnectionError = function(bindingId) { 306 BindingSet.prototype.onConnectionError = function(bindingId, reason) {
307 this.bindings_.delete(bindingId); 307 this.bindings_.delete(bindingId);
308 308
309 if (this.errorHandler_) 309 if (this.errorHandler_)
310 this.errorHandler_(); 310 this.errorHandler_(reason);
311 }; 311 };
312 312
313 var exports = {}; 313 var exports = {};
314 exports.InterfacePtrInfo = types.InterfacePtrInfo; 314 exports.InterfacePtrInfo = types.InterfacePtrInfo;
315 exports.InterfaceRequest = types.InterfaceRequest; 315 exports.InterfaceRequest = types.InterfaceRequest;
316 exports.makeRequest = makeRequest; 316 exports.makeRequest = makeRequest;
317 exports.InterfacePtrController = InterfacePtrController; 317 exports.InterfacePtrController = InterfacePtrController;
318 exports.Binding = Binding; 318 exports.Binding = Binding;
319 exports.BindingSet = BindingSet; 319 exports.BindingSet = BindingSet;
320 320
321 return exports; 321 return exports;
322 }); 322 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698