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

Unified Diff: src/isolate.cc

Issue 249313002: Remove static CallCompletedCallback handlers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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') | src/v8.h » ('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 9a5bc5ad43b16e9bc7fabb2fe07cf06bee7b858c..bb15243496db2991dc293de1778cb81cb3402d8c 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2256,4 +2256,37 @@ Handle<JSObject> Isolate::GetSymbolRegistry() {
}
+void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) {
+ for (int i = 0; i < call_completed_callbacks_.length(); i++) {
+ if (callback == call_completed_callbacks_.at(i)) return;
+ }
+ call_completed_callbacks_.Add(callback);
+}
+
+
+void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) {
+ for (int i = 0; i < call_completed_callbacks_.length(); i++) {
+ if (callback == call_completed_callbacks_.at(i)) {
+ call_completed_callbacks_.Remove(i);
+ }
+ }
+}
+
+
+void Isolate::FireCallCompletedCallback() {
+ bool has_call_completed_callbacks = !call_completed_callbacks_.is_empty();
+ bool run_microtasks = autorun_microtasks() && microtask_pending();
+ if (!has_call_completed_callbacks && !run_microtasks) return;
+
+ if (!handle_scope_implementer()->CallDepthIsZero()) return;
Sven Panne 2014/04/24 07:08:21 This code has just moved, but nevertheless: I don'
Yang 2014/04/24 07:16:38 Agree. This should just be moved into the isolate.
+ // Fire callbacks. Increase call depth to prevent recursive callbacks.
+ handle_scope_implementer()->IncrementCallDepth();
+ if (run_microtasks) Execution::RunMicrotasks(this);
+ for (int i = 0; i < call_completed_callbacks_.length(); i++) {
+ call_completed_callbacks_.at(i)();
+ }
+ handle_scope_implementer()->DecrementCallDepth();
+}
+
+
} } // namespace v8::internal
« no previous file with comments | « src/isolate.h ('k') | src/v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698