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

Unified Diff: runtime/vm/message_test.cc

Issue 11440035: Optimize the message queue for many active ports with few messages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge with caching changes. Created 8 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 | « runtime/vm/message_handler_test.cc ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/message_test.cc
diff --git a/runtime/vm/message_test.cc b/runtime/vm/message_test.cc
index f302a7b1e04b9860b1bbd63e189899036f201f22..e2bb6721caa508a7f6d608250bf8c84d26058170 100644
--- a/runtime/vm/message_test.cc
+++ b/runtime/vm/message_test.cc
@@ -73,7 +73,7 @@ TEST_CASE(MessageQueue_BasicOperations) {
}
-TEST_CASE(MessageQueue_FlushAll) {
+TEST_CASE(MessageQueue_Clear) {
MessageQueue queue;
MessageQueueTestPeer queue_peer(&queue);
Dart_Port port1 = 1;
@@ -93,84 +93,10 @@ TEST_CASE(MessageQueue_FlushAll) {
queue.Enqueue(msg2);
EXPECT(queue_peer.HasMessage());
- queue.FlushAll();
+ queue.Clear();
EXPECT(!queue_peer.HasMessage());
// msg1 and msg2 already delete by FlushAll.
}
-
-TEST_CASE(MessageQueue_Flush) {
- MessageQueue queue;
- MessageQueueTestPeer queue_peer(&queue);
- Dart_Port port1 = 1;
- Dart_Port port2 = 2;
-
- const char* str1 = "msg1";
- const char* str2 = "msg2";
-
- // Add two messages on different ports.
- Message* msg1 =
- new Message(port1, 0, AllocMsg(str1), strlen(str1) + 1,
- Message::kNormalPriority);
- queue.Enqueue(msg1);
- Message* msg2 =
- new Message(port2, 0, AllocMsg(str2), strlen(str2) + 1,
- Message::kNormalPriority);
- queue.Enqueue(msg2);
- EXPECT(queue_peer.HasMessage());
-
- queue.Flush(port1);
-
- // One message is left in the queue.
- EXPECT(queue_peer.HasMessage());
- Message* msg = queue.Dequeue();
- EXPECT(msg != NULL);
- EXPECT_STREQ(str2, reinterpret_cast<char*>(msg->data()));
-
- EXPECT(!queue_peer.HasMessage());
-
- // msg1 is already deleted by Flush.
- delete msg2;
-}
-
-
-TEST_CASE(MessageQueue_Flush_MultipleMessages) {
- MessageQueue queue;
- MessageQueueTestPeer queue_peer(&queue);
- Dart_Port port1 = 1;
-
- const char* str1 = "msg1";
- const char* str2 = "msg2";
-
- Message* msg1 =
- new Message(port1, 0, AllocMsg(str1), strlen(str1) + 1,
- Message::kNormalPriority);
- queue.Enqueue(msg1);
- Message* msg2 =
- new Message(port1, 0, AllocMsg(str2), strlen(str2) + 1,
- Message::kNormalPriority);
- queue.Enqueue(msg2);
- EXPECT(queue_peer.HasMessage());
-
- queue.Flush(port1);
-
- // Queue is empty.
- EXPECT(!queue_peer.HasMessage());
- // msg1 and msg2 are already deleted by Flush.
-}
-
-
-TEST_CASE(MessageQueue_Flush_EmptyQueue) {
- MessageQueue queue;
- MessageQueueTestPeer queue_peer(&queue);
- Dart_Port port1 = 1;
-
- EXPECT(!queue_peer.HasMessage());
- queue.Flush(port1);
-
- // Queue is still empty.
- EXPECT(!queue_peer.HasMessage());
-}
-
} // namespace dart
« no previous file with comments | « runtime/vm/message_handler_test.cc ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698