| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 define("mojo/public/js/interface_types", [ |
| 6 "mojo/public/js/core", |
| 7 ], function(core) { |
| 8 |
| 9 // --------------------------------------------------------------------------- |
| 10 |
| 11 function InterfacePtrInfo(handle, version) { |
| 12 this.handle = handle; |
| 13 this.version = version; |
| 14 } |
| 15 |
| 16 InterfacePtrInfo.prototype.isValid = function() { |
| 17 return core.isHandle(this.handle); |
| 18 }; |
| 19 |
| 20 InterfacePtrInfo.prototype.close = function() { |
| 21 if (!this.isValid()) |
| 22 return; |
| 23 |
| 24 core.close(this.handle); |
| 25 this.handle = null; |
| 26 this.version = 0; |
| 27 }; |
| 28 |
| 29 // --------------------------------------------------------------------------- |
| 30 |
| 31 function InterfaceRequest(handle) { |
| 32 this.handle = handle; |
| 33 } |
| 34 |
| 35 InterfaceRequest.prototype.isValid = function() { |
| 36 return core.isHandle(this.handle); |
| 37 }; |
| 38 |
| 39 InterfaceRequest.prototype.close = function() { |
| 40 if (!this.isValid()) |
| 41 return; |
| 42 |
| 43 core.close(this.handle); |
| 44 this.handle = null; |
| 45 }; |
| 46 |
| 47 var exports = {}; |
| 48 exports.InterfacePtrInfo = InterfacePtrInfo; |
| 49 exports.InterfaceRequest = InterfaceRequest; |
| 50 |
| 51 return exports; |
| 52 }); |
| OLD | NEW |