Index: mojo/public/js/bindings/codec.js |
diff --git a/mojo/public/js/bindings/codec.js b/mojo/public/js/bindings/codec.js |
index 9756f4a5d6b59ca478cc6187808c7a256556c308..8f27af1d8707cac83d3d700d454a4610598b6c0b 100644 |
--- a/mojo/public/js/bindings/codec.js |
+++ b/mojo/public/js/bindings/codec.js |
@@ -452,6 +452,10 @@ define("mojo/public/js/bindings/codec", [ |
var kMessageExpectsResponse = 1 << 0; |
var kMessageIsResponse = 1 << 1; |
+ // Message header is a struct, begins with a struct header. |
+ var kNumBytesOffset = 0; |
+ var kNumFieldsOffset = 4; |
+ |
// Skip over num_bytes, num_fields, and message_name. |
var kFlagsOffset = 4 + 4 + 4; |
@@ -468,10 +472,23 @@ define("mojo/public/js/bindings/codec", [ |
setUint64(this.buffer.dataView, kRequestIDOffset, requestID); |
}; |
- Message.prototype.getFlags = function() { |
+ Message.prototype.getHeaderNumBytes = function() { |
+ return this.buffer.dataView.getUint32(kNumBytesOffset, kHostIsLittleEndian); |
+ }; |
+ |
+ Message.prototype.getHeaderNumFields = function() { |
+ return this.buffer.dataView.getUint32(kNumFieldsOffset, |
+ kHostIsLittleEndian); |
+ }; |
+ |
+ Message.prototype.getHeaderFlags = function() { |
return this.buffer.dataView.getUint32(kFlagsOffset, kHostIsLittleEndian); |
}; |
+ Message.prototype.byteLength = function() { |
+ return this.buffer.dataView.byteLength; |
+ } |
+ |
// MessageBuilder ----------------------------------------------------------- |
function MessageBuilder(messageName, payloadSize) { |
@@ -772,6 +789,7 @@ define("mojo/public/js/bindings/codec", [ |
exports.kArrayHeaderSize = kArrayHeaderSize; |
exports.kStructHeaderSize = kStructHeaderSize; |
exports.kMessageHeaderSize = kMessageHeaderSize; |
+ exports.kMessageWithRequestIDHeaderSize = kMessageWithRequestIDHeaderSize; |
exports.kMessageExpectsResponse = kMessageExpectsResponse; |
exports.kMessageIsResponse = kMessageIsResponse; |
exports.Int8 = Int8; |