Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1624)

Unified Diff: mojo/public/dart/src/codec.dart

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/dart/src/client.dart ('k') | mojo/public/dart/src/handle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/dart/src/codec.dart
diff --git a/mojo/public/dart/src/codec.dart b/mojo/public/dart/src/codec.dart
index b19ac5c42882e932c055d379bae2a06691c9202c..5d017367e4afb3e676ce027519afe946869c6658 100644
--- a/mojo/public/dart/src/codec.dart
+++ b/mojo/public/dart/src/codec.dart
@@ -155,7 +155,10 @@ class MojoDecoder {
}
core.RawMojoHandle decodeHandle() {
- return handles[readUint32()];
+ int handleIndex = readUint32();
+ return (handleIndex == kEncodedInvalidHandleValue) ?
+ new core.RawMojoHandle(core.RawMojoHandle.INVALID) :
+ handles[handleIndex];
}
String decodeString() {
@@ -323,7 +326,7 @@ class MojoEncoder {
void grow(int new_size) {
Uint8List new_buffer = new Uint8List(new_size);
- new_buffer.setRange(0, next, buffer.buffer.asUint8List());
+ new_buffer.setRange(0, buffer.lengthInBytes, buffer.buffer.asUint8List());
buffer = new_buffer.buffer.asByteData();
}
@@ -345,8 +348,12 @@ class MojoEncoder {
}
void encodeHandle(core.RawMojoHandle handle) {
- handles.add(handle);
- writeUint32(handles.length - 1);
+ if (handle.isValid) {
+ handles.add(handle);
+ writeUint32(handles.length - 1);
+ } else {
+ writeUint32(kEncodedInvalidHandleValue);
+ }
}
void encodeString(String val) {
@@ -741,3 +748,22 @@ class NullableHandle {
static const decode = Handle.decode;
static const encode = Handle.encode;
}
+
+
+class MapOf {
+ Object key;
+ Object val;
+
+ MapOf(this.key, this.val);
+
+ int encodedSize = 8;
+ Map decode(MojoDecoder decoder) => decoder.decodeMapPointer(key, val);
+ void encode(MojoEncoder encoder, Map map) {
+ encoder.encodeMapPointer(key, val, map);
+ }
+}
+
+
+class NullableMapOf extends MapOf {
+ NullableMapOf(Object key, Object val) : super(key, val);
+}
« no previous file with comments | « mojo/public/dart/src/client.dart ('k') | mojo/public/dart/src/handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698