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
This commit is contained in:
parent
6e56e41205
commit
c638555853
@ -3892,6 +3892,7 @@ class V8EXPORT Context {
|
|||||||
|
|
||||||
/** Returns the context that is on the top of the stack. */
|
/** Returns the context that is on the top of the stack. */
|
||||||
static Local<Context> GetCurrent();
|
static Local<Context> GetCurrent();
|
||||||
|
static Local<Context> GetCurrent(Isolate* isolate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the context of the calling JavaScript code. That is the
|
* Returns the context of the calling JavaScript code. That is the
|
||||||
|
10
src/api.cc
10
src/api.cc
@ -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() {
|
v8::Local<v8::Context> Context::GetCalling() {
|
||||||
i::Isolate* isolate = i::Isolate::Current();
|
i::Isolate* isolate = i::Isolate::Current();
|
||||||
if (IsDeadCheck(isolate, "v8::Context::GetCalling()")) {
|
if (IsDeadCheck(isolate, "v8::Context::GetCalling()")) {
|
||||||
|
@ -13410,6 +13410,7 @@ v8::Persistent<Context> calling_context2;
|
|||||||
static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) {
|
static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) {
|
||||||
ApiTestFuzzer::Fuzz();
|
ApiTestFuzzer::Fuzz();
|
||||||
CHECK(Context::GetCurrent() == calling_context0);
|
CHECK(Context::GetCurrent() == calling_context0);
|
||||||
|
CHECK(Context::GetCurrent(args.GetIsolate()) == calling_context0);
|
||||||
CHECK(Context::GetCalling() == calling_context1);
|
CHECK(Context::GetCalling() == calling_context1);
|
||||||
CHECK(Context::GetEntered() == calling_context2);
|
CHECK(Context::GetEntered() == calling_context2);
|
||||||
return v8::Integer::New(42);
|
return v8::Integer::New(42);
|
||||||
|
Loading…
Reference in New Issue
Block a user