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

Side by Side Diff: test/cctest/test-thread-termination.cc

Issue 484643002: Version 3.28.71.3 (merged r23081) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.28
Patch Set: 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-semaphore.cc ('k') | test/cctest/test-threads.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 v8::Script::Compile(source)->Run(); 155 v8::Script::Compile(source)->Run();
156 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate())); 156 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
157 // Test that we can run the code again after thread termination. 157 // Test that we can run the code again after thread termination.
158 v8::Script::Compile(source)->Run(); 158 v8::Script::Compile(source)->Run();
159 } 159 }
160 160
161 161
162 class TerminatorThread : public v8::base::Thread { 162 class TerminatorThread : public v8::base::Thread {
163 public: 163 public:
164 explicit TerminatorThread(i::Isolate* isolate) 164 explicit TerminatorThread(i::Isolate* isolate)
165 : Thread("TerminatorThread"), 165 : Thread(Options("TerminatorThread")),
166 isolate_(reinterpret_cast<v8::Isolate*>(isolate)) { } 166 isolate_(reinterpret_cast<v8::Isolate*>(isolate)) {}
167 void Run() { 167 void Run() {
168 semaphore->Wait(); 168 semaphore->Wait();
169 CHECK(!v8::V8::IsExecutionTerminating(isolate_)); 169 CHECK(!v8::V8::IsExecutionTerminating(isolate_));
170 v8::V8::TerminateExecution(isolate_); 170 v8::V8::TerminateExecution(isolate_);
171 } 171 }
172 172
173 private: 173 private:
174 v8::Isolate* isolate_; 174 v8::Isolate* isolate_;
175 }; 175 };
176 176
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 CompileRun(terminate_and_loop); 452 CompileRun(terminate_and_loop);
453 CHECK(!try_catch.HasTerminated()); 453 CHECK(!try_catch.HasTerminated());
454 CHECK_EQ(2, callback_counter); 454 CHECK_EQ(2, callback_counter);
455 } 455 }
456 456
457 // Now the previously requested terminate execution interrupt should trigger. 457 // Now the previously requested terminate execution interrupt should trigger.
458 CompileRun("for (var i = 0; i < 10000; i++);"); 458 CompileRun("for (var i = 0; i < 10000; i++);");
459 CHECK(try_catch.HasTerminated()); 459 CHECK(try_catch.HasTerminated());
460 CHECK_EQ(2, callback_counter); 460 CHECK_EQ(2, callback_counter);
461 } 461 }
OLDNEW
« no previous file with comments | « test/cctest/test-semaphore.cc ('k') | test/cctest/test-threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698