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

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

Issue 2556353004: Mojo JS bindings: code generator maps interface ptr and request to InterfacePtr and InterfaceReques… (Closed)
Patch Set: . Created 4 years 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/interface_types.js
diff --git a/mojo/public/js/interface_types.js b/mojo/public/js/interface_types.js
new file mode 100644
index 0000000000000000000000000000000000000000..01ea2d1dd466a76f2f5ccb1259efe0eac00a1677
--- /dev/null
+++ b/mojo/public/js/interface_types.js
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+define("mojo/public/js/interface_types", [
+ "mojo/public/js/core",
+], function(core) {
+
+ // ---------------------------------------------------------------------------
+
+ function InterfacePtrInfo(handle, version) {
+ this.handle = handle;
+ this.version = version;
+ }
+
+ InterfacePtrInfo.prototype.isValid = function() {
+ return core.isHandle(this.handle);
+ };
+
+ InterfacePtrInfo.prototype.close = function() {
+ if (!this.isValid())
+ return;
+
+ core.close(this.handle);
+ this.handle = null;
+ this.version = 0;
+ };
+
+ // ---------------------------------------------------------------------------
+
+ function InterfaceRequest(handle) {
+ this.handle = handle;
+ }
+
+ InterfaceRequest.prototype.isValid = function() {
+ return core.isHandle(this.handle);
+ };
+
+ InterfaceRequest.prototype.close = function() {
+ if (!this.isValid())
+ return;
+
+ core.close(this.handle);
+ this.handle = null;
+ };
+
+ var exports = {};
+ exports.InterfacePtrInfo = InterfacePtrInfo;
+ exports.InterfaceRequest = InterfaceRequest;
+
+ return exports;
+});

Powered by Google App Engine
This is Rietveld 408576698