Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(891)

Unified Diff: src/api.cc

Issue 2782613003: [WIP] Do not enter contexts automatically
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 9c2ca4aefcf84d9ba2e849410191d8037174798d..603e959fdbb67ccb5a01024eee3eb9db47071016 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -232,17 +232,20 @@ class CallDepthScope {
i::Handle<i::Context> env = Utils::OpenHandle(*context);
i::HandleScopeImplementer* impl = isolate->handle_scope_implementer();
if (isolate->context() != nullptr &&
- isolate->context()->native_context() == env->native_context() &&
- impl->LastEnteredContextWas(env)) {
+ isolate->context()->native_context() == env->native_context()) {
context_ = Local<Context>();
} else {
- context_->Enter();
+ impl->SaveContext(isolate->context());
+ isolate->set_context(*env);
}
}
if (do_callback) isolate_->FireBeforeCallEnteredCallback();
}
~CallDepthScope() {
- if (!context_.IsEmpty()) context_->Exit();
+ if (!context_.IsEmpty()) {
+ i::HandleScopeImplementer* impl = isolate_->handle_scope_implementer();
+ isolate_->set_context(impl->RestoreContext());
+ }
if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth();
if (do_callback) isolate_->FireCallCompletedCallback();
#ifdef DEBUG
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698