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

Unified Diff: mojo/public/js/associated_bindings.js

Issue 2844133003: Add associated binding set. Add associated_binding.html layout test. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/js/associated_bindings.js
diff --git a/mojo/public/js/associated_bindings.js b/mojo/public/js/associated_bindings.js
index 18ac452daf599c11d1a3e8db0ed0e78a90a0a7ac..5812e61e5931324b81cd72c5b2c9a8b0449ab8b7 100644
--- a/mojo/public/js/associated_bindings.js
+++ b/mojo/public/js/associated_bindings.js
@@ -3,11 +3,13 @@
// found in the LICENSE file.
define("mojo/public/js/associated_bindings", [
+ "mojo/public/js/bindings",
"mojo/public/js/core",
"mojo/public/js/interface_types",
"mojo/public/js/lib/interface_endpoint_client",
"mojo/public/js/lib/interface_endpoint_handle",
-], function(core, types, interfaceEndpointClient, interfaceEndpointHandle) {
+], function(bindings, core, types, interfaceEndpointClient,
+ interfaceEndpointHandle) {
var InterfaceEndpointClient = interfaceEndpointClient.InterfaceEndpointClient;
@@ -230,12 +232,52 @@ define("mojo/public/js/associated_bindings", [
return result;
};
+ // ---------------------------------------------------------------------------
+
+ function AssociatedBindingSetEntry(associatedBindingSet, interfaceType, impl,
yzshen1 2017/04/27 17:28:38 For function definition, please either fit all par
wangjimmy 2017/04/27 20:26:49 Done.
+ associatedInterfaceRequest, bindingId) {
+ this.associatedBindingSet_ = associatedBindingSet;
+ this.bindingId_ = bindingId;
+ this.associatedBinding_ = new AssociatedBinding(interfaceType, impl,
+ associatedInterfaceRequest);
+
+ this.associatedBinding_.setConnectionErrorHandler(function(reason) {
+ this.associatedBindingSet_.onConnectionError(bindingId, reason);
+ }.bind(this));
+ }
+
+ AssociatedBindingSetEntry.prototype.close = function() {
+ this.associatedBinding_.close();
+ };
+
+ function AssociatedBindingSet(interfaceType) {
+ this.interfaceType_ = interfaceType;
+ this.nextBindingId_ = 0;
+ this.bindings_ = new Map();
+ this.errorHandler_ = null;
+ }
+
+ AssociatedBindingSet.prototype = Object.create(
+ bindings.BindingSet.prototype);
+
+ AssociatedBindingSet.prototype.addBinding = function(impl,
yzshen1 2017/04/27 17:28:38 Could we design BindingSetBase/BindingSetEntry to
wangjimmy 2017/04/27 20:26:49 Done.
+ associatedInterfaceRequest) {
+ this.bindings_.set(
+ this.nextBindingId_,
+ new AssociatedBindingSetEntry(this, this.interfaceType_, impl,
+ associatedInterfaceRequest, this.nextBindingId_));
+ ++this.nextBindingId_;
+ };
+
+ AssociatedBindingSet.prototype.constructor = AssociatedBindingSet;
+
var exports = {};
exports.AssociatedInterfacePtrInfo = types.AssociatedInterfacePtrInfo;
exports.AssociatedInterfaceRequest = types.AssociatedInterfaceRequest;
exports.makeRequest = makeRequest;
exports.AssociatedInterfacePtrController = AssociatedInterfacePtrController;
exports.AssociatedBinding = AssociatedBinding;
+ exports.AssociatedBindingSet = AssociatedBindingSet;
return exports;
});
« no previous file with comments | « no previous file | mojo/public/js/bindings.js » ('j') | third_party/WebKit/LayoutTests/mojo/associated_binding.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698