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

Unified Diff: src/execution.cc

Issue 1433423004: Introduce JavascriptExecutionObserver scope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « src/execution.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/execution.cc
diff --git a/src/execution.cc b/src/execution.cc
index cc067a8ab88ca61ca95878f68d96eb49fd5f815d..01005977e588a135ff4b893846f5ca3ec4ed9f9c 100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -68,6 +68,7 @@ MUST_USE_RESULT MaybeHandle<Object> Invoke(Isolate* isolate, bool is_construct,
isolate->ReportPendingMessages();
return MaybeHandle<Object>();
}
+ JavascriptExecutionObserver::SetObserved(isolate);
// Placeholder for return value.
Object* value = NULL;
@@ -535,5 +536,27 @@ Object* StackGuard::HandleInterrupts() {
return isolate_->heap()->undefined_value();
}
+
+JavascriptExecutionObserver::JavascriptExecutionObserver(Isolate* isolate)
+ : isolate_(isolate), observed_(false) {
+ prev_ = isolate->execution_observer();
+ isolate->set_execution_observer(this);
+}
+
+
+JavascriptExecutionObserver::~JavascriptExecutionObserver() {
+ isolate_->set_execution_observer(prev_);
+}
+
+
+void JavascriptExecutionObserver::SetObserved(Isolate* isolate) {
+ for (JavascriptExecutionObserver* observer = isolate->execution_observer();
+ observer != NULL; observer = observer->prev_) {
+ // If this observer is already set to true, so are all its predecessors.
+ if (observer->observed_) break;
+ observer->observed_ = true;
+ }
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/execution.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698