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(); |
} |