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

Unified Diff: runtime/vm/dart_api_message.cc

Issue 43483004: Remove the reply port form the native isolate handler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated to new isolate API Created 7 years, 2 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/vm/dart_api_impl_test.cc ('k') | runtime/vm/native_message_handler.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 c8484f97182b0eacb8b29ad99b834ea5286a796b..0208c4016a3a921d6bbb29dcc29353dddc80b676 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -221,7 +221,8 @@ ApiMessageReader::BackRefNode* ApiMessageReader::AllocateBackRefNode(
static Dart_TypedData_Type GetTypedDataTypeFromView(
- Dart_CObject_Internal* object) {
+ Dart_CObject_Internal* object,
+ char* class_name) {
struct {
const char* name;
Dart_TypedData_Type type;
@@ -241,13 +242,6 @@ static Dart_TypedData_Type GetTypedDataTypeFromView(
{ NULL, Dart_TypedData_kInvalid },
};
- char* library_url =
- object->cls->internal.as_class.library_url->value.as_string;
- char* class_name =
- object->cls->internal.as_class.class_name->value.as_string;
- if (strcmp("dart:typed_data", library_url) != 0) {
- return Dart_TypedData_kInvalid;
- }
int i = 0;
while (view_class_names[i].name != NULL) {
if (strncmp(view_class_names[i].name,
@@ -286,31 +280,54 @@ Dart_CObject* ApiMessageReader::ReadInlinedObject(intptr_t object_id) {
static_cast<Dart_CObject_Type>(
Dart_CObject_Internal::kUninitialized));
+ char* library_uri =
+ object->cls->internal.as_class.library_url->value.as_string;
+ char* class_name =
+ object->cls->internal.as_class.class_name->value.as_string;
+
// Handle typed data views.
- Dart_TypedData_Type type = GetTypedDataTypeFromView(object);
- if (type != Dart_TypedData_kInvalid) {
- object->type =
- static_cast<Dart_CObject_Type>(Dart_CObject_Internal::kView);
+ if (strcmp("dart:typed_data", library_uri) == 0) {
+ Dart_TypedData_Type type = GetTypedDataTypeFromView(object, class_name);
+ if (type != Dart_TypedData_kInvalid) {
+ object->type =
+ static_cast<Dart_CObject_Type>(Dart_CObject_Internal::kView);
+ ReadObjectImpl(); // Skip type arguments.
+ object->internal.as_view.buffer = ReadObjectImpl();
+ object->internal.as_view.offset_in_bytes = ReadSmiValue();
+ object->internal.as_view.length = ReadSmiValue();
+ ReadObjectImpl(); // Skip last field.
+
+ // The buffer is fully read now as typed data objects are
+ // serialized in-line.
+ Dart_CObject* buffer = object->internal.as_view.buffer;
+ ASSERT(buffer->type == Dart_CObject_kTypedData);
+
+ // Now turn the view into a byte array.
+ object->type = Dart_CObject_kTypedData;
+ object->value.as_typed_data.type = type;
+ object->value.as_typed_data.length =
+ object->internal.as_view.length *
+ GetTypedDataSizeInBytes(type);
+ object->value.as_typed_data.values =
+ buffer->value.as_typed_data.values +
+ object->internal.as_view.offset_in_bytes;
+ } else {
+ // TODO(sgjesse): Handle other instances. Currently this will
+ // skew the reading as the fields of the instance is not read.
+ }
+ } else if (strcmp("dart:isolate", library_uri) == 0 &&
+ strncmp("_SendPortImpl@", class_name, 14) == 0) {
ReadObjectImpl(); // Skip type arguments.
- object->internal.as_view.buffer = ReadObjectImpl();
- object->internal.as_view.offset_in_bytes = ReadSmiValue();
- object->internal.as_view.length = ReadSmiValue();
+ // Read the port id.
+ Dart_CObject* port = ReadObjectImpl();
+ if (port->type == Dart_CObject_kInt32) {
+ object->type = Dart_CObject_kSendPort;
+ object->value.as_send_port = port->value.as_int32;
+ } else if (port->type == Dart_CObject_kInt64) {
+ object->type = Dart_CObject_kSendPort;
+ object->value.as_send_port = port->value.as_int64;
+ }
ReadObjectImpl(); // Skip last field.
-
- // The buffer is fully read now as typed data objects are
- // serialized in-line.
- Dart_CObject* buffer = object->internal.as_view.buffer;
- ASSERT(buffer->type == Dart_CObject_kTypedData);
-
- // Now turn the view into a byte array.
- object->type = Dart_CObject_kTypedData;
- object->value.as_typed_data.type = type;
- object->value.as_typed_data.length =
- object->internal.as_view.length *
- GetTypedDataSizeInBytes(type);
- object->value.as_typed_data.values =
- buffer->value.as_typed_data.values +
- object->internal.as_view.offset_in_bytes;
} else {
// TODO(sgjesse): Handle other instances. Currently this will
// skew the reading as the fields of the instance is not read.
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/native_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698