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

Side by Side Diff: test/cctest/test-log.cc

Issue 23748003: Cleanup Semaphore class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Build fix for Mac OS X. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-lockers.cc ('k') | test/cctest/test-semaphore.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 // BUG(913). Need to implement support for profiling multiple VM threads. 121 // BUG(913). Need to implement support for profiling multiple VM threads.
122 #if 0 122 #if 0
123 123
124 namespace { 124 namespace {
125 125
126 class LoopingThread : public v8::internal::Thread { 126 class LoopingThread : public v8::internal::Thread {
127 public: 127 public:
128 explicit LoopingThread(v8::internal::Isolate* isolate) 128 explicit LoopingThread(v8::internal::Isolate* isolate)
129 : v8::internal::Thread(isolate), 129 : v8::internal::Thread(isolate),
130 semaphore_(v8::internal::OS::CreateSemaphore(0)), 130 semaphore_(new v8::internal::Semaphore(0)),
131 run_(true) { 131 run_(true) {
132 } 132 }
133 133
134 virtual ~LoopingThread() { delete semaphore_; } 134 virtual ~LoopingThread() { delete semaphore_; }
135 135
136 void Run() { 136 void Run() {
137 self_ = pthread_self(); 137 self_ = pthread_self();
138 RunLoop(); 138 RunLoop();
139 } 139 }
140 140
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 i::OS::Sleep(1); 206 i::OS::Sleep(1);
207 } 207 }
208 } 208 }
209 }; 209 };
210 210
211 211
212 class TestSampler : public v8::internal::Sampler { 212 class TestSampler : public v8::internal::Sampler {
213 public: 213 public:
214 explicit TestSampler(v8::internal::Isolate* isolate) 214 explicit TestSampler(v8::internal::Isolate* isolate)
215 : Sampler(isolate, 0, true, true), 215 : Sampler(isolate, 0, true, true),
216 semaphore_(v8::internal::OS::CreateSemaphore(0)), 216 semaphore_(new v8::internal::Semaphore(0)),
217 was_sample_stack_called_(false) { 217 was_sample_stack_called_(false) {
218 } 218 }
219 219
220 ~TestSampler() { delete semaphore_; } 220 ~TestSampler() { delete semaphore_; }
221 221
222 void SampleStack(v8::internal::TickSample*) { 222 void SampleStack(v8::internal::TickSample*) {
223 was_sample_stack_called_ = true; 223 was_sample_stack_called_ = true;
224 } 224 }
225 225
226 void Tick(v8::internal::TickSample*) { semaphore_->Signal(); } 226 void Tick(v8::internal::TickSample*) { semaphore_->Signal(); }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 v8::Local<v8::String> s = result->ToString(); 477 v8::Local<v8::String> s = result->ToString();
478 i::ScopedVector<char> data(s->Utf8Length() + 1); 478 i::ScopedVector<char> data(s->Utf8Length() + 1);
479 CHECK_NE(NULL, data.start()); 479 CHECK_NE(NULL, data.start());
480 s->WriteUtf8(data.start()); 480 s->WriteUtf8(data.start());
481 printf("%s\n", data.start()); 481 printf("%s\n", data.start());
482 // Make sure that our output is written prior crash due to CHECK failure. 482 // Make sure that our output is written prior crash due to CHECK failure.
483 fflush(stdout); 483 fflush(stdout);
484 CHECK(false); 484 CHECK(false);
485 } 485 }
486 } 486 }
OLDNEW
« no previous file with comments | « test/cctest/test-lockers.cc ('k') | test/cctest/test-semaphore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698