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

Unified Diff: test/cctest/test-api.cc

Issue 583153002: Reland 24052 - Require V8 to be explicitly initialized before an Isolate is created (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « test/cctest/cctest.cc ('k') | test/cctest/test-ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index d065ada47a8d69753faafd52e70a2dccf82723d0..51ad973f2c2ba133ffc99d29ba0df820db0101ff 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -19486,31 +19486,26 @@ static int CalcFibonacci(v8::Isolate* isolate, int limit) {
class IsolateThread : public v8::base::Thread {
public:
- IsolateThread(v8::Isolate* isolate, int fib_limit)
- : Thread(Options("IsolateThread")),
- isolate_(isolate),
- fib_limit_(fib_limit),
- result_(0) {}
+ explicit IsolateThread(int fib_limit)
+ : Thread(Options("IsolateThread")), fib_limit_(fib_limit), result_(0) {}
void Run() {
- result_ = CalcFibonacci(isolate_, fib_limit_);
+ v8::Isolate* isolate = v8::Isolate::New();
+ result_ = CalcFibonacci(isolate, fib_limit_);
+ isolate->Dispose();
}
int result() { return result_; }
private:
- v8::Isolate* isolate_;
int fib_limit_;
int result_;
};
TEST(MultipleIsolatesOnIndividualThreads) {
- v8::Isolate* isolate1 = v8::Isolate::New();
- v8::Isolate* isolate2 = v8::Isolate::New();
-
- IsolateThread thread1(isolate1, 21);
- IsolateThread thread2(isolate2, 12);
+ IsolateThread thread1(21);
+ IsolateThread thread2(12);
// Compute some fibonacci numbers on 3 threads in 3 isolates.
thread1.Start();
@@ -19528,9 +19523,6 @@ TEST(MultipleIsolatesOnIndividualThreads) {
CHECK_EQ(result2, 144);
CHECK_EQ(result1, thread1.result());
CHECK_EQ(result2, thread2.result());
-
- isolate1->Dispose();
- isolate2->Dispose();
}
« no previous file with comments | « test/cctest/cctest.cc ('k') | test/cctest/test-ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698