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

Unified Diff: runtime/vm/dart_api_message.cc

Issue 10698011: Support posting of external data into dart as external uint8 arrays through the Dart API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 6 months 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 | « runtime/include/dart_api.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_message.cc
diff --git a/runtime/vm/dart_api_message.cc b/runtime/vm/dart_api_message.cc
index 7fb311ffa895897652dc7f24dca2d87212af4da9..79bb4940e842a7348ef4e7b658701068d6e2d4f5 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -715,6 +715,27 @@ void ApiMessageWriter::WriteCObjectInlined(Dart_CObject* object,
}
break;
}
+ case Dart_CObject::kExternalUint8Array: {
+ // TODO(ager): we are writing C pointers into the message in
+ // order to post external arrays through ports. We need to make
+ // sure that messages containing pointers can never be posted
+ // to other processes.
+
+ // Write out serialization header value for this object.
+ WriteInlinedHeader(object);
+ // Write out the class and tag information.
+ WriteObjectHeader(ObjectStore::kExternalUint8ArrayClass, 0);
+ int length = object->value.as_external_byte_array.length;
+ uint8_t* data = object->value.as_external_byte_array.data;
+ void* peer = object->value.as_external_byte_array.peer;
+ Dart_PeerFinalizer callback =
+ object->value.as_external_byte_array.callback;
+ WriteSmi(length);
+ WriteIntptrValue(reinterpret_cast<intptr_t>(data));
+ WriteIntptrValue(reinterpret_cast<intptr_t>(peer));
+ WriteIntptrValue(reinterpret_cast<intptr_t>(callback));
+ break;
+ }
default:
UNREACHABLE();
}
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698