Commit c6385558 authored by haraken@chromium.org's avatar haraken@chromium.org

Pass an isolate to GetCurrent()

TEST=test-api.cc:GetCallingContextCallback

Review URL: https://chromiumcodereview.appspot.com//13426002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14146 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6e56e412
......@@ -3892,6 +3892,7 @@ class V8EXPORT Context {
/** Returns the context that is on the top of the stack. */
static Local<Context> GetCurrent();
static Local<Context> GetCurrent(Isolate* isolate);
/**
* Returns the context of the calling JavaScript code. That is the
......
......@@ -5014,6 +5014,16 @@ v8::Local<v8::Context> Context::GetCurrent() {
}
v8::Local<v8::Context> Context::GetCurrent(Isolate* exported_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate);
ASSERT(isolate == i::Isolate::Current());
i::Handle<i::Object> current = isolate->native_context();
if (current.is_null()) return Local<Context>();
i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
return Utils::ToLocal(context);
}
v8::Local<v8::Context> Context::GetCalling() {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Context::GetCalling()")) {
......
......@@ -13410,6 +13410,7 @@ v8::Persistent<Context> calling_context2;
static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) {
ApiTestFuzzer::Fuzz();
CHECK(Context::GetCurrent() == calling_context0);
CHECK(Context::GetCurrent(args.GetIsolate()) == calling_context0);
CHECK(Context::GetCalling() == calling_context1);
CHECK(Context::GetEntered() == calling_context2);
return v8::Integer::New(42);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment