| OLD | NEW |
| 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/codec", [ | 5 define("mojo/public/js/codec", [ |
| 6 "mojo/public/js/unicode", | 6 "mojo/public/js/unicode", |
| 7 "mojo/public/js/buffer", | 7 "mojo/public/js/buffer", |
| 8 ], function(unicode, buffer) { | 8 ], function(unicode, buffer) { |
| 9 | 9 |
| 10 var kErrorUnsigned = "Passing negative value to unsigned"; | 10 var kErrorUnsigned = "Passing negative value to unsigned"; |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 Double.encodedSize = 8; | 704 Double.encodedSize = 8; |
| 705 | 705 |
| 706 Double.decode = function(decoder) { | 706 Double.decode = function(decoder) { |
| 707 return decoder.readDouble(); | 707 return decoder.readDouble(); |
| 708 }; | 708 }; |
| 709 | 709 |
| 710 Double.encode = function(encoder, val) { | 710 Double.encode = function(encoder, val) { |
| 711 encoder.writeDouble(val); | 711 encoder.writeDouble(val); |
| 712 }; | 712 }; |
| 713 | 713 |
| 714 function Enum(cls) { |
| 715 this.cls = cls; |
| 716 } |
| 717 |
| 718 Enum.prototype.encodedSize = 4; |
| 719 |
| 720 Enum.prototype.decode = function(decoder) { |
| 721 return decoder.readInt32(); |
| 722 }; |
| 723 |
| 724 Enum.prototype.encode = function(encoder, val) { |
| 725 encoder.writeInt32(val); |
| 726 }; |
| 727 |
| 714 function PointerTo(cls) { | 728 function PointerTo(cls) { |
| 715 this.cls = cls; | 729 this.cls = cls; |
| 716 } | 730 } |
| 717 | 731 |
| 718 PointerTo.prototype.encodedSize = 8; | 732 PointerTo.prototype.encodedSize = 8; |
| 719 | 733 |
| 720 PointerTo.prototype.decode = function(decoder) { | 734 PointerTo.prototype.decode = function(decoder) { |
| 721 var pointer = decoder.decodePointer(); | 735 var pointer = decoder.decodePointer(); |
| 722 if (!pointer) { | 736 if (!pointer) { |
| 723 return null; | 737 return null; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 exports.Uint8 = Uint8; | 870 exports.Uint8 = Uint8; |
| 857 exports.Int16 = Int16; | 871 exports.Int16 = Int16; |
| 858 exports.Uint16 = Uint16; | 872 exports.Uint16 = Uint16; |
| 859 exports.Int32 = Int32; | 873 exports.Int32 = Int32; |
| 860 exports.Uint32 = Uint32; | 874 exports.Uint32 = Uint32; |
| 861 exports.Int64 = Int64; | 875 exports.Int64 = Int64; |
| 862 exports.Uint64 = Uint64; | 876 exports.Uint64 = Uint64; |
| 863 exports.Float = Float; | 877 exports.Float = Float; |
| 864 exports.Double = Double; | 878 exports.Double = Double; |
| 865 exports.String = String; | 879 exports.String = String; |
| 880 exports.Enum = Enum; |
| 866 exports.NullableString = NullableString; | 881 exports.NullableString = NullableString; |
| 867 exports.PointerTo = PointerTo; | 882 exports.PointerTo = PointerTo; |
| 868 exports.NullablePointerTo = NullablePointerTo; | 883 exports.NullablePointerTo = NullablePointerTo; |
| 869 exports.ArrayOf = ArrayOf; | 884 exports.ArrayOf = ArrayOf; |
| 870 exports.NullableArrayOf = NullableArrayOf; | 885 exports.NullableArrayOf = NullableArrayOf; |
| 871 exports.PackedBool = PackedBool; | 886 exports.PackedBool = PackedBool; |
| 872 exports.Handle = Handle; | 887 exports.Handle = Handle; |
| 873 exports.NullableHandle = NullableHandle; | 888 exports.NullableHandle = NullableHandle; |
| 874 exports.Interface = Interface; | 889 exports.Interface = Interface; |
| 875 exports.NullableInterface = NullableInterface; | 890 exports.NullableInterface = NullableInterface; |
| 876 exports.MapOf = MapOf; | 891 exports.MapOf = MapOf; |
| 877 exports.NullableMapOf = NullableMapOf; | 892 exports.NullableMapOf = NullableMapOf; |
| 878 return exports; | 893 return exports; |
| 879 }); | 894 }); |
| OLD | NEW |