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

Side by Side Diff: test/cctest/test-circular-queue.cc

Issue 462033002: Fix newly discovered presubmit errors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More of the same. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 100
101 namespace { 101 namespace {
102 102
103 typedef v8::base::AtomicWord Record; 103 typedef v8::base::AtomicWord Record;
104 typedef SamplingCircularQueue<Record, 12> TestSampleQueue; 104 typedef SamplingCircularQueue<Record, 12> TestSampleQueue;
105 105
106 class ProducerThread: public v8::base::Thread { 106 class ProducerThread: public v8::base::Thread {
107 public: 107 public:
108 ProducerThread(TestSampleQueue* scq, 108 ProducerThread(TestSampleQueue* scq, int records_per_chunk, Record value,
109 int records_per_chunk,
110 Record value,
111 v8::base::Semaphore* finished) 109 v8::base::Semaphore* finished)
112 : Thread("producer"), 110 : Thread(Options("producer")),
113 scq_(scq), 111 scq_(scq),
114 records_per_chunk_(records_per_chunk), 112 records_per_chunk_(records_per_chunk),
115 value_(value), 113 value_(value),
116 finished_(finished) { } 114 finished_(finished) {}
117 115
118 virtual void Run() { 116 virtual void Run() {
119 for (Record i = value_; i < value_ + records_per_chunk_; ++i) { 117 for (Record i = value_; i < value_ + records_per_chunk_; ++i) {
120 Record* rec = reinterpret_cast<Record*>(scq_->StartEnqueue()); 118 Record* rec = reinterpret_cast<Record*>(scq_->StartEnqueue());
121 CHECK_NE(NULL, rec); 119 CHECK_NE(NULL, rec);
122 *rec = i; 120 *rec = i;
123 scq_->FinishEnqueue(); 121 scq_->FinishEnqueue();
124 } 122 }
125 123
126 finished_->Signal(); 124 finished_->Signal();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 Record* rec = reinterpret_cast<Record*>(scq.Peek()); 178 Record* rec = reinterpret_cast<Record*>(scq.Peek());
181 CHECK_NE(NULL, rec); 179 CHECK_NE(NULL, rec);
182 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec)); 180 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(*rec));
183 CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek())); 181 CHECK_EQ(rec, reinterpret_cast<Record*>(scq.Peek()));
184 scq.Remove(); 182 scq.Remove();
185 CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek())); 183 CHECK_NE(rec, reinterpret_cast<Record*>(scq.Peek()));
186 } 184 }
187 185
188 CHECK_EQ(NULL, scq.Peek()); 186 CHECK_EQ(NULL, scq.Peek());
189 } 187 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698