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

Unified Diff: src/isolate.cc

Issue 1689863002: Introduce BeforeCallEnteredCallback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: V8_DEPRECATE_SOON Created 4 years, 10 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 | « src/isolate.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index e9a237b412c7434c5ac30313c4b4e81c8e1987f2..a8e1b27039108749da2ac849db49a09a8afbdc18 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2608,6 +2608,31 @@ Handle<JSObject> Isolate::GetSymbolRegistry() {
}
+void Isolate::AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback) {
+ for (int i = 0; i < before_call_entered_callbacks_.length(); i++) {
+ if (callback == before_call_entered_callbacks_.at(i)) return;
+ }
+ before_call_entered_callbacks_.Add(callback);
+}
+
+
+void Isolate::RemoveBeforeCallEnteredCallback(
+ BeforeCallEnteredCallback callback) {
+ for (int i = 0; i < before_call_entered_callbacks_.length(); i++) {
+ if (callback == before_call_entered_callbacks_.at(i)) {
+ before_call_entered_callbacks_.Remove(i);
+ }
+ }
+}
+
+
+void Isolate::FireBeforeCallEnteredCallback() {
+ for (int i = 0; i < before_call_entered_callbacks_.length(); i++) {
+ before_call_entered_callbacks_.at(i)(reinterpret_cast<v8::Isolate*>(this));
+ }
+}
+
+
void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) {
for (int i = 0; i < call_completed_callbacks_.length(); i++) {
if (callback == call_completed_callbacks_.at(i)) return;
@@ -2633,10 +2658,10 @@ void Isolate::FireCallCompletedCallback() {
if (!handle_scope_implementer()->CallDepthIsZero()) return;
if (run_microtasks) RunMicrotasks();
// Fire callbacks. Increase call depth to prevent recursive callbacks.
- v8::Isolate::SuppressMicrotaskExecutionScope suppress(
- reinterpret_cast<v8::Isolate*>(this));
+ v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(this);
+ v8::Isolate::SuppressMicrotaskExecutionScope suppress(isolate);
for (int i = 0; i < call_completed_callbacks_.length(); i++) {
- call_completed_callbacks_.at(i)();
+ call_completed_callbacks_.at(i)(isolate);
}
}
« no previous file with comments | « src/isolate.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698