Index: third_party/mojo/src/mojo/public/dart/lib/src/codec.dart |
diff --git a/third_party/mojo/src/mojo/public/dart/src/codec.dart b/third_party/mojo/src/mojo/public/dart/lib/src/codec.dart |
similarity index 98% |
rename from third_party/mojo/src/mojo/public/dart/src/codec.dart |
rename to third_party/mojo/src/mojo/public/dart/lib/src/codec.dart |
index 89e32c279ba75e4d2ec7b6eabcfd715c4a181821..07bad358bbff0ad229c4f4a464f3b970cbd5dafd 100644 |
--- a/third_party/mojo/src/mojo/public/dart/src/codec.dart |
+++ b/third_party/mojo/src/mojo/public/dart/lib/src/codec.dart |
@@ -201,11 +201,10 @@ class Encoder { |
void encodeInterface( |
core.MojoEventStreamListener interface, int offset, bool nullable) { |
- // Set the version field to 0 for now. |
- encodeUint32(0, offset + kSerializedHandleSize); |
- |
if (interface == null) { |
encodeInvalideHandle(offset, nullable); |
+ // Set the version field to 0. |
+ encodeUint32(0, offset + kSerializedHandleSize); |
return; |
} |
if (interface is Stub) { |
@@ -214,6 +213,8 @@ class Encoder { |
interface.bind(pipe.endpoints[0]); |
interface.listen(); |
encodeMessagePipeHandle(pipe.endpoints[1], offset, nullable); |
+ // Set the version to the version in the stub. |
+ encodeUint32(interface.version, offset + kSerializedHandleSize); |
} else if (interface is Proxy) { |
assert(interface.isBound); |
if (!interface.isOpen) { |
@@ -222,6 +223,8 @@ class Encoder { |
interface.listen(); |
} |
encodeMessagePipeHandle(interface.endpoint, offset, nullable); |
+ // Set the version to the current version of the proxy. |
+ encodeUint32(interface.version, offset + kSerializedHandleSize); |
} else { |
throw new MojoCodecError( |
'Trying to encode an unknown MojoEventStreamListener'); |
@@ -594,9 +597,14 @@ class Decoder { |
ProxyBase decodeServiceInterface( |
int offset, bool nullable, Function clientFactory) { |
- // Ignore the version field for now. |
var endpoint = decodeMessagePipeHandle(offset, nullable); |
- return endpoint.handle.isValid ? clientFactory(endpoint) : null; |
+ var version = decodeUint32(offset + kSerializedHandleSize); |
+ if (!endpoint.handle.isValid) { |
+ return null; |
+ } |
+ ProxyBase client = clientFactory(endpoint); |
+ client.impl._version = version; |
+ return client; |
} |
Stub decodeInterfaceRequest( |