Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 51ad973f2c2ba133ffc99d29ba0df820db0101ff..d065ada47a8d69753faafd52e70a2dccf82723d0 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -19486,26 +19486,31 @@ static int CalcFibonacci(v8::Isolate* isolate, int limit) { |
class IsolateThread : public v8::base::Thread { |
public: |
- explicit IsolateThread(int fib_limit) |
- : Thread(Options("IsolateThread")), fib_limit_(fib_limit), result_(0) {} |
+ IsolateThread(v8::Isolate* isolate, int fib_limit) |
+ : Thread(Options("IsolateThread")), |
+ isolate_(isolate), |
+ fib_limit_(fib_limit), |
+ result_(0) {} |
void Run() { |
- v8::Isolate* isolate = v8::Isolate::New(); |
- result_ = CalcFibonacci(isolate, fib_limit_); |
- isolate->Dispose(); |
+ result_ = CalcFibonacci(isolate_, fib_limit_); |
} |
int result() { return result_; } |
private: |
+ v8::Isolate* isolate_; |
int fib_limit_; |
int result_; |
}; |
TEST(MultipleIsolatesOnIndividualThreads) { |
- IsolateThread thread1(21); |
- IsolateThread thread2(12); |
+ v8::Isolate* isolate1 = v8::Isolate::New(); |
+ v8::Isolate* isolate2 = v8::Isolate::New(); |
+ |
+ IsolateThread thread1(isolate1, 21); |
+ IsolateThread thread2(isolate2, 12); |
// Compute some fibonacci numbers on 3 threads in 3 isolates. |
thread1.Start(); |
@@ -19523,6 +19528,9 @@ TEST(MultipleIsolatesOnIndividualThreads) { |
CHECK_EQ(result2, 144); |
CHECK_EQ(result1, thread1.result()); |
CHECK_EQ(result2, thread2.result()); |
+ |
+ isolate1->Dispose(); |
+ isolate2->Dispose(); |
} |