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

Unified Diff: runtime/vm/snapshot_test.cc

Issue 1319583003: Use the zone in ApiNativeScope for allocating objects in the ApiMessageReader instead of passing in… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-code-review-comments Created 5 years, 4 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/native_message_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot_test.cc
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index be0e815b5a17f844a7d8e6c46c8e3bd9506c679b..9c67df8e791483ed3dc53d21d689c05d6719b417 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -135,7 +135,7 @@ static void CheckEncodeDecodeMessage(Dart_CObject* root) {
ApiMessageWriter writer(&buffer, &malloc_allocator);
writer.WriteCMessage(root);
- ApiMessageReader api_reader(buffer, writer.BytesWritten(), &zone_allocator);
+ ApiMessageReader api_reader(buffer, writer.BytesWritten());
Dart_CObject* new_root = api_reader.ReadMessage();
// Check that the two messages are the same.
@@ -171,7 +171,7 @@ TEST_CASE(SerializeNull) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kNull, root->type);
@@ -199,7 +199,7 @@ TEST_CASE(SerializeSmi1) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kInt32, root->type);
@@ -228,7 +228,7 @@ TEST_CASE(SerializeSmi2) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kInt32, root->type);
@@ -257,7 +257,7 @@ Dart_CObject* SerializeAndDeserializeMint(const Mint& mint) {
}
// Read object back from the snapshot into a C structure.
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
CheckEncodeDecodeMessage(root);
@@ -331,7 +331,7 @@ TEST_CASE(SerializeDouble) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kDouble, root->type);
@@ -362,7 +362,7 @@ TEST_CASE(SerializeTrue) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kBool, root->type);
@@ -391,7 +391,7 @@ TEST_CASE(SerializeFalse) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kBool, root->type);
@@ -427,7 +427,7 @@ TEST_CASE(SerializeCapability) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kCapability, root->type);
@@ -462,7 +462,7 @@ TEST_CASE(SerializeBigint) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kBigint, root->type);
@@ -498,7 +498,7 @@ Dart_CObject* SerializeAndDeserializeBigint(const Bigint& bigint) {
}
// Read object back from the snapshot into a C structure.
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
// Bigint not supported.
EXPECT_NOTNULL(root);
@@ -593,7 +593,7 @@ static void TestString(const char* cstr) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kString, root->type);
EXPECT_STREQ(cstr, root->value.as_string);
@@ -643,7 +643,7 @@ TEST_CASE(SerializeArray) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -730,7 +730,7 @@ TEST_CASE(SerializeEmptyArray) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -765,7 +765,7 @@ TEST_CASE(SerializeByteArray) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kTypedData, root->type);
EXPECT_EQ(kTypedDataLength, root->value.as_typed_data.length);
@@ -878,7 +878,7 @@ TEST_CASE(SerializeEmptyByteArray) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kTypedData, root->type);
EXPECT_EQ(Dart_TypedData_kUint8, root->value.as_typed_data.type);
@@ -1730,9 +1730,7 @@ TEST_CASE(IntArrayMessage) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer,
- writer.BytesWritten(),
- &zone_allocator);
+ ApiMessageReader api_reader(buffer, writer.BytesWritten());
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_EQ(Dart_CObject_kArray, root->type);
EXPECT_EQ(kArrayLength, root->value.as_array.length);
@@ -1766,7 +1764,7 @@ static uint8_t* GetSerialized(Dart_Handle lib,
// Helper function to deserialize the result into a Dart_CObject structure.
static Dart_CObject* GetDeserialized(uint8_t* buffer, intptr_t buffer_len) {
// Read object back from the snapshot into a C structure.
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
return api_reader.ReadMessage();
}
@@ -1782,7 +1780,7 @@ static void CheckString(Dart_Handle dart_string, const char* expected) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kString, root->type);
@@ -1802,7 +1800,7 @@ static void CheckStringInvalid(Dart_Handle dart_string) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kUnsupported, root->type);
@@ -1912,7 +1910,7 @@ UNIT_TEST_CASE(DartGeneratedMessages) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kInt32, root->type);
@@ -1930,7 +1928,7 @@ UNIT_TEST_CASE(DartGeneratedMessages) {
// Read object back from the snapshot into a C structure.
ApiNativeScope scope;
- ApiMessageReader api_reader(buffer, buffer_len, &zone_allocator);
+ ApiMessageReader api_reader(buffer, buffer_len);
Dart_CObject* root = api_reader.ReadMessage();
EXPECT_NOTNULL(root);
EXPECT_EQ(Dart_CObject_kBigint, root->type);
« no previous file with comments | « runtime/vm/native_message_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698