| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/interface_types", [ | 5 define("mojo/public/js/interface_types", [ |
| 6 "mojo/public/js/core", | 6 "mojo/public/js/core", |
| 7 ], function(core) { | 7 ], function(core) { |
| 8 | 8 |
| 9 // Constants ---------------------------------------------------------------- | 9 // Constants ---------------------------------------------------------------- |
| 10 var kInterfaceIdNamespaceMask = 0x80000000; | 10 var kInterfaceIdNamespaceMask = 0x80000000; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 InterfacePtrInfo.prototype.close = function() { | 25 InterfacePtrInfo.prototype.close = function() { |
| 26 if (!this.isValid()) | 26 if (!this.isValid()) |
| 27 return; | 27 return; |
| 28 | 28 |
| 29 core.close(this.handle); | 29 core.close(this.handle); |
| 30 this.handle = null; | 30 this.handle = null; |
| 31 this.version = 0; | 31 this.version = 0; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 function AssociatedInterfacePtrInfo(interfaceEndpointHandle, version) { |
| 35 this.interfaceEndpointHandle = interfaceEndpointHandle; |
| 36 this.version = version; |
| 37 } |
| 38 |
| 39 AssociatedInterfacePtrInfo.prototype.isValid = function() { |
| 40 return this.interfaceEndpointHandle.isValid(); |
| 41 }; |
| 42 |
| 34 // --------------------------------------------------------------------------- | 43 // --------------------------------------------------------------------------- |
| 35 | 44 |
| 36 function InterfaceRequest(handle) { | 45 function InterfaceRequest(handle) { |
| 37 this.handle = handle; | 46 this.handle = handle; |
| 38 } | 47 } |
| 39 | 48 |
| 40 InterfaceRequest.prototype.isValid = function() { | 49 InterfaceRequest.prototype.isValid = function() { |
| 41 return core.isHandle(this.handle); | 50 return core.isHandle(this.handle); |
| 42 }; | 51 }; |
| 43 | 52 |
| 44 InterfaceRequest.prototype.close = function() { | 53 InterfaceRequest.prototype.close = function() { |
| 45 if (!this.isValid()) | 54 if (!this.isValid()) |
| 46 return; | 55 return; |
| 47 | 56 |
| 48 core.close(this.handle); | 57 core.close(this.handle); |
| 49 this.handle = null; | 58 this.handle = null; |
| 50 }; | 59 }; |
| 51 | 60 |
| 61 function AssociatedInterfaceRequest(interfaceEndpointHandle) { |
| 62 this.interfaceEndpointHandle = interfaceEndpointHandle; |
| 63 } |
| 64 |
| 65 AssociatedInterfaceRequest.prototype.isValid = function() { |
| 66 return this.interfaceEndpointHandle.isValid(); |
| 67 }; |
| 68 |
| 52 function isMasterInterfaceId(interfaceId) { | 69 function isMasterInterfaceId(interfaceId) { |
| 53 return interfaceId === kMasterInterfaceId; | 70 return interfaceId === kMasterInterfaceId; |
| 54 } | 71 } |
| 55 | 72 |
| 56 function isValidInterfaceId(interfaceId) { | 73 function isValidInterfaceId(interfaceId) { |
| 57 return interfaceId !== kInvalidInterfaceId; | 74 return interfaceId !== kInvalidInterfaceId; |
| 58 } | 75 } |
| 59 | 76 |
| 60 var exports = {}; | 77 var exports = {}; |
| 61 exports.InterfacePtrInfo = InterfacePtrInfo; | 78 exports.InterfacePtrInfo = InterfacePtrInfo; |
| 62 exports.InterfaceRequest = InterfaceRequest; | 79 exports.InterfaceRequest = InterfaceRequest; |
| 80 exports.AssociatedInterfacePtrInfo = AssociatedInterfacePtrInfo; |
| 81 exports.AssociatedInterfaceRequest = AssociatedInterfaceRequest; |
| 63 exports.isMasterInterfaceId = isMasterInterfaceId; | 82 exports.isMasterInterfaceId = isMasterInterfaceId; |
| 64 exports.isValidInterfaceId = isValidInterfaceId; | 83 exports.isValidInterfaceId = isValidInterfaceId; |
| 65 exports.kInvalidInterfaceId = kInvalidInterfaceId; | 84 exports.kInvalidInterfaceId = kInvalidInterfaceId; |
| 66 exports.kMasterInterfaceId = kMasterInterfaceId; | 85 exports.kMasterInterfaceId = kMasterInterfaceId; |
| 67 exports.kInterfaceIdNamespaceMask = kInterfaceIdNamespaceMask; | 86 exports.kInterfaceIdNamespaceMask = kInterfaceIdNamespaceMask; |
| 68 | 87 |
| 69 return exports; | 88 return exports; |
| 70 }); | 89 }); |
| OLD | NEW |