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

Unified Diff: runtime/vm/dart_api_message.cc

Issue 10916207: Support receiving GrowableObjectArray on native ports (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 8 years, 3 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 | « no previous file | runtime/vm/snapshot_test.cc » ('j') | runtime/vm/snapshot_test.cc » ('J')
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 e7fb7cc3f95d8a693a95aea6a0f7ad3741a4c4f7..c1ff2493c04da815c2702534a214feaedc95c995 100644
--- a/runtime/vm/dart_api_message.cc
+++ b/runtime/vm/dart_api_message.cc
@@ -206,6 +206,24 @@ Dart_CObject* ApiMessageReader::ReadInlinedObject(intptr_t object_id) {
value->value.as_array.values[i] = ReadObjectRef();
}
return value;
+ } else if (class_id == kGrowableObjectArrayCid) {
+ // A GrowableObjectArray is serialized as its length followed by its backing
+ // store. The backing store is an array with a length which might be longer
+ // than the length of the GrowableObjectArray.
+ intptr_t len = ReadSmiValue();
+ Dart_CObject* value = GetBackRef(object_id);
+ ASSERT(value == NULL);
+ // Allocate an empty array for the GrowableObjectArray this will be updated
Mads Ager (google) 2012/09/10 14:05:05 this will -> which will
Søren Gjesse 2012/09/11 14:36:04 Done.
+ // to point to the content when the backing store has been deserialized.
+ value = AllocateDartCObjectArray(0);
+ AddBackRef(object_id, value, kIsDeserialized);
+ // Read the content of the GrowableObjectArray.
+ Dart_CObject* content = ReadObjectImpl();
+ ASSERT(content->type == Dart_CObject::kArray);
+ // Make the empty array allocated point to the backing store content.
+ value->value.as_array.length = len;
+ value->value.as_array.values = content->value.as_array.values;
siva 2012/09/11 01:46:23 How will this work if the allocator specified in t
Søren Gjesse 2012/09/11 14:36:04 We don't really have a way of running through the
+ return value;
}
return ReadInternalVMObject(class_id, object_id);
« no previous file with comments | « no previous file | runtime/vm/snapshot_test.cc » ('j') | runtime/vm/snapshot_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698