Index: test/cctest/cctest.h |
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h |
index f489849bac2f2de73bc6b5fdae5bc792b45e21f1..26d99727948602fa028d23ae597776a583958f88 100644 |
--- a/test/cctest/cctest.h |
+++ b/test/cctest/cctest.h |
@@ -220,20 +220,19 @@ class RegisterThreadedTest { |
// A LocalContext holds a reference to a v8::Context. |
class LocalContext { |
public: |
+ LocalContext(v8::Isolate* isolate, |
+ v8::ExtensionConfiguration* extensions = 0, |
+ v8::Handle<v8::ObjectTemplate> global_template = |
+ v8::Handle<v8::ObjectTemplate>(), |
+ v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) { |
+ Initialize(isolate, extensions, global_template, global_object); |
+ } |
+ |
LocalContext(v8::ExtensionConfiguration* extensions = 0, |
v8::Handle<v8::ObjectTemplate> global_template = |
v8::Handle<v8::ObjectTemplate>(), |
v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) { |
- v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
- v8::HandleScope scope(isolate); |
- v8::Local<v8::Context> context = v8::Context::New(isolate, |
- extensions, |
- global_template, |
- global_object); |
- context_.Reset(isolate, context); |
- context->Enter(); |
- // We can't do this later perhaps because of a fatal error. |
- isolate_ = context->GetIsolate(); |
+ Initialize(CcTest::isolate(), extensions, global_template, global_object); |
} |
virtual ~LocalContext() { |
@@ -253,6 +252,21 @@ class LocalContext { |
} |
private: |
+ void Initialize(v8::Isolate* isolate, |
+ v8::ExtensionConfiguration* extensions, |
+ v8::Handle<v8::ObjectTemplate> global_template, |
+ v8::Handle<v8::Value> global_object) { |
+ v8::HandleScope scope(isolate); |
+ v8::Local<v8::Context> context = v8::Context::New(isolate, |
+ extensions, |
+ global_template, |
+ global_object); |
+ context_.Reset(isolate, context); |
+ context->Enter(); |
+ // We can't do this later perhaps because of a fatal error. |
+ isolate_ = isolate; |
+ } |
+ |
v8::Persistent<v8::Context> context_; |
v8::Isolate* isolate_; |
}; |