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

Unified Diff: test/cctest/test-circular-queue.cc

Issue 23686006: Rename some of SamplingCircularQueue methods (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 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 | « src/cpu-profiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-circular-queue.cc
diff --git a/test/cctest/test-circular-queue.cc b/test/cctest/test-circular-queue.cc
index 1d6775d9e9fba5aa8a16c813b6631593280c4248..c900be1a6463314d95bdc146fd0965c79b2893fe 100644
--- a/test/cctest/test-circular-queue.cc
+++ b/test/cctest/test-circular-queue.cc
@@ -41,7 +41,7 @@ TEST(SamplingCircularQueue) {
// Check that we are using non-reserved values.
// Fill up the first chunk.
- CHECK_EQ(NULL, scq.StartDequeue());
+ CHECK_EQ(NULL, scq.Peek());
for (Record i = 1; i < 1 + kMaxRecordsInQueue; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.StartEnqueue());
CHECK_NE(NULL, rec);
@@ -53,27 +53,27 @@ TEST(SamplingCircularQueue) {
CHECK_EQ(NULL, scq.StartEnqueue());
// Try to enqueue when the the queue is full. Consumption must be available.
- CHECK_NE(NULL, scq.StartDequeue());
+ CHECK_NE(NULL, scq.Peek());
for (int i = 0; i < 10; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.StartEnqueue());
CHECK_EQ(NULL, rec);
- CHECK_NE(NULL, scq.StartDequeue());
+ CHECK_NE(NULL, scq.Peek());
}
// Consume all records.
for (Record i = 1; i < 1 + kMaxRecordsInQueue; ++i) {
- Record* rec = reinterpret_cast<Record*>(scq.StartDequeue());
+ Record* rec = reinterpret_cast<Record*>(scq.Peek());
CHECK_NE(NULL, rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
- CHECK_EQ(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
- scq.FinishDequeue();
- CHECK_NE(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
+ CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
+ scq.Remove();
+ CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
// The queue is empty.
- CHECK_EQ(NULL, scq.StartDequeue());
+ CHECK_EQ(NULL, scq.Peek());
- CHECK_EQ(NULL, scq.StartDequeue());
+ CHECK_EQ(NULL, scq.Peek());
for (Record i = 0; i < kMaxRecordsInQueue / 2; ++i) {
Record* rec = reinterpret_cast<Record*>(scq.StartEnqueue());
CHECK_NE(NULL, rec);
@@ -82,18 +82,18 @@ TEST(SamplingCircularQueue) {
}
// Consume all available kMaxRecordsInQueue / 2 records.
- CHECK_NE(NULL, scq.StartDequeue());
+ CHECK_NE(NULL, scq.Peek());
for (Record i = 0; i < kMaxRecordsInQueue / 2; ++i) {
- Record* rec = reinterpret_cast<Record*>(scq.StartDequeue());
+ Record* rec = reinterpret_cast<Record*>(scq.Peek());
CHECK_NE(NULL, rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
- CHECK_EQ(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
- scq.FinishDequeue();
- CHECK_NE(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
+ CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
+ scq.Remove();
+ CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
// The queue is empty.
- CHECK_EQ(NULL, scq.StartDequeue());
+ CHECK_EQ(NULL, scq.Peek());
}
@@ -148,41 +148,41 @@ TEST(SamplingCircularQueueMultithreading) {
ProducerThread producer2(&scq, kRecordsPerChunk, 10, &semaphore);
ProducerThread producer3(&scq, kRecordsPerChunk, 20, &semaphore);
- CHECK_EQ(NULL, scq.StartDequeue());
+ CHECK_EQ(NULL, scq.Peek());
producer1.Start();
semaphore.Wait();
for (Record i = 1; i < 1 + kRecordsPerChunk; ++i) {
- Record* rec = reinterpret_cast<Record*>(scq.StartDequeue());
+ Record* rec = reinterpret_cast<Record*>(scq.Peek());
CHECK_NE(NULL, rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
- CHECK_EQ(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
- scq.FinishDequeue();
- CHECK_NE(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
+ CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
+ scq.Remove();
+ CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
- CHECK_EQ(NULL, scq.StartDequeue());
+ CHECK_EQ(NULL, scq.Peek());
producer2.Start();
semaphore.Wait();
for (Record i = 10; i < 10 + kRecordsPerChunk; ++i) {
- Record* rec = reinterpret_cast<Record*>(scq.StartDequeue());
+ Record* rec = reinterpret_cast<Record*>(scq.Peek());
CHECK_NE(NULL, rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
- CHECK_EQ(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
- scq.FinishDequeue();
- CHECK_NE(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
+ CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
+ scq.Remove();
+ CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
- CHECK_EQ(NULL, scq.StartDequeue());
+ CHECK_EQ(NULL, scq.Peek());
producer3.Start();
semaphore.Wait();
for (Record i = 20; i < 20 + kRecordsPerChunk; ++i) {
- Record* rec = reinterpret_cast<Record*>(scq.StartDequeue());
+ Record* rec = reinterpret_cast<Record*>(scq.Peek());
CHECK_NE(NULL, rec);
CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
- CHECK_EQ(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
- scq.FinishDequeue();
- CHECK_NE(rec, reinterpret_cast<Record*>(scq.StartDequeue()));
+ CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
+ scq.Remove();
+ CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
}
- CHECK_EQ(NULL, scq.StartDequeue());
+ CHECK_EQ(NULL, scq.Peek());
}
« no previous file with comments | « src/cpu-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698